Align to halfword for thumb branch long instructions

Former-commit-id: f75e4baf003dcb7c535db3692383cc95575dfd81
This commit is contained in:
Michel Heily 2019-07-29 01:55:16 +03:00
parent e962150aaf
commit 90edebbe82

View file

@ -411,7 +411,7 @@ impl Core {
if insn.flag(ThumbInstruction::FLAG_LOW_OFFSET) {
off = off << 1;
let next_pc = (self.pc - 2) | 1;
self.pc = (self.gpr[REG_LR] as i32).wrapping_add(off) as u32;
self.pc = ((self.gpr[REG_LR] & !1) as i32).wrapping_add(off) as u32;
self.gpr[REG_LR] = next_pc;
self.flush_pipeline();