1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2025-01-31 12:31:45 +01:00

Add conditional reservation update to STW

This commit is contained in:
isJuhn 2018-06-23 18:44:47 +02:00 committed by Ivan
parent acd83673e9
commit 83f096c435
3 changed files with 22 additions and 2 deletions

View File

@ -4405,7 +4405,15 @@ bool ppu_interpreter::LBZU(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STW(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + op.simm16 : op.simm16;
vm::write32(vm::cast(addr, HERE), (u32)ppu.gpr[op.rs]);
const u32 value = (u32)ppu.gpr[op.rs];
vm::write32(vm::cast(addr, HERE), value);
//Insomniac engine v3 & v4 (newer R&C, Fuse, Resitance 3)
if (UNLIKELY(value == 0xAAAAAAAA))
{
vm::reservation_update(addr, 128);
}
return true;
}

View File

@ -1309,6 +1309,7 @@ extern void ppu_initialize(const ppu_module& info)
{ "__lvrx", s_use_ssse3 ? (u64)&sse_cellbe_lvrx : (u64)&sse_cellbe_lvrx_v0 },
{ "__stvlx", s_use_ssse3 ? (u64)&sse_cellbe_stvlx : (u64)&sse_cellbe_stvlx_v0 },
{ "__stvrx", s_use_ssse3 ? (u64)&sse_cellbe_stvrx : (u64)&sse_cellbe_stvrx_v0 },
{ "__resupdate", (u64)&vm::reservation_update },
};
for (u64 index = 0; index < 1024; index++)

View File

@ -3407,7 +3407,18 @@ void PPUTranslator::STW(ppu_opcode_t op)
m_rel = nullptr;
}
WriteMemory(op.ra ? m_ir->CreateAdd(GetGpr(op.ra), imm) : imm, GetGpr(op.rs, 32));
const auto value = GetGpr(op.rs, 32);
const auto addr = op.ra ? m_ir->CreateAdd(GetGpr(op.ra), imm) : imm;
WriteMemory(addr, value);
//Insomniac engine v3 & v4 (newer R&C, Fuse, Resitance 3)
if (auto ci = llvm::dyn_cast<ConstantInt>(value))
{
if (ci->getZExtValue() == 0xAAAAAAAA)
{
Call(GetType<void>(), "__resupdate", m_thread, addr, m_ir->getInt32(128));
}
}
}
void PPUTranslator::STWU(ppu_opcode_t op)