From 0bb5c88a220234f9cfdd3054a7d1b7352f06d673 Mon Sep 17 00:00:00 2001 From: MikeIsAStar <99037623+MikeIsAStar@users.noreply.github.com> Date: Tue, 15 Aug 2023 12:40:30 -0400 Subject: [PATCH] Retrieve page table information from the data cache Thanks to @mkwcat for identifying the problematic code. --- Source/Core/Core/PowerPC/MMU.cpp | 10 +++++----- Source/Core/Core/PowerPC/MMU.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/PowerPC/MMU.cpp b/Source/Core/Core/PowerPC/MMU.cpp index a1597b96a5..9ce95211ce 100644 --- a/Source/Core/Core/PowerPC/MMU.cpp +++ b/Source/Core/Core/PowerPC/MMU.cpp @@ -1387,8 +1387,8 @@ void MMU::InvalidateTLBEntry(u32 address) } // Page Address Translation -MMU::TranslateAddressResult MMU::TranslatePageAddress(const EffectiveAddress address, - const XCheckTLBFlag flag, bool* wi) +template +MMU::TranslateAddressResult MMU::TranslatePageAddress(const EffectiveAddress address, bool* wi) { // TLB cache // This catches 99%+ of lookups in practice, so the actual page table entry code below doesn't @@ -1441,11 +1441,11 @@ MMU::TranslateAddressResult MMU::TranslatePageAddress(const EffectiveAddress add for (int i = 0; i < 8; i++, pteg_addr += 8) { - const u32 pteg = m_memory.Read_U32(pteg_addr); + const u32 pteg = ReadFromHardware(pteg_addr); if (pte1.Hex == pteg) { - UPTE_Hi pte2(m_memory.Read_U32(pteg_addr + 4)); + UPTE_Hi pte2(ReadFromHardware(pteg_addr + 4)); // set the access bits switch (flag) @@ -1643,7 +1643,7 @@ MMU::TranslateAddressResult MMU::TranslateAddress(u32 address) if (TranslateBatAddress(IsOpcodeFlag(flag) ? m_ibat_table : m_dbat_table, &address, &wi)) return TranslateAddressResult{TranslateAddressResultEnum::BAT_TRANSLATED, address, wi}; - return TranslatePageAddress(EffectiveAddress{address}, flag, &wi); + return TranslatePageAddress(EffectiveAddress{address}, &wi); } std::optional MMU::GetTranslatedAddress(u32 address) diff --git a/Source/Core/Core/PowerPC/MMU.h b/Source/Core/Core/PowerPC/MMU.h index 2ee0173eb5..eb8981d0d9 100644 --- a/Source/Core/Core/PowerPC/MMU.h +++ b/Source/Core/Core/PowerPC/MMU.h @@ -292,8 +292,8 @@ private: template TranslateAddressResult TranslateAddress(u32 address); - TranslateAddressResult TranslatePageAddress(const EffectiveAddress address, - const XCheckTLBFlag flag, bool* wi); + template + TranslateAddressResult TranslatePageAddress(const EffectiveAddress address, bool* wi); void GenerateDSIException(u32 effective_address, bool write); void GenerateISIException(u32 effective_address);