diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index 10e7efd047..d82bf6fa36 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -910,8 +910,8 @@ bool cpu_thread::suspend_work::push(cpu_thread* _this, bool cancel_if_not_suspen // Extract queue and reverse element order (FILO to FIFO) (TODO: maybe leave order as is?) auto* head = queue.exchange(nullptr); - s8 min_prio = head->prio; - s8 max_prio = head->prio; + u8 min_prio = head->prio; + u8 max_prio = head->prio; if (auto* prev = head->next) { @@ -925,8 +925,8 @@ bool cpu_thread::suspend_work::push(cpu_thread* _this, bool cancel_if_not_suspen head = std::exchange(prev, pre2); // Fill priority range - min_prio = std::min(min_prio, head->prio); - max_prio = std::max(max_prio, head->prio); + min_prio = std::min(min_prio, head->prio); + max_prio = std::max(max_prio, head->prio); } while (prev); } diff --git a/rpcs3/Emu/CPU/CPUThread.h b/rpcs3/Emu/CPU/CPUThread.h index 044021d1cb..bc22457966 100644 --- a/rpcs3/Emu/CPU/CPUThread.h +++ b/rpcs3/Emu/CPU/CPUThread.h @@ -124,7 +124,7 @@ public: struct suspend_work { // Task priority - s8 prio; + u8 prio; // Size of prefetch list workload u32 prf_size; @@ -144,7 +144,7 @@ public: }; // Suspend all threads and execute op (may be executed by other thread than caller!) - template + template static auto suspend_all(cpu_thread* _this, std::initializer_list hints, F op) { if constexpr (std::is_void_v>) @@ -172,7 +172,7 @@ public: } // Push the workload only if threads are being suspended by suspend_all() - template + template static bool if_suspended(cpu_thread* _this, std::initializer_list hints, F op) { static_assert(std::is_void_v>, "Unimplemented (must return void)"); diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 3855d6e831..a1d5a22f63 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -1703,7 +1703,7 @@ static bool ppu_store_reservation(ppu_thread& ppu, u32 addr, u64 reg_value) auto& all_data = *vm::get_super_ptr(addr & -128); auto& sdata = *vm::get_super_ptr>(addr & -8); - const bool ok = cpu_thread::suspend_all<+1>(&ppu, {all_data, all_data + 64, &res}, [&] + const bool ok = cpu_thread::suspend_all<+3>(&ppu, {all_data, all_data + 64, &res}, [&] { if ((res & -128) == rtime && cmp_rdata(ppu.rdata, all_data)) { diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index 1405c20617..7f9224b353 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -2013,7 +2013,7 @@ void spu_thread::do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8* { if (_cpu->state & cpu_flag::pause) { - cpu_thread::if_suspended(_cpu, {dst, dst + 64, &res}, [&] + cpu_thread::if_suspended<0>(_cpu, {dst, dst + 64, &res}, [&] { std::memcpy(dst, src, size0); res += 128; @@ -2545,7 +2545,7 @@ bool spu_thread::do_putllc(const spu_mfc_cmd& args) { auto& data = *vm::get_super_ptr(addr); - const bool ok = cpu_thread::suspend_all<+1>(this, {data, data + 64, &res}, [&]() + const bool ok = cpu_thread::suspend_all<+3>(this, {data, data + 64, &res}, [&]() { if ((res & -128) == rtime) { @@ -2698,7 +2698,7 @@ void do_cell_atomic_128_store(u32 addr, const void* to_write) auto& sdata = *vm::get_super_ptr(addr); auto& res = vm::reservation_acquire(addr, 128); - cpu_thread::suspend_all<0>(cpu, {&res}, [&] + cpu_thread::suspend_all<+2>(cpu, {&res}, [&] { mov_rdata_nt(sdata, *static_cast(to_write)); res += 127; @@ -2958,7 +2958,7 @@ bool spu_thread::process_mfc_cmd() { auto& sdata = *vm::get_super_ptr(addr); - verify(HERE), cpu_thread::if_suspended<-1>(this, {}, [&] + cpu_thread::if_suspended<0>(this, {}, [&] { // Guaranteed success ntime = vm::reservation_acquire(addr, 128); diff --git a/rpcs3/Emu/Memory/vm.cpp b/rpcs3/Emu/Memory/vm.cpp index de34a95686..e2252284c8 100644 --- a/rpcs3/Emu/Memory/vm.cpp +++ b/rpcs3/Emu/Memory/vm.cpp @@ -629,7 +629,7 @@ namespace vm auto& res = vm::reservation_acquire(addr, 1); auto* ptr = vm::get_super_ptr(addr & -128); - cpu_thread::suspend_all(get_current_cpu_thread(), {ptr, ptr + 64, &res}, [&] + cpu_thread::suspend_all<+1>(get_current_cpu_thread(), {ptr, ptr + 64, &res}, [&] { if (func()) {