translate_thumb: Read-after-write in thumb16_BLX_reg

When the instruction BLX LR is translated, BXWritePC(GetRegister(Reg::LR))
was executed after the SetRegister(Reg::LR, _) update was performed.
This commit is contained in:
MerryMage 2016-08-22 14:28:51 +01:00
parent 20e253ece2
commit d8bee60947

View file

@ -763,8 +763,8 @@ struct ThumbTranslatorVisitor final {
bool thumb16_BLX_reg(Reg m) { bool thumb16_BLX_reg(Reg m) {
// BLX <Rm> // BLX <Rm>
ir.PushRSB(ir.current_location.AdvancePC(2)); ir.PushRSB(ir.current_location.AdvancePC(2));
ir.SetRegister(Reg::LR, ir.Imm32((ir.current_location.PC() + 2) | 1));
ir.BXWritePC(ir.GetRegister(m)); ir.BXWritePC(ir.GetRegister(m));
ir.SetRegister(Reg::LR, ir.Imm32((ir.current_location.PC() + 2) | 1));
ir.SetTerm(IR::Term::ReturnToDispatch{}); ir.SetTerm(IR::Term::ReturnToDispatch{});
return false; return false;
} }