Stub sys_spu_thread_group_set_cooperative_victims and syscall_253

This commit is contained in:
Eladash 2020-02-22 11:11:07 +02:00 committed by Ani
parent 0d4f8ca234
commit 4d3cdca7f6
4 changed files with 69 additions and 2 deletions

View file

@ -193,6 +193,7 @@ extern std::string ppu_get_syscall_name(u64 code)
case 250: return "sys_spu_thread_group_set_cooperative_victims"; case 250: return "sys_spu_thread_group_set_cooperative_victims";
case 251: return "sys_spu_thread_group_connect_event_all_threads"; case 251: return "sys_spu_thread_group_connect_event_all_threads";
case 252: return "sys_spu_thread_group_disconnect_event_all_threads"; case 252: return "sys_spu_thread_group_disconnect_event_all_threads";
case 253: return "sys_spu_thread_group_syscall_253";
case 254: return "sys_spu_thread_group_log"; case 254: return "sys_spu_thread_group_log";
case 260: return "sys_spu_image_open_by_fd"; case 260: return "sys_spu_image_open_by_fd";
case 300: return "sys_vm_memory_map"; case 300: return "sys_vm_memory_map";

View file

@ -305,10 +305,10 @@ const std::array<ppu_function_t, 1024> s_ppu_syscall_table
null_func,//BIND_FUNC(sys_spu_thread_group_system_unset_switch_group) //247 (0x0F7) ROOT null_func,//BIND_FUNC(sys_spu_thread_group_system_unset_switch_group) //247 (0x0F7) ROOT
null_func,//BIND_FUNC(sys_spu_thread_group...) //248 (0x0F8) ROOT null_func,//BIND_FUNC(sys_spu_thread_group...) //248 (0x0F8) ROOT
null_func,//BIND_FUNC(sys_spu_thread_group...) //249 (0x0F9) ROOT null_func,//BIND_FUNC(sys_spu_thread_group...) //249 (0x0F9) ROOT
null_func,//BIND_FUNC(sys_spu_thread_group_set_cooperative_victims) //250 (0x0FA) BIND_FUNC(sys_spu_thread_group_set_cooperative_victims),//250 (0x0FA)
BIND_FUNC(sys_spu_thread_group_connect_event_all_threads), //251 (0x0FB) BIND_FUNC(sys_spu_thread_group_connect_event_all_threads), //251 (0x0FB)
BIND_FUNC(sys_spu_thread_group_disconnect_event_all_threads), //252 (0x0FC) BIND_FUNC(sys_spu_thread_group_disconnect_event_all_threads), //252 (0x0FC)
null_func,//BIND_FUNC(sys_spu_thread_group...) //253 (0x0FD) BIND_FUNC(sys_spu_thread_group_syscall_253), //253 (0x0FD)
BIND_FUNC(sys_spu_thread_group_log), //254 (0x0FE) BIND_FUNC(sys_spu_thread_group_log), //254 (0x0FE)
uns_func, uns_func, uns_func, uns_func, uns_func, //255-259 UNS uns_func, uns_func, uns_func, uns_func, uns_func, //255-259 UNS

View file

@ -21,6 +21,8 @@
LOG_CHANNEL(sys_spu); LOG_CHANNEL(sys_spu);
extern u64 get_timebased_time();
void sys_spu_image::load(const fs::file& stream) void sys_spu_image::load(const fs::file& stream)
{ {
const spu_exec_object obj{stream, 0, elf_opt::no_sections + elf_opt::no_data}; const spu_exec_object obj{stream, 0, elf_opt::no_sections + elf_opt::no_data};
@ -1015,6 +1017,60 @@ error_code sys_spu_thread_group_get_priority(ppu_thread& ppu, u32 id, vm::ptr<s3
return CELL_OK; return CELL_OK;
} }
error_code sys_spu_thread_group_set_cooperative_victims(ppu_thread& ppu, u32 id, u32 threads_mask)
{
vm::temporary_unlock(ppu);
sys_spu.warning("sys_spu_thread_group_set_cooperative_victims(id=0x%x, threads_mask=0x%x)", id, threads_mask);
const auto group = idm::get<lv2_spu_group>(id);
if (!group)
{
return CELL_ESRCH;
}
if (!(group->type & SYS_SPU_THREAD_GROUP_TYPE_COOPERATE_WITH_SYSTEM))
{
return CELL_EINVAL;
}
if (threads_mask >= 1u << group->max_num)
{
return CELL_EINVAL;
}
// TODO
return CELL_OK;
}
error_code sys_spu_thread_group_syscall_253(ppu_thread& ppu, u32 id, vm::ptr<sys_spu_thread_group_syscall_253_info> info)
{
vm::temporary_unlock(ppu);
sys_spu.warning("sys_spu_thread_group_syscall_253(id=0x%x, info=*0x%x)", id, info);
const auto group = idm::get<lv2_spu_group>(id);
if (!group)
{
return CELL_ESRCH;
}
if (!(group->type & SYS_SPU_THREAD_GROUP_TYPE_COOPERATE_WITH_SYSTEM))
{
return CELL_EINVAL;
}
// TODO
info->deadlineMissCounter = 0;
info->deadlineMeetCounter = 0;
info->timestamp = get_timebased_time();
return CELL_OK;
}
error_code sys_spu_thread_write_ls(ppu_thread& ppu, u32 id, u32 lsa, u64 value, u32 type) error_code sys_spu_thread_write_ls(ppu_thread& ppu, u32 id, u32 lsa, u64 value, u32 type)
{ {
vm::temporary_unlock(ppu); vm::temporary_unlock(ppu);

View file

@ -236,6 +236,14 @@ struct lv2_spu_image : lv2_obj
} }
}; };
struct sys_spu_thread_group_syscall_253_info
{
be_t<u32> deadlineMeetCounter; // From cellSpursGetInfo
be_t<u32> deadlineMissCounter; // Same
be_t<u64> timestamp;
be_t<u64> _x10[6];
};
struct lv2_spu_group struct lv2_spu_group
{ {
static const u32 id_base = 0x04000100; static const u32 id_base = 0x04000100;
@ -345,6 +353,8 @@ error_code sys_spu_thread_group_connect_event(ppu_thread&, u32 id, u32 eq, u32 e
error_code sys_spu_thread_group_disconnect_event(ppu_thread&, u32 id, u32 et); error_code sys_spu_thread_group_disconnect_event(ppu_thread&, u32 id, u32 et);
error_code sys_spu_thread_group_connect_event_all_threads(ppu_thread&, u32 id, u32 eq_id, u64 req, vm::ptr<u8> spup); error_code sys_spu_thread_group_connect_event_all_threads(ppu_thread&, u32 id, u32 eq_id, u64 req, vm::ptr<u8> spup);
error_code sys_spu_thread_group_disconnect_event_all_threads(ppu_thread&, u32 id, u8 spup); error_code sys_spu_thread_group_disconnect_event_all_threads(ppu_thread&, u32 id, u8 spup);
error_code sys_spu_thread_group_set_cooperative_victims(ppu_thread&, u32 id, u32 threads_mask);
error_code sys_spu_thread_group_syscall_253(ppu_thread& ppu, u32 id, vm::ptr<sys_spu_thread_group_syscall_253_info> info);
error_code sys_spu_thread_group_log(ppu_thread&, s32 command, vm::ptr<s32> stat); error_code sys_spu_thread_group_log(ppu_thread&, s32 command, vm::ptr<s32> stat);
error_code sys_spu_thread_write_ls(ppu_thread&, u32 id, u32 address, u64 value, u32 type); error_code sys_spu_thread_write_ls(ppu_thread&, u32 id, u32 address, u64 value, u32 type);
error_code sys_spu_thread_read_ls(ppu_thread&, u32 id, u32 address, vm::ptr<u64> value, u32 type); error_code sys_spu_thread_read_ls(ppu_thread&, u32 id, u32 address, vm::ptr<u64> value, u32 type);