Make sure CPSR is updated for IRQ mode properly

This commit is contained in:
Jeffrey Pfau 2013-04-17 00:29:20 -07:00
parent f30b367c7e
commit 38b1c8d235
1 changed files with 2 additions and 1 deletions

View File

@ -122,8 +122,9 @@ void ARMRaiseIRQ(struct ARMCore* cpu) {
} else { } else {
instructionWidth = WORD_SIZE_ARM; instructionWidth = WORD_SIZE_ARM;
} }
ARMSetPrivilegeMode(cpu, MODE_IRQ);
cpu->spsr = cpsr; cpu->spsr = cpsr;
ARMSetPrivilegeMode(cpu, MODE_IRQ);
cpu->cpsr.priv = MODE_IRQ;
cpu->gprs[ARM_LR] = cpu->gprs[ARM_PC] - instructionWidth + WORD_SIZE_ARM; cpu->gprs[ARM_LR] = cpu->gprs[ARM_PC] - instructionWidth + WORD_SIZE_ARM;
cpu->gprs[ARM_PC] = BASE_IRQ + WORD_SIZE_ARM; cpu->gprs[ARM_PC] = BASE_IRQ + WORD_SIZE_ARM;
cpu->memory->setActiveRegion(cpu->memory, cpu->gprs[ARM_PC]); cpu->memory->setActiveRegion(cpu->memory, cpu->gprs[ARM_PC]);