From 7196901b404163fd9209c7afdae027f6cc5c4249 Mon Sep 17 00:00:00 2001 From: degasus Date: Sat, 11 Jul 2015 12:30:05 +0200 Subject: [PATCH] JitArm64: Move all FLUSH_MAINTAIN_STATE to the far cache --- Source/Core/Core/PowerPC/JitArm64/Jit.cpp | 6 ++++++ .../Core/Core/PowerPC/JitArm64/JitArm64_Branch.cpp | 12 ++++++++++++ .../Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp | 6 ++++++ .../PowerPC/JitArm64/JitArm64_SystemRegisters.cpp | 6 ++++++ 4 files changed, 30 insertions(+) diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp index e346ea198e..edc8fb8b14 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp @@ -401,6 +401,10 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitB LDR(INDEX_UNSIGNED, WA, X29, PPCSTATE_OFF(msr)); FixupBranch b1 = TBNZ(WA, 13); // Test FP enabled bit + FixupBranch far = B(); + SwitchToFarCode(); + SetJumpTarget(far); + gpr.Flush(FLUSH_MAINTAIN_STATE); fpr.Flush(FLUSH_MAINTAIN_STATE); @@ -411,6 +415,8 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitB MOVI2R(WA, js.compilerPC); WriteExceptionExit(WA); + SwitchToNearCode(); + SetJumpTarget(b1); js.firstFPInstructionFound = true; diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Branch.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Branch.cpp index 4dfd88b92e..2f5cb1b049 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Branch.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Branch.cpp @@ -142,6 +142,10 @@ void JitArm64::bcx(UGeckoInstruction inst) !(inst.BO_2 & BO_BRANCH_IF_TRUE)); } + FixupBranch far = B(); + SwitchToFarCode(); + SetJumpTarget(far); + if (inst.LK) { u32 Jumpto = js.compilerPC + 4; @@ -161,6 +165,8 @@ void JitArm64::bcx(UGeckoInstruction inst) WriteExit(destination); + SwitchToNearCode(); + if ((inst.BO & BO_DONT_CHECK_CONDITION) == 0) SetJumpTarget( pConditionDontBranch ); if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0) @@ -235,6 +241,10 @@ void JitArm64::bclrx(UGeckoInstruction inst) !(inst.BO_2 & BO_BRANCH_IF_TRUE)); } + FixupBranch far = B(); + SwitchToFarCode(); + SetJumpTarget(far); + LDR(INDEX_UNSIGNED, WA, X29, PPCSTATE_OFF(spr[SPR_LR])); AND(WA, WA, 30, 29); // Wipe the bottom 2 bits. @@ -252,6 +262,8 @@ void JitArm64::bclrx(UGeckoInstruction inst) WriteExitDestInR(WA); + SwitchToNearCode(); + if ((inst.BO & BO_DONT_CHECK_CONDITION) == 0) SetJumpTarget( pConditionDontBranch ); if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0) diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp index 4964e2e3e1..133ff3e936 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp @@ -411,6 +411,10 @@ void JitArm64::lXX(UGeckoInstruction inst) // if it's still 0, we can wait until the next event FixupBranch noIdle = CBNZ(gpr.R(d)); + FixupBranch far = B(); + SwitchToFarCode(); + SetJumpTarget(far); + gpr.Flush(FLUSH_MAINTAIN_STATE); fpr.Flush(FLUSH_MAINTAIN_STATE); @@ -423,6 +427,8 @@ void JitArm64::lXX(UGeckoInstruction inst) gpr.Unlock(WA); WriteExceptionExit(); + SwitchToNearCode(); + SetJumpTarget(noIdle); //js.compilerPC += 8; diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_SystemRegisters.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_SystemRegisters.cpp index 212c12fa8c..058a9f1d9d 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_SystemRegisters.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_SystemRegisters.cpp @@ -184,6 +184,10 @@ void JitArm64::twx(UGeckoInstruction inst) SetJumpTarget(fixup); } + FixupBranch far = B(); + SwitchToFarCode(); + SetJumpTarget(far); + gpr.Flush(FlushMode::FLUSH_MAINTAIN_STATE); fpr.Flush(FlushMode::FLUSH_MAINTAIN_STATE); @@ -196,6 +200,8 @@ void JitArm64::twx(UGeckoInstruction inst) // WA is unlocked in this function WriteExceptionExit(WA); + SwitchToNearCode(); + SetJumpTarget(dont_trap); if (!analyzer.HasOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE))