From 91b4aaf9e1d3e7cec7654fca51ba3832b2f01b48 Mon Sep 17 00:00:00 2001 From: Elad Ashkenazi <18193363+elad335@users.noreply.github.com> Date: Sat, 27 Jul 2024 09:56:11 +0300 Subject: [PATCH] PPU: Fix potential overflow --- rpcs3/Emu/Cell/lv2/sys_interrupt.cpp | 2 +- rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp | 2 +- rpcs3/Emu/RSX/RSXThread.cpp | 4 ++-- rpcs3/Emu/RSX/rsx_methods.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rpcs3/Emu/Cell/lv2/sys_interrupt.cpp b/rpcs3/Emu/Cell/lv2/sys_interrupt.cpp index 63d8963ab2..800f2f85b9 100644 --- a/rpcs3/Emu/Cell/lv2/sys_interrupt.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_interrupt.cpp @@ -92,7 +92,7 @@ void lv2_int_serv::join() const std::bit_cast(&ppu_thread_exit) }); - thread->cmd_notify++; + thread->cmd_notify.store(1); thread->cmd_notify.notify_one(); (*thread)(); diff --git a/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp b/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp index 0f1c487741..064cceb728 100644 --- a/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp @@ -581,7 +581,7 @@ error_code sys_ppu_thread_start(ppu_thread& ppu, u32 thread_id) } else { - thread->cmd_notify++; + thread->cmd_notify.store(1); thread->cmd_notify.notify_one(); } diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index d208eac776..7b9f99327e 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -933,7 +933,7 @@ namespace rsx { ppu_cmd::sleep, 0 } }); - intr_thread->cmd_notify++; + intr_thread->cmd_notify.store(1); intr_thread->cmd_notify.notify_one(); } } @@ -3923,7 +3923,7 @@ namespace rsx { ppu_cmd::sleep, 0 } }); - intr_thread->cmd_notify++; + intr_thread->cmd_notify.store(1); intr_thread->cmd_notify.notify_one(); } } diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index de7eabdbfa..a54a743996 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -57,7 +57,7 @@ namespace rsx { ppu_cmd::sleep, 0 } }); - RSX(ctx)->intr_thread->cmd_notify++; + RSX(ctx)->intr_thread->cmd_notify.store(1); RSX(ctx)->intr_thread->cmd_notify.notify_one(); } @@ -84,7 +84,7 @@ namespace rsx { ppu_cmd::sleep, 0 } }); - RSX(ctx)->intr_thread->cmd_notify++; + RSX(ctx)->intr_thread->cmd_notify.store(1); RSX(ctx)->intr_thread->cmd_notify.notify_one(); } }