ARM: Fix MSR when CPSR.T is set

This commit is contained in:
MerryMage 2017-08-06 00:18:16 +01:00 committed by endrift
parent 5930e10cf4
commit cb7c09e63d
2 changed files with 7 additions and 4 deletions

View File

@ -29,6 +29,7 @@ Bugfixes:
- GB, GBA Savedata: Fix savestate-related save overwriting (fixes mgba.io/i/834)
- Qt: Fix timezone issues with time overrides
- Qt: Fix sprite export pausing game indefinitely (fixes mgba.io/i/841)
- ARM: Fix MSR when T bit is set
Misc:
- GBA Timer: Use global cycles for timers
- GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722)

View File

@ -663,8 +663,9 @@ DEFINE_INSTRUCTION_ARM(MSR,
}
_ARMReadCPSR(cpu);
if (cpu->executionMode == MODE_THUMB) {
LOAD_16(cpu->prefetch[0], (cpu->gprs[ARM_PC] - WORD_SIZE_THUMB) & cpu->memory.activeMask, cpu->memory.activeRegion);
LOAD_16(cpu->prefetch[1], cpu->gprs[ARM_PC] & cpu->memory.activeMask, cpu->memory.activeRegion);
cpu->prefetch[0] = 0x46C0; // nop
cpu->prefetch[1] &= 0xFFFF;
cpu->gprs[ARM_PC] += WORD_SIZE_THUMB;
} else {
LOAD_32(cpu->prefetch[0], (cpu->gprs[ARM_PC] - WORD_SIZE_ARM) & cpu->memory.activeMask, cpu->memory.activeRegion);
LOAD_32(cpu->prefetch[1], cpu->gprs[ARM_PC] & cpu->memory.activeMask, cpu->memory.activeRegion);
@ -704,8 +705,9 @@ DEFINE_INSTRUCTION_ARM(MSRI,
}
_ARMReadCPSR(cpu);
if (cpu->executionMode == MODE_THUMB) {
LOAD_16(cpu->prefetch[0], (cpu->gprs[ARM_PC] - WORD_SIZE_THUMB) & cpu->memory.activeMask, cpu->memory.activeRegion);
LOAD_16(cpu->prefetch[1], cpu->gprs[ARM_PC] & cpu->memory.activeMask, cpu->memory.activeRegion);
cpu->prefetch[0] = 0x46C0; // nop
cpu->prefetch[1] &= 0xFFFF;
cpu->gprs[ARM_PC] += WORD_SIZE_THUMB;
} else {
LOAD_32(cpu->prefetch[0], (cpu->gprs[ARM_PC] - WORD_SIZE_ARM) & cpu->memory.activeMask, cpu->memory.activeRegion);
LOAD_32(cpu->prefetch[1], cpu->gprs[ARM_PC] & cpu->memory.activeMask, cpu->memory.activeRegion);