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