fix(v5te): account for high vectors in swi

This commit is contained in:
Rekai Nyangadzayi Musuka 2023-10-09 19:26:57 -05:00
parent 8d2a3f1b67
commit dcff3fd588
2 changed files with 14 additions and 2 deletions

View File

@ -14,7 +14,13 @@ pub fn armSoftwareInterrupt(comptime InstrFn: type) InstrFn {
cpu.r[14] = ret_addr; // Resume Execution cpu.r[14] = ret_addr; // Resume Execution
cpu.spsr.raw = cpsr; // Previous mode CPSR cpu.spsr.raw = cpsr; // Previous mode CPSR
cpu.r[15] = 0x0000_0008; cpu.r[15] = switch (Arm32.arch) {
.v4t => 0x0000_0008,
.v5te => blk: {
const ctrl = cpu.cp15.read(0, 1, 0, 0);
break :blk if (ctrl >> 13 & 1 == 1) 0xFFFF_0008 else 0x0000_0008;
},
};
cpu.pipe.reload(cpu); cpu.pipe.reload(cpu);
} }
}.inner; }.inner;

View File

@ -14,7 +14,13 @@ pub fn fmt17(comptime InstrFn: type) InstrFn {
cpu.r[14] = ret_addr; // Resume Execution cpu.r[14] = ret_addr; // Resume Execution
cpu.spsr.raw = cpsr; // Previous mode CPSR cpu.spsr.raw = cpsr; // Previous mode CPSR
cpu.r[15] = 0x0000_0008; cpu.r[15] = switch (Arm32.arch) {
.v4t => 0x0000_0008,
.v5te => blk: {
const ctrl = cpu.cp15.read(0, 1, 0, 0);
break :blk if (ctrl >> 13 & 1 == 1) 0xFFFF_0008 else 0x0000_0008;
},
};
cpu.pipe.reload(cpu); cpu.pipe.reload(cpu);
} }
}.inner; }.inner;