PowerPC/JitInterface: Access PowerPCState through System.

This commit is contained in:
Admiral H. Curtiss 2023-03-28 21:47:38 +02:00
parent 18f8ae37ab
commit aec3a882d7
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
1 changed files with 10 additions and 10 deletions

View File

@ -163,14 +163,13 @@ JitInterface::GetHostCode(u32 address) const
return GetHostCodeError::NoJitActive;
}
JitBlock* block =
m_jit->GetBlockCache()->GetBlockFromStartAddress(address, PowerPC::ppcState.msr.Hex);
auto& ppc_state = m_system.GetPPCState();
JitBlock* block = m_jit->GetBlockCache()->GetBlockFromStartAddress(address, ppc_state.msr.Hex);
if (!block)
{
for (int i = 0; i < 500; i++)
{
block = m_jit->GetBlockCache()->GetBlockFromStartAddress(address - 4 * i,
PowerPC::ppcState.msr.Hex);
block = m_jit->GetBlockCache()->GetBlockFromStartAddress(address - 4 * i, ppc_state.msr.Hex);
if (block)
break;
}
@ -287,25 +286,26 @@ void JitInterface::CompileExceptionCheck(ExceptionType type)
break;
}
if (PowerPC::ppcState.pc != 0 &&
(exception_addresses->find(PowerPC::ppcState.pc)) == (exception_addresses->end()))
auto& ppc_state = m_system.GetPPCState();
if (ppc_state.pc != 0 &&
(exception_addresses->find(ppc_state.pc)) == (exception_addresses->end()))
{
if (type == ExceptionType::FIFOWrite)
{
ASSERT(Core::IsCPUThread());
Core::CPUThreadGuard guard(Core::System::GetInstance());
Core::CPUThreadGuard guard(m_system);
// Check in case the code has been replaced since: do we need to do this?
const OpType optype =
PPCTables::GetOpInfo(PowerPC::MMU::HostRead_U32(guard, PowerPC::ppcState.pc))->type;
PPCTables::GetOpInfo(PowerPC::MMU::HostRead_U32(guard, ppc_state.pc))->type;
if (optype != OpType::Store && optype != OpType::StoreFP && optype != OpType::StorePS)
return;
}
exception_addresses->insert(PowerPC::ppcState.pc);
exception_addresses->insert(ppc_state.pc);
// Invalidate the JIT block so that it gets recompiled with the external exception check
// included.
m_jit->GetBlockCache()->InvalidateICache(PowerPC::ppcState.pc, 4, true);
m_jit->GetBlockCache()->InvalidateICache(ppc_state.pc, 4, true);
}
}