ARM7: Add ARMRunFake for rolling back the PC and running a fake opcode
Jeffrey Pfau jeffrey@endrift.com
Wed, 04 Feb 2015 23:30:04 -0800
3 files changed,
12 insertions(+),
8 deletions(-)
M
src/arm/arm.c
→
src/arm/arm.c
@@ -286,3 +286,13 @@ }
} 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; +}
M
src/arm/arm.h
→
src/arm/arm.h
@@ -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
M
src/debugger/debugger.c
→
src/debugger/debugger.c
@@ -112,14 +112,7 @@ if (debugger->clearSoftwareBreakpoint) {
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) {