cpu/arm: fix MSR by changing modes

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2024-06-13 03:55:08 +05:30
parent c4a9c5ee5e
commit eaa4abcb90

View File

@@ -283,7 +283,7 @@ Instruction::exec(Cpu& cpu) {
uint32_t address = cpu.gpr[data.rn];
Mode mode = cpu.cpsr.mode();
int8_t i = 0;
int8_t i = 0;
pc_error(data.rn);
@@ -377,6 +377,11 @@ Instruction::exec(Cpu& cpu) {
pc_error(data.operand);
if (cpu.cpsr.mode() != Mode::User) {
if (!data.spsr) {
Psr tmp = Psr(cpu.gpr[data.operand]);
cpu.chg_mode(tmp.mode());
}
psr.set_all(cpu.gpr[data.operand]);
}
break;