Check sys_spu_thread_group_create's nsize (#3742)

* Check sys_spu_thread_group_create's nsize

* cellSearch callback correction
This commit is contained in:
Ofek 2017-11-23 00:02:23 +02:00 committed by Ivan
parent fb52cbb8b2
commit 58c42ad9c0
2 changed files with 8 additions and 3 deletions

View File

@ -3,6 +3,7 @@
#include "Emu/Cell/PPUModule.h"
#include "cellSearch.h"
#include "cellSysutil.h"
logs::channel cellSearch("cellSearch");
@ -13,7 +14,11 @@ s32 cellSearchInitialize(ppu_thread& ppu, CellSearchMode mode, u32 container, vm
// TODO: Store the arguments somewhere so we can use them later.
//inform callback that search is alive
func(ppu, CELL_SEARCH_EVENT_INITIALIZE_RESULT, CELL_OK, vm::null, userData);
sysutil_register_cb([=](ppu_thread& ppu) -> s32
{
func(ppu, CELL_SEARCH_EVENT_INITIALIZE_RESULT, CELL_OK, vm::null, userData);
return CELL_OK;
});
return CELL_OK;
}

View File

@ -296,7 +296,7 @@ error_code sys_spu_thread_group_create(vm::ptr<u32> id, u32 num, s32 prio, vm::p
// TODO: max num value should be affected by sys_spu_initialize() settings
if (!num || num > 6 || ((prio < 16 || prio > 255) && attr->type != SYS_SPU_THREAD_GROUP_TYPE_EXCLUSIVE_NON_CONTEXT))
if (attr->nsize > 0x80 || !num || num > 6 || ((prio < 16 || prio > 255) && attr->type != SYS_SPU_THREAD_GROUP_TYPE_EXCLUSIVE_NON_CONTEXT))
{
return CELL_EINVAL;
}
@ -306,7 +306,7 @@ error_code sys_spu_thread_group_create(vm::ptr<u32> id, u32 num, s32 prio, vm::p
sys_spu.todo("Unsupported SPU Thread Group type (0x%x)", attr->type);
}
*id = idm::make<lv2_spu_group>(std::string(attr->name.get_ptr(), attr->nsize - 1), num, prio, attr->type, attr->ct);
*id = idm::make<lv2_spu_group>(std::string(attr->name.get_ptr(), std::max<u32>(attr->nsize, 1) - 1), num, prio, attr->type, attr->ct);
return CELL_OK;
}