ArmJit: Save/restore downcount where needed, we missed a few cases.

This commit is contained in:
Henrik Rydgård 2022-10-11 15:50:37 +02:00
parent a34e32abe1
commit df5b51990d

View File

@ -497,7 +497,9 @@ bool ArmJit::ReplaceJalTo(u32 dest) {
gpr.SetImm(MIPS_REG_RA, GetCompilerPC() + 8);
CompileDelaySlot(DELAYSLOT_NICE);
FlushAll();
SaveDowncount();
RestoreRoundingMode();
if (BLInRange((const void *)(entry->replaceFunc))) {
BL((const void *)(entry->replaceFunc));
} else {
@ -505,6 +507,8 @@ bool ArmJit::ReplaceJalTo(u32 dest) {
BL(R0);
}
ApplyRoundingMode();
RestoreDowncount();
WriteDownCountR(R0);
}
@ -745,6 +749,7 @@ bool ArmJit::CheckJitBreakpoint(u32 addr, int downcountOffset) {
FlushAll();
MOVI2R(SCRATCHREG1, GetCompilerPC());
MovToPC(SCRATCHREG1);
SaveDowncount();
RestoreRoundingMode();
MOVI2R(R0, addr);
QuickCallFunction(SCRATCHREG2, &JitBreakpoint);
@ -754,6 +759,7 @@ bool ArmJit::CheckJitBreakpoint(u32 addr, int downcountOffset) {
FixupBranch skip = B_CC(CC_EQ);
WriteDownCount(downcountOffset);
ApplyRoundingMode();
RestoreDowncount();
B((const void *)dispatcherCheckCoreState);
SetJumpTarget(skip);
@ -771,6 +777,7 @@ bool ArmJit::CheckMemoryBreakpoint(int instructionOffset) {
MRS(R8);
FlushAll();
SaveDowncount();
RestoreRoundingMode();
MOVI2R(R0, GetCompilerPC());
MovToPC(R0);
@ -783,6 +790,7 @@ bool ArmJit::CheckMemoryBreakpoint(int instructionOffset) {
FixupBranch skip = B_CC(CC_EQ);
WriteDownCount(-1 - off);
ApplyRoundingMode();
RestoreDowncount();
B((const void *)dispatcherCheckCoreState);
SetJumpTarget(skip);