Compare commits

...

1 Commits

Author SHA1 Message Date
dcff3fd588 fix(v5te): account for high vectors in swi 2023-10-09 19:28:04 -05:00
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.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);
}
}.inner;

View File

@@ -14,7 +14,13 @@ pub fn fmt17(comptime InstrFn: type) InstrFn {
cpu.r[14] = ret_addr; // Resume Execution
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);
}
}.inner;