41 #ifndef __ARCH_ARM_INTERRUPT_HH__ 42 #define __ARCH_ARM_INTERRUPT_HH__ 51 #include "debug/Interrupt.hh" 52 #include "params/ArmInterrupts.hh" 78 return dynamic_cast<const Params *
>(
_params);
93 panic(
"int_num out of bounds\n");
96 panic(
"No support for other interrupt indexes\n");
98 interrupts[int_num] =
true;
99 intStatus |=
ULL(1) << int_num;
108 panic(
"int_num out of bounds\n");
111 panic(
"No support for other interrupt indexes\n");
113 interrupts[int_num] =
false;
114 intStatus &= ~(
ULL(1) << int_num);
122 memset(interrupts, 0,
sizeof(interrupts));
138 if (!(intStatus || hcr.va || hcr.vi || hcr.vf))
145 bool allowVIrq = !cpsr.i && hcr.imo && !isSecure && !isHypMode;
146 bool allowVFiq = !cpsr.f && hcr.fmo && !isSecure && !isHypMode;
147 bool allowVAbort = !cpsr.a && hcr.amo && !isSecure && !isHypMode;
149 if ( !(intStatus || (hcr.vi && allowVIrq) || (hcr.vf && allowVFiq) ||
150 (hcr.va && allowVAbort)) )
157 return ((interrupts[
INT_IRQ] && take_irq) ||
158 (interrupts[
INT_FIQ] && take_fiq) ||
159 (interrupts[
INT_ABT] && take_ea) ||
162 (hcr.va && allowVAbort) ||
176 uint64_t maskedIntStatus;
181 virtWake = (hcr.vi || interrupts[
INT_VIRT_IRQ]) && hcr.imo;
182 virtWake |= (hcr.vf || interrupts[
INT_VIRT_FIQ]) && hcr.fmo;
183 virtWake |= hcr.va && hcr.amo;
185 return maskedIntStatus || virtWake;
195 isr.i = (useHcrMux & hcr.imo) ? (interrupts[
INT_VIRT_IRQ] || hcr.vi)
197 isr.f = (useHcrMux & hcr.fmo) ? (interrupts[
INT_VIRT_FIQ] || hcr.vf)
199 isr.a = (useHcrMux & hcr.amo) ? hcr.va : interrupts[
INT_ABT];
217 panic(
"Interrupt number out of range.\n");
219 return interrupts[interrupt];
235 bool allowVIrq = !cpsr.i && hcr.imo && !isSecure && !isHypMode;
236 bool allowVFiq = !cpsr.f && hcr.fmo && !isSecure && !isHypMode;
237 bool allowVAbort = !cpsr.a && hcr.amo && !isSecure && !isHypMode;
243 if (interrupts[
INT_IRQ] && take_irq)
244 return std::make_shared<Interrupt>();
246 return std::make_shared<VirtualInterrupt>();
247 if (interrupts[
INT_FIQ] && take_fiq)
248 return std::make_shared<FastInterrupt>();
250 return std::make_shared<VirtualFastInterrupt>();
251 if (interrupts[
INT_ABT] && take_ea)
252 return std::make_shared<SystemError>();
253 if (hcr.va && allowVAbort)
254 return std::make_shared<VirtualDataAbort>(
258 return std::make_shared<Reset>();
260 return std::make_shared<ArmSev>();
262 panic(
"intStatus and interrupts not in sync\n");
287 #endif // __ARCH_ARM_INTERRUPT_HH__ #define panic(...)
This implements a cprintf based panic() function.
void post(int int_num, int index)
bool takeInt(ThreadContext *tc, InterruptTypes int_type) const
void clear(int int_num, int index)
void serialize(CheckpointOut &cp) const
Serialize an object.
bool interrupts[NumInterruptTypes]
bool checkRaw(InterruptTypes interrupt) const
Check the state of a particular interrupt, ignoring CPSR masks.
void unserialize(CheckpointIn &cp)
Unserialize an object.
void setCPU(BaseCPU *_cpu)
ThreadContext is the external interface to all thread state for anything outside of the CPU...
static ExceptionLevel currEL(const ThreadContext *tc)
Fault getInterrupt(ThreadContext *tc)
bool checkWfiWake(HCR hcr, CPSR cpsr, SCR scr) const
This function is used to check if a wfi operation should sleep.
#define UNSERIALIZE_SCALAR(scalar)
const Params * params() const
bool checkInterrupts(ThreadContext *tc) const
#define ULL(N)
uint64_t constant
#define SERIALIZE_ARRAY(member, size)
#define SERIALIZE_SCALAR(scalar)
#define UNSERIALIZE_ARRAY(member, size)
std::ostream CheckpointOut
const SimObjectParams * _params
Cached copy of the object parameters.
uint32_t getISR(HCR hcr, CPSR cpsr, SCR scr)
void updateIntrInfo(ThreadContext *tc)
ArmInterruptsParams Params
bool inSecureState(ThreadContext *tc)
virtual RegVal readMiscReg(RegIndex misc_reg)=0
std::shared_ptr< FaultBase > Fault