PowerPC/PPCCache: Access PowerPCState through System.

This commit is contained in:
Admiral H. Curtiss 2023-03-28 21:48:22 +02:00
parent aec3a882d7
commit 6018daa3fa
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
1 changed files with 8 additions and 6 deletions

View File

@ -392,19 +392,21 @@ void Cache::DoState(PointerWrap& p)
u32 InstructionCache::ReadInstruction(u32 addr)
{
auto& system = Core::System::GetInstance();
auto& memory = system.GetMemory();
auto& ppc_state = system.GetPPCState();
if (!HID0(PowerPC::ppcState).ICE || m_disable_icache) // instruction cache is disabled
return memory.Read_U32(addr);
if (!HID0(ppc_state).ICE || m_disable_icache) // instruction cache is disabled
return system.GetMemory().Read_U32(addr);
u32 value;
Read(addr, &value, sizeof(value), HID0(PowerPC::ppcState).ILOCK);
Read(addr, &value, sizeof(value), HID0(ppc_state).ILOCK);
return Common::swap32(value);
}
void InstructionCache::Invalidate(u32 addr)
{
if (!HID0(PowerPC::ppcState).ICE || m_disable_icache)
auto& system = Core::System::GetInstance();
auto& ppc_state = system.GetPPCState();
if (!HID0(ppc_state).ICE || m_disable_icache)
return;
// Invalidates the whole set
@ -424,7 +426,7 @@ void InstructionCache::Invalidate(u32 addr)
valid[set] = 0;
modified[set] = 0;
Core::System::GetInstance().GetJitInterface().InvalidateICacheLine(addr);
system.GetJitInterface().InvalidateICacheLine(addr);
}
void InstructionCache::RefreshConfig()