backend/arm64/a32_address_space: Terminate early if halted prior to execution beginning

This commit is contained in:
Merry 2022-11-08 20:05:58 +00:00
parent 282bd3ad5c
commit 7dbd87ba2d
2 changed files with 5 additions and 0 deletions

View file

@ -196,6 +196,9 @@ void A32AddressSpace::EmitPrelude() {
code.STR(Wscratch1, SP, offsetof(StackLayout, save_host_fpcr)); code.STR(Wscratch1, SP, offsetof(StackLayout, save_host_fpcr));
code.MSR(oaknut::SystemReg::FPCR, Xscratch0); code.MSR(oaknut::SystemReg::FPCR, Xscratch0);
code.LDAR(Wscratch0, Xhalt);
code.CBNZ(Wscratch0, return_from_run_code);
code.BR(X19); code.BR(X19);
} }
@ -221,6 +224,7 @@ void A32AddressSpace::EmitPrelude() {
oaknut::Label step_hr_loop; oaknut::Label step_hr_loop;
code.l(step_hr_loop); code.l(step_hr_loop);
code.LDAXR(Wscratch0, Xhalt); code.LDAXR(Wscratch0, Xhalt);
code.CBNZ(Wscratch0, return_from_run_code);
code.ORR(Wscratch0, Wscratch0, static_cast<u32>(HaltReason::Step)); code.ORR(Wscratch0, Wscratch0, static_cast<u32>(HaltReason::Step));
code.STLXR(Wscratch1, Wscratch0, Xhalt); code.STLXR(Wscratch1, Wscratch0, Xhalt);
code.CBNZ(Wscratch1, step_hr_loop); code.CBNZ(Wscratch1, step_hr_loop);

View file

@ -239,6 +239,7 @@ TEST_CASE("arm: Test InvalidateCacheRange", "[arm][A32]") {
test_env.ticks_left = 4; test_env.ticks_left = 4;
jit.Run(); jit.Run();
jit.Run();
REQUIRE(jit.Regs()[0] == 5); REQUIRE(jit.Regs()[0] == 5);
REQUIRE(jit.Regs()[1] == 7); REQUIRE(jit.Regs()[1] == 7);