diff --git a/rpcs3/Emu/Cell/PPUFunction.cpp b/rpcs3/Emu/Cell/PPUFunction.cpp index 312b0ddf7d..0cd8c88807 100644 --- a/rpcs3/Emu/Cell/PPUFunction.cpp +++ b/rpcs3/Emu/Cell/PPUFunction.cpp @@ -193,6 +193,7 @@ extern std::string ppu_get_syscall_name(u64 code) case 250: return "sys_spu_thread_group_set_cooperative_victims"; case 251: return "sys_spu_thread_group_connect_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 260: return "sys_spu_image_open_by_fd"; case 300: return "sys_vm_memory_map"; diff --git a/rpcs3/Emu/Cell/lv2/lv2.cpp b/rpcs3/Emu/Cell/lv2/lv2.cpp index 39102d341e..65ab86cf61 100644 --- a/rpcs3/Emu/Cell/lv2/lv2.cpp +++ b/rpcs3/Emu/Cell/lv2/lv2.cpp @@ -305,10 +305,10 @@ const std::array 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...) //248 (0x0F8) 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_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) uns_func, uns_func, uns_func, uns_func, uns_func, //255-259 UNS diff --git a/rpcs3/Emu/Cell/lv2/sys_spu.cpp b/rpcs3/Emu/Cell/lv2/sys_spu.cpp index 7480d0a353..fde611d23f 100644 --- a/rpcs3/Emu/Cell/lv2/sys_spu.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_spu.cpp @@ -21,6 +21,8 @@ LOG_CHANNEL(sys_spu); +extern u64 get_timebased_time(); + void sys_spu_image::load(const fs::file& stream) { 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(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 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(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) { vm::temporary_unlock(ppu); diff --git a/rpcs3/Emu/Cell/lv2/sys_spu.h b/rpcs3/Emu/Cell/lv2/sys_spu.h index a92959569c..0ddda9e788 100644 --- a/rpcs3/Emu/Cell/lv2/sys_spu.h +++ b/rpcs3/Emu/Cell/lv2/sys_spu.h @@ -236,6 +236,14 @@ struct lv2_spu_image : lv2_obj } }; +struct sys_spu_thread_group_syscall_253_info +{ + be_t deadlineMeetCounter; // From cellSpursGetInfo + be_t deadlineMissCounter; // Same + be_t timestamp; + be_t _x10[6]; +}; + struct lv2_spu_group { 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_connect_event_all_threads(ppu_thread&, u32 id, u32 eq_id, u64 req, vm::ptr 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 info); error_code sys_spu_thread_group_log(ppu_thread&, s32 command, vm::ptr stat); 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 value, u32 type);