PowerPC: Parametrize HID0 macro.
This commit is contained in:
parent
f056cec859
commit
49eeb986c6
|
@ -76,18 +76,18 @@ void CBoot::SetupMSR()
|
|||
void CBoot::SetupHID(bool is_wii)
|
||||
{
|
||||
// HID0 is 0x0011c464 on GC, 0x0011c664 on Wii
|
||||
HID0.BHT = 1;
|
||||
HID0.BTIC = 1;
|
||||
HID0.DCFA = 1;
|
||||
HID0(PowerPC::ppcState).BHT = 1;
|
||||
HID0(PowerPC::ppcState).BTIC = 1;
|
||||
HID0(PowerPC::ppcState).DCFA = 1;
|
||||
if (is_wii)
|
||||
HID0.SPD = 1;
|
||||
HID0.DCFI = 1;
|
||||
HID0.DCE = 1;
|
||||
HID0(PowerPC::ppcState).SPD = 1;
|
||||
HID0(PowerPC::ppcState).DCFI = 1;
|
||||
HID0(PowerPC::ppcState).DCE = 1;
|
||||
// Note that Datel titles will fail to boot if the instruction cache is not enabled; see
|
||||
// https://bugs.dolphin-emu.org/issues/8223
|
||||
HID0.ICE = 1;
|
||||
HID0.NHR = 1;
|
||||
HID0.DPM = 1;
|
||||
HID0(PowerPC::ppcState).ICE = 1;
|
||||
HID0(PowerPC::ppcState).NHR = 1;
|
||||
HID0(PowerPC::ppcState).DPM = 1;
|
||||
|
||||
// HID1 is initialized in PowerPC.cpp to 0x80000000
|
||||
// HID2 is 0xe0000000
|
||||
|
|
|
@ -503,7 +503,7 @@ void Interpreter::dcbz(UGeckoInstruction inst)
|
|||
{
|
||||
const u32 dcbz_addr = Helper_Get_EA_X(PowerPC::ppcState, inst);
|
||||
|
||||
if (!HID0.DCE)
|
||||
if (!HID0(PowerPC::ppcState).DCE)
|
||||
{
|
||||
GenerateAlignmentException(dcbz_addr);
|
||||
return;
|
||||
|
@ -533,7 +533,7 @@ void Interpreter::dcbz_l(UGeckoInstruction inst)
|
|||
|
||||
const u32 address = Helper_Get_EA_X(PowerPC::ppcState, inst);
|
||||
|
||||
if (!HID0.DCE)
|
||||
if (!HID0(PowerPC::ppcState).DCE)
|
||||
{
|
||||
GenerateAlignmentException(address);
|
||||
return;
|
||||
|
|
|
@ -325,18 +325,20 @@ void Interpreter::mtspr(UGeckoInstruction inst)
|
|||
{
|
||||
UReg_HID0 old_hid0;
|
||||
old_hid0.Hex = old_value;
|
||||
if (HID0.ICE != old_hid0.ICE)
|
||||
if (HID0(PowerPC::ppcState).ICE != old_hid0.ICE)
|
||||
{
|
||||
INFO_LOG_FMT(POWERPC, "Instruction Cache Enable (HID0.ICE) = {}", HID0.ICE);
|
||||
INFO_LOG_FMT(POWERPC, "Instruction Cache Enable (HID0.ICE) = {}",
|
||||
HID0(PowerPC::ppcState).ICE);
|
||||
}
|
||||
if (HID0.ILOCK != old_hid0.ILOCK)
|
||||
if (HID0(PowerPC::ppcState).ILOCK != old_hid0.ILOCK)
|
||||
{
|
||||
INFO_LOG_FMT(POWERPC, "Instruction Cache Lock (HID0.ILOCK) = {}", HID0.ILOCK);
|
||||
INFO_LOG_FMT(POWERPC, "Instruction Cache Lock (HID0.ILOCK) = {}",
|
||||
HID0(PowerPC::ppcState).ILOCK);
|
||||
}
|
||||
if (HID0.ICFI)
|
||||
if (HID0(PowerPC::ppcState).ICFI)
|
||||
{
|
||||
HID0.ICFI = 0;
|
||||
INFO_LOG_FMT(POWERPC, "Flush Instruction Cache! ICE={}", HID0.ICE);
|
||||
HID0(PowerPC::ppcState).ICFI = 0;
|
||||
INFO_LOG_FMT(POWERPC, "Flush Instruction Cache! ICE={}", HID0(PowerPC::ppcState).ICE);
|
||||
// this is rather slow
|
||||
// most games do it only once during initialization
|
||||
PowerPC::ppcState.iCache.Reset();
|
||||
|
|
|
@ -235,7 +235,7 @@ static T ReadFromHardware(Memory::MemoryManager& memory, u32 em_address)
|
|||
else
|
||||
{
|
||||
ppcState.dCache.Read(em_address, &value, sizeof(T),
|
||||
HID0.DLOCK || flag != XCheckTLBFlag::Read);
|
||||
HID0(PowerPC::ppcState).DLOCK || flag != XCheckTLBFlag::Read);
|
||||
}
|
||||
|
||||
return bswap(value);
|
||||
|
@ -254,7 +254,7 @@ static T ReadFromHardware(Memory::MemoryManager& memory, u32 em_address)
|
|||
else
|
||||
{
|
||||
ppcState.dCache.Read(em_address + 0x10000000, &value, sizeof(T),
|
||||
HID0.DLOCK || flag != XCheckTLBFlag::Read);
|
||||
HID0(PowerPC::ppcState).DLOCK || flag != XCheckTLBFlag::Read);
|
||||
}
|
||||
|
||||
return bswap(value);
|
||||
|
@ -425,7 +425,7 @@ static void WriteToHardware(Core::System& system, Memory::MemoryManager& memory,
|
|||
em_address &= memory.GetRamMask();
|
||||
|
||||
if (ppcState.m_enable_dcache && !wi)
|
||||
ppcState.dCache.Write(em_address, &swapped_data, size, HID0.DLOCK);
|
||||
ppcState.dCache.Write(em_address, &swapped_data, size, HID0(PowerPC::ppcState).DLOCK);
|
||||
|
||||
if (!ppcState.m_enable_dcache || wi || flag != XCheckTLBFlag::Write)
|
||||
std::memcpy(&memory.GetRAM()[em_address], &swapped_data, size);
|
||||
|
@ -439,7 +439,10 @@ static void WriteToHardware(Core::System& system, Memory::MemoryManager& memory,
|
|||
em_address &= 0x0FFFFFFF;
|
||||
|
||||
if (ppcState.m_enable_dcache && !wi)
|
||||
ppcState.dCache.Write(em_address + 0x10000000, &swapped_data, size, HID0.DLOCK);
|
||||
{
|
||||
ppcState.dCache.Write(em_address + 0x10000000, &swapped_data, size,
|
||||
HID0(PowerPC::ppcState).DLOCK);
|
||||
}
|
||||
|
||||
if (!ppcState.m_enable_dcache || wi || flag != XCheckTLBFlag::Write)
|
||||
std::memcpy(&memory.GetEXRAM()[em_address], &swapped_data, size);
|
||||
|
|
|
@ -394,17 +394,17 @@ u32 InstructionCache::ReadInstruction(u32 addr)
|
|||
auto& system = Core::System::GetInstance();
|
||||
auto& memory = system.GetMemory();
|
||||
|
||||
if (!HID0.ICE || m_disable_icache) // instruction cache is disabled
|
||||
if (!HID0(PowerPC::ppcState).ICE || m_disable_icache) // instruction cache is disabled
|
||||
return memory.Read_U32(addr);
|
||||
|
||||
u32 value;
|
||||
Read(addr, &value, sizeof(value), HID0.ILOCK);
|
||||
Read(addr, &value, sizeof(value), HID0(PowerPC::ppcState).ILOCK);
|
||||
return Common::swap32(value);
|
||||
}
|
||||
|
||||
void InstructionCache::Invalidate(u32 addr)
|
||||
{
|
||||
if (!HID0.ICE || m_disable_icache)
|
||||
if (!HID0(PowerPC::ppcState).ICE || m_disable_icache)
|
||||
return;
|
||||
|
||||
// Invalidates the whole set
|
||||
|
|
|
@ -235,7 +235,7 @@ void WriteFullTimeBaseValue(u64 value);
|
|||
void UpdatePerformanceMonitor(u32 cycles, u32 num_load_stores, u32 num_fp_inst);
|
||||
|
||||
// Easy register access macros.
|
||||
#define HID0 ((UReg_HID0&)PowerPC::ppcState.spr[SPR_HID0])
|
||||
#define HID0(ppc_state) ((UReg_HID0&)(ppc_state).spr[SPR_HID0])
|
||||
#define HID2 ((UReg_HID2&)PowerPC::ppcState.spr[SPR_HID2])
|
||||
#define HID4 ((UReg_HID4&)PowerPC::ppcState.spr[SPR_HID4])
|
||||
#define DMAU (*(UReg_DMAU*)&PowerPC::ppcState.spr[SPR_DMAU])
|
||||
|
|
Loading…
Reference in New Issue