From 5b5f2d4240fd685b674568142bf2ead7112b3c50 Mon Sep 17 00:00:00 2001 From: elad Date: Mon, 5 Feb 2018 09:43:02 +0200 Subject: [PATCH] hle: add a missing check in sys_spu check if exit code exists and the spu is stopped by a stop instruction and optimize the way were getting the exit code --- rpcs3/Emu/Cell/lv2/sys_spu.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/Cell/lv2/sys_spu.cpp b/rpcs3/Emu/Cell/lv2/sys_spu.cpp index 0bd4e042b4..7bf7c9f41e 100644 --- a/rpcs3/Emu/Cell/lv2/sys_spu.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_spu.cpp @@ -278,16 +278,18 @@ error_code sys_spu_thread_get_exit_status(u32 id, vm::ptr status) const auto thread = idm::get(id); - if (!thread) + if (UNLIKELY(!thread)) { return CELL_ESRCH; } - // TODO: check CELL_ESTAT condition + if (thread->status & SPU_STATUS_STOPPED_BY_STOP) + { + *status = thread->ch_out_mbox.get_value(); + return CELL_OK; + } - *status = thread->ch_out_mbox.pop(*thread); - - return CELL_OK; + return CELL_ESTAT; } error_code sys_spu_thread_group_create(vm::ptr id, u32 num, s32 prio, vm::ptr attr)