CPU/Recompiler: Fix PGXP values getting corrupted if cached in caller-saved reg

This commit is contained in:
Connor McLaughlin 2020-11-13 21:46:17 +10:00
parent 3f937a2a39
commit e1579584ef
1 changed files with 6 additions and 3 deletions

View File

@ -1324,13 +1324,14 @@ bool CodeGenerator::Compile_Store(const CodeBlockInstruction& cbi)
{ {
case InstructionOp::sb: case InstructionOp::sb:
{ {
EmitStoreGuestMemory(cbi, address, address_spec, value.ViewAsSize(RegSize_8));
if (g_settings.gpu_pgxp_enable) if (g_settings.gpu_pgxp_enable)
{ {
EmitFunctionCall(nullptr, PGXP::CPU_SB, Value::FromConstantU32(cbi.instruction.bits), EmitFunctionCall(nullptr, PGXP::CPU_SB, Value::FromConstantU32(cbi.instruction.bits),
value.ViewAsSize(RegSize_8), address); value.ViewAsSize(RegSize_8), address);
} }
EmitStoreGuestMemory(cbi, address, address_spec, value.ViewAsSize(RegSize_8));
if (address_spec) if (address_spec)
{ {
const VirtualMemoryAddress aligned_addr = (*address_spec & ~3u); const VirtualMemoryAddress aligned_addr = (*address_spec & ~3u);
@ -1354,13 +1355,14 @@ bool CodeGenerator::Compile_Store(const CodeBlockInstruction& cbi)
case InstructionOp::sh: case InstructionOp::sh:
{ {
EmitStoreGuestMemory(cbi, address, address_spec, value.ViewAsSize(RegSize_16));
if (g_settings.gpu_pgxp_enable) if (g_settings.gpu_pgxp_enable)
{ {
EmitFunctionCall(nullptr, PGXP::CPU_SH, Value::FromConstantU32(cbi.instruction.bits), EmitFunctionCall(nullptr, PGXP::CPU_SH, Value::FromConstantU32(cbi.instruction.bits),
value.ViewAsSize(RegSize_16), address); value.ViewAsSize(RegSize_16), address);
} }
EmitStoreGuestMemory(cbi, address, address_spec, value.ViewAsSize(RegSize_16));
if (address_spec) if (address_spec)
{ {
const VirtualMemoryAddress aligned_addr = (*address_spec & ~3u); const VirtualMemoryAddress aligned_addr = (*address_spec & ~3u);
@ -1384,10 +1386,11 @@ bool CodeGenerator::Compile_Store(const CodeBlockInstruction& cbi)
case InstructionOp::sw: case InstructionOp::sw:
{ {
EmitStoreGuestMemory(cbi, address, address_spec, value);
if (g_settings.gpu_pgxp_enable) if (g_settings.gpu_pgxp_enable)
EmitFunctionCall(nullptr, PGXP::CPU_SW, Value::FromConstantU32(cbi.instruction.bits), value, address); EmitFunctionCall(nullptr, PGXP::CPU_SW, Value::FromConstantU32(cbi.instruction.bits), value, address);
EmitStoreGuestMemory(cbi, address, address_spec, value);
if (address_spec) if (address_spec)
SpeculativeWriteMemory(*address_spec, value_spec); SpeculativeWriteMemory(*address_spec, value_spec);
} }