PPU: Implement support for 128-byte reservations coherency

This commit is contained in:
Eladash 2020-04-07 20:29:11 +03:00 committed by Ivan
parent 3f7eba19c8
commit f4ca6f02a1
8 changed files with 539 additions and 144 deletions

View file

@ -2527,6 +2527,12 @@ void PPUTranslator::MFOCRF(ppu_opcode_t op)
void PPUTranslator::LWARX(ppu_opcode_t op)
{
if (g_cfg.core.ppu_128_reservations_loop_max_length > 0)
{
// CIA will be used in lwarx handler
m_ir->CreateStore(Trunc(GetAddr(), GetType<u32>()), m_ir->CreateStructGEP(nullptr, m_thread, static_cast<uint>(&m_cia - m_locals)), true);
}
SetGpr(op.rd, Call(GetType<u32>(), "__lwarx", m_thread, op.ra ? m_ir->CreateAdd(GetGpr(op.ra), GetGpr(op.rb)) : GetGpr(op.rb)));
}
@ -2663,6 +2669,12 @@ void PPUTranslator::MULHW(ppu_opcode_t op)
void PPUTranslator::LDARX(ppu_opcode_t op)
{
if (g_cfg.core.ppu_128_reservations_loop_max_length > 0)
{
// CIA will be used in ldarx handler
m_ir->CreateStore(Trunc(GetAddr(), GetType<u32>()), m_ir->CreateStructGEP(nullptr, m_thread, static_cast<uint>(&m_cia - m_locals)), true);
}
SetGpr(op.rd, Call(GetType<u64>(), "__ldarx", m_thread, op.ra ? m_ir->CreateAdd(GetGpr(op.ra), GetGpr(op.rb)) : GetGpr(op.rb)));
}