mirror of https://github.com/mgba-emu/mgba.git
ARM9: Fix blx lr
This commit is contained in:
parent
92e4c859a7
commit
5dca783569
|
@ -706,9 +706,10 @@ DEFINE_INSTRUCTION_ARM(BLX,
|
|||
|
||||
DEFINE_INSTRUCTION_ARM(BLX2,
|
||||
int rm = opcode & 0x0000000F;
|
||||
int address = cpu->gprs[rm];
|
||||
cpu->gprs[ARM_LR] = cpu->gprs[ARM_PC] - WORD_SIZE_ARM;
|
||||
_ARMSetMode(cpu, cpu->gprs[rm] & 0x00000001);
|
||||
cpu->gprs[ARM_PC] = cpu->gprs[rm] & 0xFFFFFFFE;
|
||||
_ARMSetMode(cpu, address & 0x00000001);
|
||||
cpu->gprs[ARM_PC] = address & 0xFFFFFFFE;
|
||||
if (cpu->executionMode == MODE_THUMB) {
|
||||
THUMB_WRITE_PC;
|
||||
} else {
|
||||
|
|
|
@ -422,13 +422,14 @@ DEFINE_INSTRUCTION_THUMB(BX,
|
|||
|
||||
DEFINE_INSTRUCTION_THUMB(BLX2,
|
||||
int rm = (opcode >> 3) & 0xF;
|
||||
_ARMSetMode(cpu, cpu->gprs[rm] & 0x00000001);
|
||||
int address = cpu->gprs[rm];
|
||||
_ARMSetMode(cpu, address & 0x00000001);
|
||||
int misalign = 0;
|
||||
if (rm == ARM_PC) {
|
||||
misalign = cpu->gprs[rm] & 0x00000002;
|
||||
misalign = address & 0x00000002;
|
||||
}
|
||||
cpu->gprs[ARM_LR] = cpu->gprs[ARM_PC] - 1;
|
||||
cpu->gprs[ARM_PC] = (cpu->gprs[rm] & 0xFFFFFFFE) - misalign;
|
||||
cpu->gprs[ARM_PC] = (address & 0xFFFFFFFE) - misalign;
|
||||
if (cpu->executionMode == MODE_THUMB) {
|
||||
THUMB_WRITE_PC;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue