From d841d9c7b3c2b0378dae2d4aa0a67ac0a6c204a8 Mon Sep 17 00:00:00 2001 From: hthh Date: Fri, 12 Aug 2016 21:09:15 +1000 Subject: [PATCH] JitArm64: Check the FIFO on EIEIO instructions Copied from the Jit64 version --- Source/Core/Core/PowerPC/JitArm64/Jit.cpp | 7 +++++-- Source/Core/Core/PowerPC/JitArm64/Jit.h | 1 + .../Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp | 12 ++++++++++++ .../Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp index d615248083..e19343393a 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp @@ -405,6 +405,7 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitB js.assumeNoPairedQuantize = false; js.blockStart = em_address; js.fifoBytesThisBlock = 0; + js.mustCheckFifo = false; js.downcountAmount = 0; js.skipInstructions = 0; js.curBlock = b; @@ -491,9 +492,11 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitB bool gatherPipeIntCheck = jit->js.fifoWriteAddresses.find(ops[i].address) != jit->js.fifoWriteAddresses.end(); - if (jo.optimizeGatherPipe && js.fifoBytesThisBlock >= 32) + if (jo.optimizeGatherPipe && (js.fifoBytesThisBlock >= 32 || js.mustCheckFifo)) { - js.fifoBytesThisBlock -= 32; + if (js.fifoBytesThisBlock >= 32) + js.fifoBytesThisBlock -= 32; + js.mustCheckFifo = false; gpr.Lock(W30); BitSet32 regs_in_use = gpr.GetCallerSavedUsed(); diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.h b/Source/Core/Core/PowerPC/JitArm64/Jit.h index 00181d916d..c2832ff460 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.h +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.h @@ -116,6 +116,7 @@ public: void dcbx(UGeckoInstruction inst); void dcbt(UGeckoInstruction inst); void dcbz(UGeckoInstruction inst); + void eieio(UGeckoInstruction inst); // LoadStore floating point void lfXX(UGeckoInstruction inst); diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp index 1876ff454e..34a8638024 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp @@ -853,3 +853,15 @@ void JitArm64::dcbz(UGeckoInstruction inst) gpr.Unlock(W0); } + +void JitArm64::eieio(UGeckoInstruction inst) +{ + INSTRUCTION_START + JITDISABLE(bJITLoadStoreOff); + + // optimizeGatherPipe generally postpones FIFO checks to the end of the JIT block, + // which is generally safe. However postponing FIFO writes across eieio instructions + // is incorrect (would crash NBA2K11 strap screen if we improve our FIFO detection). + if (jo.optimizeGatherPipe && js.fifoBytesThisBlock > 0) + js.mustCheckFifo = true; +} diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp index 18d05b4abf..723cf91aa6 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp @@ -314,7 +314,7 @@ static GekkoOPTemplate table31[] = { // Unused instructions on GC {310, &JitArm64::FallBackToInterpreter}, // eciwx {438, &JitArm64::FallBackToInterpreter}, // ecowx - {854, &JitArm64::DoNothing}, // eieio + {854, &JitArm64::eieio}, // eieio {306, &JitArm64::FallBackToInterpreter}, // tlbie {566, &JitArm64::DoNothing}, // tlbsync };