43 #ifndef __ARCH_ARM_INTERRUPT_HH__ 44 #define __ARCH_ARM_INTERRUPT_HH__ 53 #include "debug/Interrupt.hh" 54 #include "params/ArmInterrupts.hh" 80 return dynamic_cast<const Params *
>(
_params);
95 panic(
"int_num out of bounds\n");
98 panic(
"No support for other interrupt indexes\n");
100 interrupts[int_num] =
true;
101 intStatus |=
ULL(1) << int_num;
110 panic(
"int_num out of bounds\n");
113 panic(
"No support for other interrupt indexes\n");
115 interrupts[int_num] =
false;
116 intStatus &= ~(
ULL(1) << int_num);
124 memset(interrupts, 0,
sizeof(interrupts));
140 if (!(intStatus || hcr.va || hcr.vi || hcr.vf))
147 bool allowVIrq = !cpsr.i && hcr.imo && !isSecure && !isHypMode;
148 bool allowVFiq = !cpsr.f && hcr.fmo && !isSecure && !isHypMode;
149 bool allowVAbort = !cpsr.a && hcr.amo && !isSecure && !isHypMode;
151 if ( !(intStatus || (hcr.vi && allowVIrq) || (hcr.vf && allowVFiq) ||
152 (hcr.va && allowVAbort)) )
159 return ((interrupts[
INT_IRQ] && take_irq) ||
160 (interrupts[
INT_FIQ] && take_fiq) ||
161 (interrupts[
INT_ABT] && take_ea) ||
164 (hcr.va && allowVAbort) ||
178 uint64_t maskedIntStatus;
183 virtWake = (hcr.vi || interrupts[
INT_VIRT_IRQ]) && hcr.imo;
184 virtWake |= (hcr.vf || interrupts[
INT_VIRT_FIQ]) && hcr.fmo;
185 virtWake |= hcr.va && hcr.amo;
187 return maskedIntStatus || virtWake;
197 isr.i = (useHcrMux & hcr.imo) ? (interrupts[
INT_VIRT_IRQ] || hcr.vi)
199 isr.f = (useHcrMux & hcr.fmo) ? (interrupts[
INT_VIRT_FIQ] || hcr.vf)
201 isr.a = (useHcrMux & hcr.amo) ? hcr.va : interrupts[
INT_ABT];
219 panic(
"Interrupt number out of range.\n");
221 return interrupts[interrupt];
237 bool allowVIrq = !cpsr.i && hcr.imo && !isSecure && !isHypMode;
238 bool allowVFiq = !cpsr.f && hcr.fmo && !isSecure && !isHypMode;
239 bool allowVAbort = !cpsr.a && hcr.amo && !isSecure && !isHypMode;
245 if (interrupts[
INT_IRQ] && take_irq)
246 return std::make_shared<Interrupt>();
248 return std::make_shared<VirtualInterrupt>();
249 if (interrupts[
INT_FIQ] && take_fiq)
250 return std::make_shared<FastInterrupt>();
252 return std::make_shared<VirtualFastInterrupt>();
253 if (interrupts[
INT_ABT] && take_ea)
254 return std::make_shared<SystemError>();
255 if (hcr.va && allowVAbort)
256 return std::make_shared<VirtualDataAbort>(
260 return std::make_shared<Reset>();
262 return std::make_shared<ArmSev>();
264 panic(
"intStatus and interrupts not in sync\n");
289 #endif // __ARCH_ARM_INTERRUPT_HH__ #define panic(...)
This implements a cprintf based panic() function.
void post(int int_num, int index)
static ExceptionLevel currEL(ThreadContext *tc)
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...
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
#define SERIALIZE_ARRAY(member, size)
bool checkInterrupts(ThreadContext *tc) const
#define ULL(N)
uint64_t constant
#define SERIALIZE_SCALAR(scalar)
#define UNSERIALIZE_ARRAY(member, size)
std::ostream CheckpointOut
uint32_t getISR(HCR hcr, CPSR cpsr, SCR scr)
void updateIntrInfo(ThreadContext *tc)
const SimObjectParams * _params
Cached copy of the object parameters.
ArmInterruptsParams Params
bool inSecureState(ThreadContext *tc)
virtual RegVal readMiscReg(RegIndex misc_reg)=0
std::shared_ptr< FaultBase > Fault