ARM7: Add ARMRunFake for rolling back the PC and running a fake opcode

This commit is contained in:
Jeffrey Pfau 2015-02-04 23:30:04 -08:00
parent f9110fc51e
commit 8eeaa11256
3 changed files with 12 additions and 8 deletions

View File

@ -286,3 +286,13 @@ void ARMRunLoop(struct ARMCore* cpu) {
}
cpu->irqh.processEvents(cpu);
}
void ARMRunFake(struct ARMCore* cpu, uint32_t opcode) {
if (cpu->executionMode== MODE_ARM) {
cpu->gprs[ARM_PC] -= WORD_SIZE_ARM;
} else {
cpu->gprs[ARM_PC] -= WORD_SIZE_THUMB;
}
cpu->prefetch[1] = cpu->prefetch[0];
cpu->prefetch[0] = opcode;
}

View File

@ -175,5 +175,6 @@ void ARMRaiseSWI(struct ARMCore*);
void ARMRun(struct ARMCore* cpu);
void ARMRunLoop(struct ARMCore* cpu);
void ARMRunFake(struct ARMCore* cpu, uint32_t opcode);
#endif

View File

@ -112,14 +112,7 @@ void ARMDebuggerEnter(struct ARMDebugger* debugger, enum DebuggerEntryReason rea
debugger->clearSoftwareBreakpoint(debugger, breakpoint->address, breakpoint->sw.mode, breakpoint->sw.opcode);
}
// Roll back CPU state
if (breakpoint->sw.mode == MODE_ARM) {
cpu->gprs[ARM_PC] -= WORD_SIZE_ARM;
} else {
cpu->gprs[ARM_PC] -= WORD_SIZE_THUMB;
}
cpu->prefetch[1] = cpu->prefetch[0];
cpu->prefetch[0] = breakpoint->sw.opcode;
ARMRunFake(cpu, breakpoint->sw.opcode);
}
}
if (debugger->entered) {