gem5  v20.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 class BaseCPU;
42 class Checkpoint;
43 
44 namespace MipsISA
45 {
46 
47 class Interrupts : public BaseInterrupts
48 {
49  public:
50  typedef MipsInterruptsParams Params;
51 
52  const Params *
53  params() const
54  {
55  return dynamic_cast<const Params *>(_params);
56  }
57 
59 
60  // post(int int_num, int index) is responsible
61  // for posting an interrupt. It sets a bit
62  // in intstatus corresponding to Cause IP*. The
63  // MIPS register Cause is updated by updateIntrInfo
64  // which is called by checkInterrupts
65  //
66  void post(int int_num);
67  void post(int int_num, int index) override;
68 
69  // clear(int int_num, int index) is responsible
70  // for clearing an interrupt. It clear a bit
71  // in intstatus corresponding to Cause IP*. The
72  // MIPS register Cause is updated by updateIntrInfo
73  // which is called by checkInterrupts
74  //
75  void clear(int int_num);
76  void clear(int int_num, int index) override;
77 
78  // clearAll() is responsible
79  // for clearing all interrupts. It clears all bits
80  // in intstatus corresponding to Cause IP*. The
81  // MIPS register Cause is updated by updateIntrInfo
82  // which is called by checkInterrupts
83  //
84  void clearAll() override;
85 
86  // getInterrupt() checks if an interrupt
87  // should be returned. It ands the interrupt mask and
88  // and interrupt pending bits to see if one exists. It
89  // also makes sure interrupts are enabled (IE) and
90  // that ERL and ERX are not set
91  //
92  Fault getInterrupt() override;
93 
94  // updateIntrInfo() const syncs the
95  // MIPS cause register with the instatus variable. instatus
96  // is essentially a copy of the MIPS cause[IP7:IP0]
97  //
98  void updateIntrInfo() override;
99  bool interruptsPending() const;
100  bool onCpuTimerInterrupt() const;
101  bool checkInterrupts() const override;
102 
103  void
104  serialize(CheckpointOut &cp) const override
105  {
106  fatal("Serialization of Interrupts Unimplemented for MIPS");
107  }
108 
109  void
111  {
112  fatal("Unserialization of Interrupts Unimplemented for MIPS");
113  }
114 };
115 
116 }
117 
118 #endif
119 
fatal
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:183
MipsISA::Interrupts::post
void post(int int_num)
Definition: interrupts.cc:76
MipsISA::Interrupts::interruptsPending
bool interruptsPending() const
Definition: interrupts.cc:169
MipsISA::index
Bitfield< 30, 0 > index
Definition: pra_constants.hh:44
serialize.hh
faults.hh
MipsISA::Interrupts::updateIntrInfo
void updateIntrInfo() override
Definition: interrupts.cc:166
MipsISA::Interrupts::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: interrupts.hh:104
MipsISA::Interrupts::Params
MipsInterruptsParams Params
Definition: interrupts.hh:50
MipsISA
Definition: decoder.cc:31
cp
Definition: cprintf.cc:40
Fault
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
MipsISA::Interrupts::onCpuTimerInterrupt
bool onCpuTimerInterrupt() const
Definition: interrupts.cc:157
MipsISA::Interrupts
Definition: interrupts.hh:47
BaseInterrupts::Params
BaseInterruptsParams Params
Definition: interrupts.hh:43
compiler.hh
MipsISA::Interrupts::checkInterrupts
bool checkInterrupts() const override
Definition: interrupts.cc:121
MipsISA::Interrupts::params
const Params * params() const
Definition: interrupts.hh:53
BaseCPU
Definition: cpu_dummy.hh:43
MipsISA::Interrupts::Interrupts
Interrupts(Params *p)
Definition: interrupts.hh:58
MipsISA::Interrupts::clear
void clear(int int_num)
Definition: interrupts.cc:94
SimObject::_params
const SimObjectParams * _params
Cached copy of the object parameters.
Definition: sim_object.hh:110
MipsISA::Interrupts::getInterrupt
Fault getInterrupt() override
Definition: interrupts.cc:144
interrupts.hh
logging.hh
CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:63
MipsISA::Interrupts::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: interrupts.hh:110
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
BaseInterrupts
Definition: interrupts.hh:37
CheckpointIn
Definition: serialize.hh:67
MipsISA::Interrupts::clearAll
void clearAll() override
Definition: interrupts.cc:112

Generated on Wed Sep 30 2020 14:01:58 for gem5 by doxygen 1.8.17