gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
41namespace gem5
42{
43
44class BaseCPU;
45class Checkpoint;
46
47namespace MipsISA
48{
49
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
108 {
109 fatal("Unserialization of Interrupts Unimplemented for MIPS");
110 }
111};
112
113} // namespace MipsISA
114} // namespace gem5
115
116#endif
bool onCpuTimerInterrupt() const
void unserialize(CheckpointIn &cp) override
Unserialize an object.
bool interruptsPending() const
void updateIntrInfo() override
Fault getInterrupt() override
MipsInterruptsParams Params
Definition interrupts.hh:53
void clearAll() override
Interrupts(const Params &p)
Definition interrupts.hh:55
void serialize(CheckpointOut &cp) const override
Serialize an object.
void post(int int_num)
Definition interrupts.cc:79
bool checkInterrupts() const override
void clear(int int_num)
Definition interrupts.cc:97
#define fatal(...)
This implements a cprintf based fatal() function.
Definition logging.hh:200
Bitfield< 30, 0 > index
Bitfield< 0 > p
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
std::shared_ptr< FaultBase > Fault
Definition types.hh:249
std::ostream CheckpointOut
Definition serialize.hh:66

Generated on Tue Jun 18 2024 16:23:57 for gem5 by doxygen 1.11.0