thumb32: Ensure CPSR.IT state is always up to date

This commit is contained in:
MerryMage 2021-02-22 00:27:16 +00:00
parent f5dd7122a2
commit 29d7cbd899
2 changed files with 4 additions and 3 deletions

View file

@ -860,7 +860,7 @@ bool ThumbTranslatorVisitor::thumb16_SETEND(bool E) {
return true; return true;
} }
ir.SetTerm(IR::Term::LinkBlock{ir.current_location.AdvancePC(2).SetEFlag(E)}); ir.SetTerm(IR::Term::LinkBlock{ir.current_location.AdvancePC(2).SetEFlag(E).AdvanceIT()});
return false; return false;
} }
@ -967,8 +967,8 @@ bool ThumbTranslatorVisitor::thumb16_CBZ_CBNZ(bool nonzero, Imm<1> i, Imm<5> imm
ir.SetCheckBit(ir.IsZero(rn)); ir.SetCheckBit(ir.IsZero(rn));
const auto [cond_pass, cond_fail] = [this, imm, nonzero] { const auto [cond_pass, cond_fail] = [this, imm, nonzero] {
const auto skip = IR::Term::LinkBlock{ir.current_location.AdvancePC(2)}; const auto skip = IR::Term::LinkBlock{ir.current_location.AdvancePC(2).AdvanceIT()};
const auto branch = IR::Term::LinkBlock{ir.current_location.AdvancePC(imm + 4)}; const auto branch = IR::Term::LinkBlock{ir.current_location.AdvancePC(imm + 4).AdvanceIT()};
if (nonzero) { if (nonzero) {
return std::make_pair(skip, branch); return std::make_pair(skip, branch);

View file

@ -24,6 +24,7 @@ bool ThumbTranslatorVisitor::thumb32_DSB([[maybe_unused]] Imm<4> option) {
bool ThumbTranslatorVisitor::thumb32_ISB([[maybe_unused]] Imm<4> option) { bool ThumbTranslatorVisitor::thumb32_ISB([[maybe_unused]] Imm<4> option) {
ir.InstructionSynchronizationBarrier(); ir.InstructionSynchronizationBarrier();
ir.UpdateUpperLocationDescriptor();
ir.BranchWritePC(ir.Imm32(ir.current_location.PC() + 4)); ir.BranchWritePC(ir.Imm32(ir.current_location.PC() + 4));
ir.SetTerm(IR::Term::ReturnToDispatch{}); ir.SetTerm(IR::Term::ReturnToDispatch{});
return false; return false;