gem5  v22.1.0.0
interrupts.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 MIPS Technologies, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef __ARCH_MIPS_INTERRUPT_HH__
30 #define __ARCH_MIPS_INTERRUPT_HH__
31 
32 #include <string>
33 
35 #include "arch/mips/faults.hh"
36 #include "base/compiler.hh"
37 #include "base/logging.hh"
38 #include "params/MipsInterrupts.hh"
39 #include "sim/serialize.hh"
40 
41 namespace gem5
42 {
43 
44 class BaseCPU;
45 class Checkpoint;
46 
47 namespace MipsISA
48 {
49 
50 class Interrupts : public BaseInterrupts
51 {
52  public:
53  using Params = MipsInterruptsParams;
54 
56 
57  // post(int int_num, int index) is responsible
58  // for posting an interrupt. It sets a bit
59  // in intstatus corresponding to Cause IP*. The
60  // MIPS register Cause is updated by updateIntrInfo
61  // which is called by checkInterrupts
62  //
63  void post(int int_num);
64  void post(int int_num, int index) override;
65 
66  // clear(int int_num, int index) is responsible
67  // for clearing an interrupt. It clear a bit
68  // in intstatus corresponding to Cause IP*. The
69  // MIPS register Cause is updated by updateIntrInfo
70  // which is called by checkInterrupts
71  //
72  void clear(int int_num);
73  void clear(int int_num, int index) override;
74 
75  // clearAll() is responsible
76  // for clearing all interrupts. It clears all bits
77  // in intstatus corresponding to Cause IP*. The
78  // MIPS register Cause is updated by updateIntrInfo
79  // which is called by checkInterrupts
80  //
81  void clearAll() override;
82 
83  // getInterrupt() checks if an interrupt
84  // should be returned. It ands the interrupt mask and
85  // and interrupt pending bits to see if one exists. It
86  // also makes sure interrupts are enabled (IE) and
87  // that ERL and ERX are not set
88  //
89  Fault getInterrupt() override;
90 
91  // updateIntrInfo() const syncs the
92  // MIPS cause register with the instatus variable. instatus
93  // is essentially a copy of the MIPS cause[IP7:IP0]
94  //
95  void updateIntrInfo() override;
96  bool interruptsPending() const;
97  bool onCpuTimerInterrupt() const;
98  bool checkInterrupts() const override;
99 
100  void
101  serialize(CheckpointOut &cp) const override
102  {
103  fatal("Serialization of Interrupts Unimplemented for MIPS");
104  }
105 
106  void
107  unserialize(CheckpointIn &cp) override
108  {
109  fatal("Unserialization of Interrupts Unimplemented for MIPS");
110  }
111 };
112 
113 } // namespace MipsISA
114 } // namespace gem5
115 
116 #endif
BaseInterruptsParams Params
Definition: interrupts.hh:47
bool onCpuTimerInterrupt() const
Definition: interrupts.cc:161
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: interrupts.hh:107
bool interruptsPending() const
Definition: interrupts.cc:173
void updateIntrInfo() override
Definition: interrupts.cc:170
Fault getInterrupt() override
Definition: interrupts.cc:147
void clearAll() override
Definition: interrupts.cc:115
Interrupts(const Params &p)
Definition: interrupts.hh:55
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: interrupts.hh:101
void post(int int_num)
Definition: interrupts.cc:79
bool checkInterrupts() const override
Definition: interrupts.cc:124
void clear(int int_num)
Definition: interrupts.cc:97
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:190
Bitfield< 30, 0 > index
Bitfield< 0 > p
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::shared_ptr< FaultBase > Fault
Definition: types.hh:248
std::ostream CheckpointOut
Definition: serialize.hh:66

Generated on Wed Dec 21 2022 10:22:24 for gem5 by doxygen 1.9.1