From 954e3f6e6c43fb61a85caa4261c21953afbbc35b Mon Sep 17 00:00:00 2001 From: Eladash Date: Wed, 29 Apr 2020 05:24:28 +0300 Subject: [PATCH] Fixup for cpu_flag::pause state check after #8114 --- rpcs3/Emu/Cell/PPUThread.cpp | 2 ++ rpcs3/Emu/Cell/SPUThread.cpp | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 10602981c8..1933387e65 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -1041,7 +1041,9 @@ static T ppu_load_acquire_reservation(ppu_thread& ppu, u32 addr) } else { + ppu.state += cpu_flag::wait; std::this_thread::yield(); + ppu.check_state(); } }()) { diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index 42fac63ff4..88277c6594 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -1777,6 +1777,11 @@ bool spu_thread::process_mfc_cmd() // Spinning, might as well yield cpu resources std::this_thread::yield(); + + if (test_stopped()) + { + return false; + } } auto& dst = _ref(ch_mfc_cmd.lsa & 0x3ff80); @@ -1784,7 +1789,7 @@ bool spu_thread::process_mfc_cmd() for (u64 i = 0;; [&]() { - if (is_paused()) + if (state & cpu_flag::pause) { check_state(); } @@ -1795,7 +1800,16 @@ bool spu_thread::process_mfc_cmd() } else { + if (g_use_rtm) + { + state += cpu_flag::wait; + } + std::this_thread::yield(); + + if (test_stopped()) + { + } } }()) { @@ -1826,11 +1840,6 @@ bool spu_thread::process_mfc_cmd() break; } - if (test_stopped()) - { - return false; - } - if (raddr && raddr != addr) { // Last check for event before we replace the reservation with a new one