all repos — mgba @ 8eeaa11256c9ac4a16eb4bc92188db631a9332f4

mGBA Game Boy Advance Emulator

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
commit

8eeaa11256c9ac4a16eb4bc92188db631a9332f4

parent

f9110fc51edf8a23c3e103d360164dd70728d1c5

3 files changed, 12 insertions(+), 8 deletions(-)

jump to
M src/arm/arm.csrc/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.hsrc/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.csrc/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) {