From 7cecb28bdf6443362a6ab20e0042ddb3b407ebec Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 12 Feb 2023 11:07:11 +0100 Subject: DolphinQt: Properly lock CPU before accessing emulated memory This fixes a problem I was having where using frame advance with the debugger open would frequently cause panic alerts about invalid addresses due to the CPU thread changing MSR.DR while the host thread was trying to access memory. To aid in tracking down all the places where we weren't properly locking the CPU, I've created a new type (in Core.h) that you have to pass as a reference or pointer to functions that require running as the CPU thread. --- Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp') diff --git a/Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp b/Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp index bb2fc03c1b..a3d1ddec26 100644 --- a/Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp +++ b/Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp @@ -483,7 +483,11 @@ void CodeDiffDialog::OnSetBLR() Common::Symbol* symbol = g_symbolDB.GetSymbolFromAddr(item->data(Qt::UserRole).toUInt()); if (!symbol) return; - PowerPC::debug_interface.SetPatch(symbol->address, 0x4E800020); + + { + Core::CPUThreadGuard guard; + PowerPC::debug_interface.SetPatch(guard, symbol->address, 0x4E800020); + } int row = item->row(); m_matching_results_table->item(row, 0)->setForeground(QBrush(Qt::red)); -- cgit v1.2.3