ARM7: Support forcing Thumb mode via MSR

This commit is contained in:
Jeffrey Pfau 2016-05-12 00:18:49 -07:00
parent b37761327e
commit b5ff48a74e
3 changed files with 6 additions and 0 deletions

View File

@ -39,6 +39,7 @@ Misc:
- All: Add QUIET parameter to silence CMake
- GBA Video: Null renderer should return proper register values
- Libretro: Disable logging game errors, BIOS calls and stubs in release builds
- ARM7: Support forcing Thumb mode via MSR
0.4.0: (2016-02-02)
Features:

View File

@ -629,6 +629,9 @@ DEFINE_INSTRUCTION_ARM(MSR,
if (mask & PSR_USER_MASK) {
cpu->cpsr.packed = (cpu->cpsr.packed & ~PSR_USER_MASK) | (operand & PSR_USER_MASK);
}
if (mask & PSR_STATE_MASK) {
cpu->cpsr.packed = (cpu->cpsr.packed & ~PSR_STATE_MASK) | (operand & PSR_STATE_MASK);
}
if (cpu->privilegeMode != MODE_USER && (mask & PSR_PRIV_MASK)) {
ARMSetPrivilegeMode(cpu, (enum PrivilegeMode) ((operand & 0x0000000F) | 0x00000010));
cpu->cpsr.packed = (cpu->cpsr.packed & ~PSR_PRIV_MASK) | (operand & PSR_PRIV_MASK);

View File

@ -85,6 +85,8 @@ static inline void _ARMSetMode(struct ARMCore* cpu, enum ExecutionMode execution
break;
case MODE_THUMB:
cpu->cpsr.t = 1;
cpu->prefetch[0] &= 0xFFFF;
cpu->prefetch[1] &= 0xFFFF;
}
cpu->nextEvent = cpu->cycles;
}