mirror of https://github.com/mgba-emu/mgba.git
ARM7: Add ARMRunFake for rolling back the PC and running a fake opcode
This commit is contained in:
parent
f9110fc51e
commit
8eeaa11256
|
@ -286,3 +286,13 @@ void ARMRunLoop(struct ARMCore* cpu) {
|
||||||
}
|
}
|
||||||
cpu->irqh.processEvents(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;
|
||||||
|
}
|
||||||
|
|
|
@ -175,5 +175,6 @@ void ARMRaiseSWI(struct ARMCore*);
|
||||||
|
|
||||||
void ARMRun(struct ARMCore* cpu);
|
void ARMRun(struct ARMCore* cpu);
|
||||||
void ARMRunLoop(struct ARMCore* cpu);
|
void ARMRunLoop(struct ARMCore* cpu);
|
||||||
|
void ARMRunFake(struct ARMCore* cpu, uint32_t opcode);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -112,14 +112,7 @@ void ARMDebuggerEnter(struct ARMDebugger* debugger, enum DebuggerEntryReason rea
|
||||||
debugger->clearSoftwareBreakpoint(debugger, breakpoint->address, breakpoint->sw.mode, breakpoint->sw.opcode);
|
debugger->clearSoftwareBreakpoint(debugger, breakpoint->address, breakpoint->sw.mode, breakpoint->sw.opcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Roll back CPU state
|
ARMRunFake(cpu, breakpoint->sw.opcode);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debugger->entered) {
|
if (debugger->entered) {
|
||||||
|
|
Loading…
Reference in New Issue