mirror of https://github.com/mgba-emu/mgba.git
ARM7: Add function for turning r15 into the address of the current instruction
This commit is contained in:
parent
7149dd3102
commit
8caf58ee42
|
@ -91,4 +91,15 @@ static inline void _ARMReadCPSR(struct ARMCore* cpu) {
|
|||
cpu->irqh.readCPSR(cpu);
|
||||
}
|
||||
|
||||
static inline uint32_t _ARMPCAddress(struct ARMCore* cpu) {
|
||||
int instructionLength;
|
||||
enum ExecutionMode mode = cpu->cpsr.t;
|
||||
if (mode == MODE_ARM) {
|
||||
instructionLength = WORD_SIZE_ARM;
|
||||
} else {
|
||||
instructionLength = WORD_SIZE_THUMB;
|
||||
}
|
||||
return cpu->gprs[ARM_PC] - instructionLength * 2;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -628,7 +628,7 @@ void GBAHitStub(struct ARMCore* cpu, uint32_t opcode) {
|
|||
if (gba->debugger) {
|
||||
level = GBA_LOG_STUB;
|
||||
struct DebuggerEntryInfo info = {
|
||||
.address = cpu->gprs[ARM_PC],
|
||||
.address = _ARMPCAddress(cpu),
|
||||
.opcode = opcode
|
||||
};
|
||||
ARMDebuggerEnter(gba->debugger, DEBUGGER_ENTER_ILLEGAL_OP, &info);
|
||||
|
@ -641,7 +641,7 @@ void GBAIllegal(struct ARMCore* cpu, uint32_t opcode) {
|
|||
GBALog(gba, GBA_LOG_WARN, "Illegal opcode: %08x", opcode);
|
||||
if (gba->debugger) {
|
||||
struct DebuggerEntryInfo info = {
|
||||
.address = cpu->gprs[ARM_PC],
|
||||
.address = _ARMPCAddress(cpu),
|
||||
.opcode = opcode
|
||||
};
|
||||
ARMDebuggerEnter(gba->debugger, DEBUGGER_ENTER_ILLEGAL_OP, &info);
|
||||
|
|
Loading…
Reference in New Issue