From 980f1641b5e7cb2c7fdd418b6de62c61a8ed1e65 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 4 Apr 2018 18:40:05 -0400 Subject: [PATCH] Interpreter_LoadStore: Generate alignment exceptions if dcbz or dcbz_l are executed with the data cache disabled This is an exception condition documented within section 4.5.6 in the architecture reference manual for the PPC 750CL, which also applies to the Gekko microprocessor. Also moves dcbz_l's implementation out of Interpreter_Paired and beside dcbz where it belongs. --- .../Interpreter/Interpreter_LoadStore.cpp | 21 +++++++++++++++++++ .../Interpreter/Interpreter_Paired.cpp | 9 -------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp index 4ada0b3c3c..3feaa7b0d9 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp @@ -421,6 +421,13 @@ void Interpreter::dcbz(UGeckoInstruction inst) return; const u32 dcbz_addr = Helper_Get_EA_X(inst); + + if (!HID0.DCE) + { + GenerateAlignmentException(dcbz_addr); + return; + } + // Hack to stop dcbz/dcbi over low MEM1 trashing memory. if (SConfig::GetInstance().bLowDCBZHack && (dcbz_addr < 0x80008000) && (dcbz_addr >= 0x80000000)) return; @@ -429,6 +436,20 @@ void Interpreter::dcbz(UGeckoInstruction inst) PowerPC::ClearCacheLine(dcbz_addr & (~31)); } +void Interpreter::dcbz_l(UGeckoInstruction inst) +{ + const u32 address = Helper_Get_EA_X(inst); + + if (!HID0.DCE) + { + GenerateAlignmentException(address); + return; + } + + // FAKE: clear memory instead of clearing the cache block + PowerPC::ClearCacheLine(address & (~31)); +} + // eciwx/ecowx technically should access the specified device // We just do it instantly from ppc...and hey, it works! :D void Interpreter::eciwx(UGeckoInstruction inst) diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp index 6edc5f4c1d..38df41895a 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp @@ -331,12 +331,3 @@ void Interpreter::ps_cmpo1(UGeckoInstruction inst) { Helper_FloatCompareOrdered(inst, rPS1(inst.FA), rPS1(inst.FB)); } - -// __________________________________________________________________________________________________ -// dcbz_l -// TODO(ector) check docs -void Interpreter::dcbz_l(UGeckoInstruction inst) -{ - // FAKE: clear memory instead of clearing the cache block - PowerPC::ClearCacheLine(Helper_Get_EA_X(inst) & (~31)); -}