diff --git a/Source/Core/Core/HW/GPFifo.cpp b/Source/Core/Core/HW/GPFifo.cpp index 403321fe37..f786af6eac 100644 --- a/Source/Core/Core/HW/GPFifo.cpp +++ b/Source/Core/Core/HW/GPFifo.cpp @@ -13,6 +13,7 @@ #include "Core/HW/Memmap.h" #include "Core/HW/ProcessorInterface.h" #include "Core/PowerPC/JitInterface.h" +#include "Core/PowerPC/PowerPC.h" #include "VideoCommon/CommandProcessor.h" namespace GPFifo @@ -31,17 +32,14 @@ namespace GPFifo // More room for the fastmodes alignas(32) static u8 s_gather_pipe[GATHER_PIPE_SIZE * 16]; -// pipe pointer -u8* g_gather_pipe_ptr = s_gather_pipe; - static size_t GetGatherPipeCount() { - return g_gather_pipe_ptr - s_gather_pipe; + return PowerPC::ppcState.gather_pipe_ptr - s_gather_pipe; } static void SetGatherPipeCount(size_t size) { - g_gather_pipe_ptr = s_gather_pipe + size; + PowerPC::ppcState.gather_pipe_ptr = s_gather_pipe + size; } void DoState(PointerWrap& p) @@ -144,29 +142,29 @@ void Write64(const u64 value) void FastWrite8(const u8 value) { - *g_gather_pipe_ptr = value; - g_gather_pipe_ptr += sizeof(u8); + *PowerPC::ppcState.gather_pipe_ptr = value; + PowerPC::ppcState.gather_pipe_ptr += sizeof(u8); } void FastWrite16(u16 value) { value = Common::swap16(value); - std::memcpy(g_gather_pipe_ptr, &value, sizeof(u16)); - g_gather_pipe_ptr += sizeof(u16); + std::memcpy(PowerPC::ppcState.gather_pipe_ptr, &value, sizeof(u16)); + PowerPC::ppcState.gather_pipe_ptr += sizeof(u16); } void FastWrite32(u32 value) { value = Common::swap32(value); - std::memcpy(g_gather_pipe_ptr, &value, sizeof(u32)); - g_gather_pipe_ptr += sizeof(u32); + std::memcpy(PowerPC::ppcState.gather_pipe_ptr, &value, sizeof(u32)); + PowerPC::ppcState.gather_pipe_ptr += sizeof(u32); } void FastWrite64(u64 value) { value = Common::swap64(value); - std::memcpy(g_gather_pipe_ptr, &value, sizeof(u64)); - g_gather_pipe_ptr += sizeof(u64); + std::memcpy(PowerPC::ppcState.gather_pipe_ptr, &value, sizeof(u64)); + PowerPC::ppcState.gather_pipe_ptr += sizeof(u64); } } // end of namespace GPFifo diff --git a/Source/Core/Core/HW/GPFifo.h b/Source/Core/Core/HW/GPFifo.h index eb37c589b9..6fb331ef37 100644 --- a/Source/Core/Core/HW/GPFifo.h +++ b/Source/Core/Core/HW/GPFifo.h @@ -15,9 +15,6 @@ enum GATHER_PIPE_SIZE = 32 }; -// pipe pointer for JIT access -extern u8* g_gather_pipe_ptr; - // Init void Init(); void DoState(PointerWrap& p); diff --git a/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp b/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp index 1d8ce07be4..fb9e5f3433 100644 --- a/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp +++ b/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp @@ -12,7 +12,6 @@ #include "Common/MathUtil.h" #include "Common/x64ABI.h" #include "Common/x64Emitter.h" -#include "Core/HW/GPFifo.h" #include "Core/PowerPC/Gekko.h" #include "Core/PowerPC/Jit64Common/Jit64Base.h" #include "Core/PowerPC/Jit64Common/Jit64PowerPCState.h" @@ -30,10 +29,10 @@ void CommonAsmRoutines::GenFifoWrite(int size) const void* start = GetCodePtr(); // Assume value in RSCRATCH - MOV(64, R(RSCRATCH2), ImmPtr(&GPFifo::g_gather_pipe_ptr)); + MOV(64, R(RSCRATCH2), ImmPtr(&PowerPC::ppcState.gather_pipe_ptr)); MOV(64, R(RSCRATCH2), MatR(RSCRATCH2)); SwapAndStore(size, MatR(RSCRATCH2), RSCRATCH); - MOV(64, R(RSCRATCH), ImmPtr(&GPFifo::g_gather_pipe_ptr)); + MOV(64, R(RSCRATCH), ImmPtr(&PowerPC::ppcState.gather_pipe_ptr)); ADD(64, R(RSCRATCH2), Imm8(size >> 3)); MOV(64, MatR(RSCRATCH), R(RSCRATCH2)); RET(); diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp index b4e057753e..96b03340f8 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp @@ -10,7 +10,6 @@ #include "Core/Core.h" #include "Core/CoreTiming.h" #include "Core/HW/DSP.h" -#include "Core/HW/GPFifo.h" #include "Core/HW/MMIO.h" #include "Core/HW/Memmap.h" #include "Core/PowerPC/JitArm64/Jit.h" @@ -242,7 +241,7 @@ void JitArm64::SafeStoreFromReg(s32 dest, u32 value, s32 regOffset, u32 flags, s if (accessSize != 8) WA = gpr.GetReg(); - MOVP2R(X1, &GPFifo::g_gather_pipe_ptr); + MOVP2R(X1, &PowerPC::ppcState.gather_pipe_ptr); LDR(INDEX_UNSIGNED, X0, X1, 0); if (accessSize == 32) { diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStoreFloating.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStoreFloating.cpp index e90f5f6f9c..12b8c43afc 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStoreFloating.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStoreFloating.cpp @@ -10,7 +10,6 @@ #include "Core/Core.h" #include "Core/CoreTiming.h" -#include "Core/HW/GPFifo.h" #include "Core/PowerPC/JitArm64/Jit.h" #include "Core/PowerPC/JitArm64/JitArm64_RegCache.h" #include "Core/PowerPC/PPCTables.h" @@ -357,7 +356,7 @@ void JitArm64::stfXX(UGeckoInstruction inst) else accessSize = 32; - MOVP2R(X1, &GPFifo::g_gather_pipe_ptr); + MOVP2R(X1, &PowerPC::ppcState.gather_pipe_ptr); LDR(INDEX_UNSIGNED, X0, X1, 0); if (flags & BackPatchInfo::FLAG_SIZE_F64) { diff --git a/Source/Core/Core/PowerPC/PowerPC.h b/Source/Core/Core/PowerPC/PowerPC.h index 9e53c239b9..81248fb27e 100644 --- a/Source/Core/Core/PowerPC/PowerPC.h +++ b/Source/Core/Core/PowerPC/PowerPC.h @@ -93,6 +93,9 @@ struct PowerPCState // lscbx u16 xer_stringctrl; + // gather pipe pointer for JIT access + u8* gather_pipe_ptr; + #if _M_X86_64 // This member exists for the purpose of an assertion in x86 JitBase.cpp // that its offset <= 0x100. To minimize code size on x86, we want as much