From 8c643693a99ae1dd2f12f8cafb5c890648ddd77e Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 20 Jun 2025 10:41:00 +0200 Subject: [PATCH 1/2] PowerPC: Add missing SDRUpdated/MSRUpdated calls --- Source/Core/Core/PowerPC/Expression.cpp | 11 +++++++++++ Source/Core/Core/PowerPC/GDBStub.cpp | 1 + 2 files changed, 12 insertions(+) diff --git a/Source/Core/Core/PowerPC/Expression.cpp b/Source/Core/Core/PowerPC/Expression.cpp index d522b7d522..bd97e8a8b1 100644 --- a/Source/Core/Core/PowerPC/Expression.cpp +++ b/Source/Core/Core/PowerPC/Expression.cpp @@ -447,9 +447,15 @@ void Expression::SynchronizeBindings(Core::System& system, SynchronizeDirection break; case VarBindingType::SPR: if (dir == SynchronizeDirection::From) + { v->value = static_cast(ppc_state.spr[bind->index]); + } else + { ppc_state.spr[bind->index] = static_cast(static_cast(v->value)); + if (bind->index == SPR_SDR) + system.GetMMU().SDRUpdated(); + } break; case VarBindingType::PCtr: if (dir == SynchronizeDirection::From) @@ -457,9 +463,14 @@ void Expression::SynchronizeBindings(Core::System& system, SynchronizeDirection break; case VarBindingType::MSR: if (dir == SynchronizeDirection::From) + { v->value = static_cast(ppc_state.msr.Hex); + } else + { ppc_state.msr.Hex = static_cast(static_cast(v->value)); + PowerPC::MSRUpdated(ppc_state); + } break; } } diff --git a/Source/Core/Core/PowerPC/GDBStub.cpp b/Source/Core/Core/PowerPC/GDBStub.cpp index a339ad251a..5074629faa 100644 --- a/Source/Core/Core/PowerPC/GDBStub.cpp +++ b/Source/Core/Core/PowerPC/GDBStub.cpp @@ -684,6 +684,7 @@ static void WriteRegister() break; case 104: ppc_state.spr[SPR_SDR] = re32hex(bufptr); + system.GetMMU().SDRUpdated(); break; case 105: ppc_state.spr[SPR_ASR] = re64hex(bufptr); From e002fcdf2fa1c14ebce61055325f7ff27e55711e Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 20 Jun 2025 10:42:10 +0200 Subject: [PATCH 2/2] PowerPC: Use SPR_LR constant in an additional location --- Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp index 63c68a6dc3..b9d0333249 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp @@ -102,7 +102,7 @@ void Interpreter::Trace(const UGeckoInstruction& inst) "INTER PC: {:08x} SRR0: {:08x} SRR1: {:08x} CRval: {:016x} " "FPSCR: {:08x} MSR: {:08x} LR: {:08x} {} {:08x} {}", m_ppc_state.pc, SRR0(m_ppc_state), SRR1(m_ppc_state), m_ppc_state.cr.fields[0], - m_ppc_state.fpscr.Hex, m_ppc_state.msr.Hex, m_ppc_state.spr[8], regs, inst.hex, + m_ppc_state.fpscr.Hex, m_ppc_state.msr.Hex, m_ppc_state.spr[SPR_LR], regs, inst.hex, ppc_inst); }