diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index a82356f8e0..bca2bc9afb 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -1355,8 +1355,6 @@ ppu_thread::~ppu_thread() perf_log.notice("Perf stats for instructions: total %u", exec_bytes / 4); } -void ppu_interrupt_thread_entry(ppu_thread&, ppu_opcode_t, be_t*, struct ppu_intrp_func*); - ppu_thread::ppu_thread(const ppu_thread_params& param, std::string_view name, u32 prio, int detached) : cpu_thread(idm::last_id()) , prio(prio) @@ -1377,14 +1375,6 @@ ppu_thread::ppu_thread(const ppu_thread_params& param, std::string_view name, u3 gpr[3] = param.arg0; gpr[4] = param.arg1; } - else - { - cmd_list - ({ - { ppu_cmd::ptr_call, 0 }, - std::bit_cast(&ppu_interrupt_thread_entry) - }); - } // Trigger the scheduler state += cpu_flag::suspend; diff --git a/rpcs3/Emu/Cell/lv2/sys_interrupt.cpp b/rpcs3/Emu/Cell/lv2/sys_interrupt.cpp index d9c0801423..86660f924d 100644 --- a/rpcs3/Emu/Cell/lv2/sys_interrupt.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_interrupt.cpp @@ -38,9 +38,6 @@ void lv2_int_serv::exec() const { ppu_cmd::ptr_call, 0 }, std::bit_cast(&ppu_interrupt_thread_entry) }); - - thread->cmd_notify++; - thread->cmd_notify.notify_one(); } void ppu_thread_exit(ppu_thread&, ppu_opcode_t, be_t*, struct ppu_intrp_func*); @@ -136,8 +133,16 @@ error_code _sys_interrupt_thread_establish(ppu_thread& ppu, vm::ptr ih, u32 result = std::make_shared(it, arg1, arg2); tag->handler = result; + + it->cmd_list + ({ + { ppu_cmd::ptr_call, 0 }, + std::bit_cast(&ppu_interrupt_thread_entry) + }); + it->state -= cpu_flag::stop; it->state.notify_one(cpu_flag::stop); + return result; }); @@ -240,11 +245,11 @@ void ppu_interrupt_thread_entry(ppu_thread& ppu, ppu_opcode_t, be_t*, struc const auto state = +ppu.state; - if (::is_stopped(state)) + if (::is_stopped(state) || ppu.cmd_notify.exchange(0)) { return; } - thread_ctrl::wait_on(ppu.state, state); + thread_ctrl::wait_on(ppu.cmd_notify, 0); } }