all repos — mgba @ cb7c09e63d88ced801bac241eb4f4434c1a30f31

mGBA Game Boy Advance Emulator

ARM: Fix MSR when CPSR.T is set
MerryMage MerryMage@users.noreply.github.com
Sun, 06 Aug 2017 00:18:16 +0100
commit

cb7c09e63d88ced801bac241eb4f4434c1a30f31

parent

5930e10cf42562fd4937ae7eb40d1de39f06a5c4

2 files changed, 7 insertions(+), 4 deletions(-)

jump to
M CHANGESCHANGES

@@ -29,6 +29,7 @@ - Qt: Fix GL display when loading a game from CLI (fixes mgba.io/i/843)

- 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)
M src/arm/isa-arm.csrc/arm/isa-arm.c

@@ -663,8 +663,9 @@ cpu->cpsr.packed = (cpu->cpsr.packed & ~PSR_PRIV_MASK) | (operand & PSR_PRIV_MASK);

} _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 @@ cpu->cpsr.packed = (cpu->cpsr.packed & ~PSR_PRIV_MASK) | (operand & PSR_PRIV_MASK);

} _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);