diff --git a/Source/Core/Core/HW/GPFifo.cpp b/Source/Core/Core/HW/GPFifo.cpp index f786af6eac..d21f698c02 100644 --- a/Source/Core/Core/HW/GPFifo.cpp +++ b/Source/Core/Core/HW/GPFifo.cpp @@ -53,6 +53,7 @@ void DoState(PointerWrap& p) void Init() { ResetGatherPipe(); + PowerPC::ppcState.gather_pipe_base_ptr = s_gather_pipe; memset(s_gather_pipe, 0, sizeof(s_gather_pipe)); } @@ -66,7 +67,7 @@ void ResetGatherPipe() SetGatherPipeCount(0); } -static void UpdateGatherPipe() +void UpdateGatherPipe() { size_t pipe_count = GetGatherPipeCount(); size_t processed; diff --git a/Source/Core/Core/HW/GPFifo.h b/Source/Core/Core/HW/GPFifo.h index 6fb331ef37..d5779d73ea 100644 --- a/Source/Core/Core/HW/GPFifo.h +++ b/Source/Core/Core/HW/GPFifo.h @@ -21,6 +21,7 @@ void DoState(PointerWrap& p); // ResetGatherPipe void ResetGatherPipe(); +void UpdateGatherPipe(); void CheckGatherPipe(); void FastCheckGatherPipe(); diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp index 1a8cd83972..facfe820e5 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp @@ -355,9 +355,14 @@ bool Jit64::Cleanup() if (jo.optimizeGatherPipe && js.fifoBytesSinceCheck > 0) { + MOV(64, R(RSCRATCH), PPCSTATE(gather_pipe_ptr)); + SUB(64, R(RSCRATCH), PPCSTATE(gather_pipe_base_ptr)); + CMP(64, R(RSCRATCH), Imm32(GPFifo::GATHER_PIPE_SIZE)); + FixupBranch exit = J_CC(CC_L); ABI_PushRegistersAndAdjustStack({}, 0); - ABI_CallFunction(GPFifo::FastCheckGatherPipe); + ABI_CallFunction(GPFifo::UpdateGatherPipe); ABI_PopRegistersAndAdjustStack({}, 0); + SetJumpTarget(exit); did_something = true; } diff --git a/Source/Core/Core/PowerPC/PowerPC.h b/Source/Core/Core/PowerPC/PowerPC.h index 81248fb27e..2b3fe8a98e 100644 --- a/Source/Core/Core/PowerPC/PowerPC.h +++ b/Source/Core/Core/PowerPC/PowerPC.h @@ -95,6 +95,7 @@ struct PowerPCState // gather pipe pointer for JIT access u8* gather_pipe_ptr; + u8* gather_pipe_base_ptr; #if _M_X86_64 // This member exists for the purpose of an assertion in x86 JitBase.cpp