fix(cpu): force-align SWP reads and writes

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-02-05 23:18:23 -04:00
parent 9581e3b3cb
commit adfd501fc4
1 changed files with 2 additions and 2 deletions

View File

@ -20,8 +20,8 @@ pub fn singleDataSwap(comptime B: bool) InstrFn {
cpu.r[rd] = value;
} else {
// SWP
const value = std.math.rotr(u32, bus.read32(address), 8 * (address & 0x3));
bus.write32(address, cpu.r[rm]);
const value = std.math.rotr(u32, bus.read32(address & 0xFFFF_FFFC), 8 * (address & 0x3));
bus.write32(address & 0xFFFF_FFFC, cpu.r[rm]);
cpu.r[rd] = value;
}
}