(interrupts[INT_RST]));
}
+ /**
+ * Check the raw interrupt state.
+ * This function is used to check if a wfi operation should sleep. If there
+ * is an interrupt pending, even if it's masked, wfi doesn't sleep.
+ * @return any interrupts pending
+ */
+ bool
+ checkRaw() const
+ {
+ return intStatus;
+ }
+
+
Fault
getInterrupt(ThreadContext *tc)
{
NextJazelle = ((CPSR)newCpsr).j;
NextItState = ((((CPSR)newCpsr).it2 << 2) & 0xFC)
| (((CPSR)newCpsr).it1 & 0x3);
+ SevMailbox = 1;
'''
buildImmDataInst(mnem + 's', code, flagType,
suffix = "ImmPclr", buildCc = False,
IWNPC = cSwap(%s, cpsr.e) | ((Spsr & 0x20) ? 1 : 0);
NextItState = ((((CPSR)Spsr).it2 << 2) & 0xFC)
| (((CPSR)Spsr).it1 & 0x3);
+ SevMailbox = 1;
'''
microLdrRetUopIop = InstObjParams('ldr_ret_uop', 'MicroLdrRetUop',
wfeCode = '''
#if FULL_SYSTEM
- if (SevMailbox) {
+ if (SevMailbox == 1) {
SevMailbox = 0;
PseudoInst::quiesceSkip(xc->tcBase());
- }
- else {
+ } else {
PseudoInst::quiesce(xc->tcBase());
}
#endif
wfiCode = '''
#if FULL_SYSTEM
- PseudoInst::quiesce(xc->tcBase());
+ // WFI doesn't sleep if interrupts are pending (masked or not)
+ if (xc->tcBase()->getCpuPtr()->getInterruptController()->checkRaw()) {
+ PseudoInst::quiesceSkip(xc->tcBase());
+ } else {
+ PseudoInst::quiesce(xc->tcBase());
+ }
#endif
'''
wfiIop = InstObjParams("wfi", "WfiInst", "PredOp", \
System *sys = xc->tcBase()->getSystemPtr();
for (int x = 0; x < sys->numContexts(); x++) {
ThreadContext *oc = sys->getThreadContext(x);
- if (oc != xc->tcBase()) {
+ if (oc == xc->tcBase())
+ continue;
+ // Only wake if they were sleeping
+ if (oc->readMiscReg(MISCREG_SEV_MAILBOX) == 0) {
oc->setMiscReg(MISCREG_SEV_MAILBOX, 1);
+ PseudoInst::wakeCPU(xc->tcBase(), x);
}
}
'''