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
This commit is contained in:
elad 2018-02-05 09:43:02 +02:00 committed by Ivan
parent 956ae17876
commit 5b5f2d4240

View file

@ -278,18 +278,20 @@ error_code sys_spu_thread_get_exit_status(u32 id, vm::ptr<u32> status)
const auto thread = idm::get<SPUThread>(id); const auto thread = idm::get<SPUThread>(id);
if (!thread) if (UNLIKELY(!thread))
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
// TODO: check CELL_ESTAT condition if (thread->status & SPU_STATUS_STOPPED_BY_STOP)
{
*status = thread->ch_out_mbox.pop(*thread); *status = thread->ch_out_mbox.get_value();
return CELL_OK; return CELL_OK;
} }
return CELL_ESTAT;
}
error_code sys_spu_thread_group_create(vm::ptr<u32> id, u32 num, s32 prio, vm::ptr<sys_spu_thread_group_attribute> attr) error_code sys_spu_thread_group_create(vm::ptr<u32> id, u32 num, s32 prio, vm::ptr<sys_spu_thread_group_attribute> attr)
{ {
sys_spu.warning("sys_spu_thread_group_create(id=*0x%x, num=%d, prio=%d, attr=*0x%x)", id, num, prio, attr); sys_spu.warning("sys_spu_thread_group_create(id=*0x%x, num=%d, prio=%d, attr=*0x%x)", id, num, prio, attr);