PowerPC: Include the gather pipe pointer in the ppc state.

This commit is contained in:
degasus 2017-11-18 14:14:45 +01:00
parent 84ca9a4aec
commit 4feddd7748
6 changed files with 18 additions and 23 deletions

View File

@ -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

View File

@ -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);

View File

@ -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();

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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