translate_arm/branch: Read-after-write in arm_BLX_reg

When BLX LR is translated, BXWritePC(GetRegister(Reg::LR)) was executed
after the SetRegister(Reg::LR, _) update was done.
This commit is contained in:
MerryMage 2016-08-22 14:38:06 +01:00
parent d8bee60947
commit 843d29b5a9

View file

@ -51,8 +51,8 @@ bool ArmTranslatorVisitor::arm_BLX_reg(Cond cond, Reg m) {
// BLX <Rm> // BLX <Rm>
if (ConditionPassed(cond)) { if (ConditionPassed(cond)) {
ir.PushRSB(ir.current_location.AdvancePC(4)); ir.PushRSB(ir.current_location.AdvancePC(4));
ir.SetRegister(Reg::LR, ir.Imm32(ir.current_location.PC() + 4));
ir.BXWritePC(ir.GetRegister(m)); ir.BXWritePC(ir.GetRegister(m));
ir.SetRegister(Reg::LR, ir.Imm32(ir.current_location.PC() + 4));
ir.SetTerm(IR::Term::ReturnToDispatch{}); ir.SetTerm(IR::Term::ReturnToDispatch{});
return false; return false;
} }