Force R15 alignment via cpu.set_reg
I've encounted many bugs with instructions that write PC but don't align it. Former-commit-id: b6a234564729f83c0b5e8adfa293227299aad4ac
This commit is contained in:
parent
7e7d2c5208
commit
863838a4a4
|
@ -116,7 +116,7 @@ impl Core {
|
||||||
pub fn set_reg(&mut self, reg_num: usize, val: u32) {
|
pub fn set_reg(&mut self, reg_num: usize, val: u32) {
|
||||||
match reg_num {
|
match reg_num {
|
||||||
0...14 => self.gpr[reg_num] = val,
|
0...14 => self.gpr[reg_num] = val,
|
||||||
15 => self.pc = val,
|
15 => self.pc = val & !1,
|
||||||
_ => panic!("invalid register"),
|
_ => panic!("invalid register"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue