Update sys_spu

- Implement sys_spu_thread_group_set_priority
- Implement sys_spu_thread_group_get_priority
This commit is contained in:
scribam 2017-04-08 17:42:28 +02:00 committed by Ivan
parent 7cd15a6202
commit 9ba0a9189b
3 changed files with 53 additions and 2 deletions

View File

@ -238,8 +238,8 @@ std::array<ppu_function_t, 1024> g_ppu_syscall_table
BIND_FUNC(sys_spu_thread_group_yield), //176 (0x0B0)
BIND_FUNC(sys_spu_thread_group_terminate), //177 (0x0B1)
BIND_FUNC(sys_spu_thread_group_join), //178 (0x0B2)
null_func,//BIND_FUNC(sys_spu_thread_group_set_priority)//179 (0x0B3)
null_func,//BIND_FUNC(sys_spu_thread_group_get_priority)//180 (0x0B4)
BIND_FUNC(sys_spu_thread_group_set_priority), //179 (0x0B3)
BIND_FUNC(sys_spu_thread_group_get_priority), //180 (0x0B4)
BIND_FUNC(sys_spu_thread_write_ls), //181 (0x0B5)
BIND_FUNC(sys_spu_thread_read_ls), //182 (0x0B6)
null_func, //183 (0x0B7) UNS

View File

@ -606,6 +606,55 @@ error_code sys_spu_thread_group_join(ppu_thread& ppu, u32 id, vm::ptr<u32> cause
return CELL_OK;
}
error_code sys_spu_thread_group_set_priority(u32 id, s32 priority)
{
sys_spu.trace("sys_spu_thread_group_set_priority(id=0x%x, priority=%d)", id, priority);
if (priority < 16 || priority > 255)
{
return CELL_EINVAL;
}
const auto group = idm::get<lv2_spu_group>(id);
if (!group)
{
return CELL_ESRCH;
}
if (group->type == SYS_SPU_THREAD_GROUP_TYPE_EXCLUSIVE_NON_CONTEXT)
{
return CELL_EINVAL;
}
group->prio = priority;
return CELL_OK;
}
error_code sys_spu_thread_group_get_priority(u32 id, vm::ptr<s32> priority)
{
sys_spu.trace("sys_spu_thread_group_get_priority(id=0x%x, priority=*0x%x)", id, priority);
const auto group = idm::get<lv2_spu_group>(id);
if (!group)
{
return CELL_ESRCH;
}
if (group->type == SYS_SPU_THREAD_GROUP_TYPE_EXCLUSIVE_NON_CONTEXT)
{
*priority = 0;
}
else
{
*priority = group->prio;
}
return CELL_OK;
}
error_code sys_spu_thread_write_ls(u32 id, u32 lsa, u64 value, u32 type)
{
sys_spu.trace("sys_spu_thread_write_ls(id=0x%x, lsa=0x%05x, value=0x%llx, type=%d)", id, lsa, value, type);

View File

@ -222,6 +222,8 @@ error_code sys_spu_thread_group_resume(u32 id);
error_code sys_spu_thread_group_yield(u32 id);
error_code sys_spu_thread_group_terminate(u32 id, s32 value);
error_code sys_spu_thread_group_join(ppu_thread&, u32 id, vm::ps3::ptr<u32> cause, vm::ps3::ptr<u32> status);
error_code sys_spu_thread_group_set_priority(u32 id, s32 priority);
error_code sys_spu_thread_group_get_priority(u32 id, vm::ps3::ptr<s32> priority);
error_code sys_spu_thread_group_connect_event(u32 id, u32 eq, u32 et);
error_code sys_spu_thread_group_disconnect_event(u32 id, u32 et);
error_code sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq_id, u64 req, vm::ps3::ptr<u8> spup);