From 11b0b6958ff2084745a8c39233efda3320ac2ec1 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sun, 5 Feb 2017 15:48:11 +0300 Subject: [PATCH] sys_spu diag --- rpcs3/Emu/Cell/Modules/cellSpurs.cpp | 2 + rpcs3/Emu/Cell/PPUThread.cpp | 4 +- rpcs3/Emu/Cell/lv2/sys_cond.cpp | 2 +- rpcs3/Emu/Cell/lv2/sys_event.cpp | 2 +- rpcs3/Emu/Cell/lv2/sys_event_flag.cpp | 2 +- rpcs3/Emu/Cell/lv2/sys_lwcond.cpp | 2 +- rpcs3/Emu/Cell/lv2/sys_lwmutex.cpp | 2 +- rpcs3/Emu/Cell/lv2/sys_mutex.cpp | 2 +- rpcs3/Emu/Cell/lv2/sys_rwlock.cpp | 4 +- rpcs3/Emu/Cell/lv2/sys_semaphore.cpp | 2 +- rpcs3/Emu/Cell/lv2/sys_spu.cpp | 74 ++++++++++++------------- rpcs3/Emu/Cell/lv2/sys_spu.h | 78 +++++++++++++-------------- rpcs3/Emu/Cell/lv2/sys_timer.cpp | 9 ++-- rpcs3/Emu/Cell/lv2/sys_timer.h | 6 ++- 14 files changed, 99 insertions(+), 92 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellSpurs.cpp b/rpcs3/Emu/Cell/Modules/cellSpurs.cpp index 8c9cc83eff..24b0a1c356 100644 --- a/rpcs3/Emu/Cell/Modules/cellSpurs.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSpurs.cpp @@ -17,6 +17,8 @@ logs::channel cellSpurs("cellSpurs", logs::level::notice); +s32 sys_spu_image_close(vm::ptr img); + // TODO struct cell_error_t { diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index df44b7c043..1ef028f68d 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -43,6 +43,8 @@ #include "Modules/cellMsgDialog.h" #endif +extern u64 get_system_time(); + namespace vm { using namespace ps3; } enum class ppu_decoder_type @@ -374,7 +376,7 @@ void ppu_thread::fast_call(u32 addr, u32 rtoc) } catch (EmulationStopped) { - if (last_function) LOG_WARNING(PPU, "'%s' aborted", last_function); + if (last_function) LOG_WARNING(PPU, "'%s' aborted (%fs)", last_function, (get_system_time() - gpr[10]) / 1000000.); last_function = old_func; throw; } diff --git a/rpcs3/Emu/Cell/lv2/sys_cond.cpp b/rpcs3/Emu/Cell/lv2/sys_cond.cpp index 4eed846947..631f7e1d8a 100644 --- a/rpcs3/Emu/Cell/lv2/sys_cond.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_cond.cpp @@ -194,7 +194,7 @@ error_code sys_cond_wait(ppu_thread& ppu, u32 cond_id, u64 timeout) { sys_cond.trace("sys_cond_wait(cond_id=0x%x, timeout=%lld)", cond_id, timeout); - const u64 start_time = get_system_time(); + const u64 start_time = ppu.gpr[10] = get_system_time(); const auto cond = idm::get(cond_id, [&](lv2_cond& cond) { diff --git a/rpcs3/Emu/Cell/lv2/sys_event.cpp b/rpcs3/Emu/Cell/lv2/sys_event.cpp index 90e09625f1..c932588632 100644 --- a/rpcs3/Emu/Cell/lv2/sys_event.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_event.cpp @@ -222,7 +222,7 @@ error_code sys_event_queue_receive(ppu_thread& ppu, u32 equeue_id, vm::ptr(equeue_id, [&](lv2_event_queue& queue) -> CellError { diff --git a/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp b/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp index c7ba542c6d..cf351f9391 100644 --- a/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp @@ -86,7 +86,7 @@ error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm { sys_event_flag.trace("sys_event_flag_wait(id=0x%x, bitptn=0x%llx, mode=0x%x, result=*0x%x, timeout=0x%llx)", id, bitptn, mode, result, timeout); - const u64 start_time = get_system_time(); + const u64 start_time = ppu.gpr[10] = get_system_time(); // Fix function arguments for external access ppu.gpr[4] = bitptn; diff --git a/rpcs3/Emu/Cell/lv2/sys_lwcond.cpp b/rpcs3/Emu/Cell/lv2/sys_lwcond.cpp index 1e932f345c..47d9d4e810 100644 --- a/rpcs3/Emu/Cell/lv2/sys_lwcond.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_lwcond.cpp @@ -221,7 +221,7 @@ error_code _sys_lwcond_queue_wait(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id { sys_lwcond.trace("_sys_lwcond_queue_wait(lwcond_id=0x%x, lwmutex_id=0x%x, timeout=0x%llx)", lwcond_id, lwmutex_id, timeout); - const u64 start_time = get_system_time(); + const u64 start_time = ppu.gpr[10] = get_system_time(); std::shared_ptr mutex; diff --git a/rpcs3/Emu/Cell/lv2/sys_lwmutex.cpp b/rpcs3/Emu/Cell/lv2/sys_lwmutex.cpp index b569386b7a..c2a244a440 100644 --- a/rpcs3/Emu/Cell/lv2/sys_lwmutex.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_lwmutex.cpp @@ -70,7 +70,7 @@ error_code _sys_lwmutex_lock(ppu_thread& ppu, u32 lwmutex_id, u64 timeout) { sys_lwmutex.trace("_sys_lwmutex_lock(lwmutex_id=0x%x, timeout=0x%llx)", lwmutex_id, timeout); - const u64 start_time = get_system_time(); + const u64 start_time = ppu.gpr[10] = get_system_time(); const auto mutex = idm::get(lwmutex_id, [&](lv2_lwmutex& mutex) { diff --git a/rpcs3/Emu/Cell/lv2/sys_mutex.cpp b/rpcs3/Emu/Cell/lv2/sys_mutex.cpp index aa71fc8445..e023f26d03 100644 --- a/rpcs3/Emu/Cell/lv2/sys_mutex.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_mutex.cpp @@ -101,7 +101,7 @@ error_code sys_mutex_lock(ppu_thread& ppu, u32 mutex_id, u64 timeout) { sys_mutex.trace("sys_mutex_lock(mutex_id=0x%x, timeout=0x%llx)", mutex_id, timeout); - const u64 start_time = get_system_time(); + const u64 start_time = ppu.gpr[10] = get_system_time(); const auto mutex = idm::get(mutex_id, [&](lv2_mutex& mutex) { diff --git a/rpcs3/Emu/Cell/lv2/sys_rwlock.cpp b/rpcs3/Emu/Cell/lv2/sys_rwlock.cpp index 06516b64e6..775b7fbac9 100644 --- a/rpcs3/Emu/Cell/lv2/sys_rwlock.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_rwlock.cpp @@ -76,7 +76,7 @@ error_code sys_rwlock_rlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout) { sys_rwlock.trace("sys_rwlock_rlock(rw_lock_id=0x%x, timeout=0x%llx)", rw_lock_id, timeout); - const u64 start_time = get_system_time(); + const u64 start_time = ppu.gpr[10] = get_system_time(); const auto rwlock = idm::get(rw_lock_id, [&](lv2_rwlock& rwlock) { @@ -257,7 +257,7 @@ error_code sys_rwlock_wlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout) { sys_rwlock.trace("sys_rwlock_wlock(rw_lock_id=0x%x, timeout=0x%llx)", rw_lock_id, timeout); - const u64 start_time = get_system_time(); + const u64 start_time = ppu.gpr[10] = get_system_time(); const auto rwlock = idm::get(rw_lock_id, [&](lv2_rwlock& rwlock) { diff --git a/rpcs3/Emu/Cell/lv2/sys_semaphore.cpp b/rpcs3/Emu/Cell/lv2/sys_semaphore.cpp index e6eb632b4e..f67fe13592 100644 --- a/rpcs3/Emu/Cell/lv2/sys_semaphore.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_semaphore.cpp @@ -82,7 +82,7 @@ error_code sys_semaphore_wait(ppu_thread& ppu, u32 sem_id, u64 timeout) { sys_semaphore.trace("sys_semaphore_wait(sem_id=0x%x, timeout=0x%llx)", sem_id, timeout); - const u64 start_time = get_system_time(); + const u64 start_time = ppu.gpr[10] = get_system_time(); const auto sem = idm::get(sem_id, [&](lv2_sema& sema) { diff --git a/rpcs3/Emu/Cell/lv2/sys_spu.cpp b/rpcs3/Emu/Cell/lv2/sys_spu.cpp index 2902c66576..b8f2221532 100644 --- a/rpcs3/Emu/Cell/lv2/sys_spu.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_spu.cpp @@ -44,7 +44,7 @@ u32 LoadSpuImage(const fs::file& stream, u32& spu_ep) return spu_offset; } -s32 sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu) +error_code sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu) { sys_spu.warning("sys_spu_initialize(max_usable_spu=%d, max_raw_spu=%d)", max_usable_spu, max_raw_spu); @@ -56,7 +56,7 @@ s32 sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu) return CELL_OK; } -s32 sys_spu_image_open(vm::ptr img, vm::cptr path) +error_code sys_spu_image_open(vm::ptr img, vm::cptr path) { sys_spu.warning("sys_spu_image_open(img=*0x%x, path=%s)", img, path); @@ -88,7 +88,7 @@ s32 sys_spu_image_open(vm::ptr img, vm::cptr path) return CELL_OK; } -s32 sys_spu_thread_initialize(vm::ptr thread, u32 group_id, u32 spu_num, vm::ptr img, vm::ptr attr, vm::ptr arg) +error_code sys_spu_thread_initialize(vm::ptr thread, u32 group_id, u32 spu_num, vm::ptr img, vm::ptr attr, vm::ptr arg) { sys_spu.warning("sys_spu_thread_initialize(thread=*0x%x, group=0x%x, spu_num=%d, img=*0x%x, attr=*0x%x, arg=*0x%x)", thread, group_id, spu_num, img, attr, arg); @@ -135,7 +135,7 @@ s32 sys_spu_thread_initialize(vm::ptr thread, u32 group_id, u32 spu_num, vm return CELL_OK; } -s32 sys_spu_thread_set_argument(u32 id, vm::ptr arg) +error_code sys_spu_thread_set_argument(u32 id, vm::ptr arg) { sys_spu.warning("sys_spu_thread_set_argument(id=0x%x, arg=*0x%x)", id, arg); @@ -158,7 +158,7 @@ s32 sys_spu_thread_set_argument(u32 id, vm::ptr arg) return CELL_OK; } -s32 sys_spu_thread_get_exit_status(u32 id, vm::ptr status) +error_code sys_spu_thread_get_exit_status(u32 id, vm::ptr status) { sys_spu.warning("sys_spu_thread_get_exit_status(id=0x%x, status=*0x%x)", id, status); @@ -176,7 +176,7 @@ s32 sys_spu_thread_get_exit_status(u32 id, vm::ptr status) return CELL_OK; } -s32 sys_spu_thread_group_create(vm::ptr id, u32 num, s32 prio, vm::ptr attr) +error_code sys_spu_thread_group_create(vm::ptr id, u32 num, s32 prio, vm::ptr attr) { sys_spu.warning("sys_spu_thread_group_create(id=*0x%x, num=%d, prio=%d, attr=*0x%x)", id, num, prio, attr); @@ -197,7 +197,7 @@ s32 sys_spu_thread_group_create(vm::ptr id, u32 num, s32 prio, vm::ptr cause, vm::ptr status) +error_code sys_spu_thread_group_join(u32 id, vm::ptr cause, vm::ptr status) { sys_spu.warning("sys_spu_thread_group_join(id=0x%x, cause=*0x%x, status=*0x%x)", id, cause, status); @@ -562,7 +562,7 @@ s32 sys_spu_thread_group_join(u32 id, vm::ptr cause, vm::ptr status) return CELL_OK; } -s32 sys_spu_thread_write_ls(u32 id, u32 lsa, u64 value, u32 type) +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); @@ -599,7 +599,7 @@ s32 sys_spu_thread_write_ls(u32 id, u32 lsa, u64 value, u32 type) return CELL_OK; } -s32 sys_spu_thread_read_ls(u32 id, u32 lsa, vm::ptr value, u32 type) +error_code sys_spu_thread_read_ls(u32 id, u32 lsa, vm::ptr value, u32 type) { sys_spu.trace("sys_spu_thread_read_ls(id=0x%x, lsa=0x%05x, value=*0x%x, type=%d)", id, lsa, value, type); @@ -636,7 +636,7 @@ s32 sys_spu_thread_read_ls(u32 id, u32 lsa, vm::ptr value, u32 type) return CELL_OK; } -s32 sys_spu_thread_write_spu_mb(u32 id, u32 value) +error_code sys_spu_thread_write_spu_mb(u32 id, u32 value) { sys_spu.warning("sys_spu_thread_write_spu_mb(id=0x%x, value=0x%x)", id, value); @@ -661,7 +661,7 @@ s32 sys_spu_thread_write_spu_mb(u32 id, u32 value) return CELL_OK; } -s32 sys_spu_thread_set_spu_cfg(u32 id, u64 value) +error_code sys_spu_thread_set_spu_cfg(u32 id, u64 value) { sys_spu.warning("sys_spu_thread_set_spu_cfg(id=0x%x, value=0x%x)", id, value); @@ -682,7 +682,7 @@ s32 sys_spu_thread_set_spu_cfg(u32 id, u64 value) return CELL_OK; } -s32 sys_spu_thread_get_spu_cfg(u32 id, vm::ptr value) +error_code sys_spu_thread_get_spu_cfg(u32 id, vm::ptr value) { sys_spu.warning("sys_spu_thread_get_spu_cfg(id=0x%x, value=*0x%x)", id, value); @@ -698,7 +698,7 @@ s32 sys_spu_thread_get_spu_cfg(u32 id, vm::ptr value) return CELL_OK; } -s32 sys_spu_thread_write_snr(u32 id, u32 number, u32 value) +error_code sys_spu_thread_write_snr(u32 id, u32 number, u32 value) { sys_spu.trace("sys_spu_thread_write_snr(id=0x%x, number=%d, value=0x%x)", id, number, value); @@ -724,7 +724,7 @@ s32 sys_spu_thread_write_snr(u32 id, u32 number, u32 value) return CELL_OK; } -s32 sys_spu_thread_group_connect_event(u32 id, u32 eq, u32 et) +error_code sys_spu_thread_group_connect_event(u32 id, u32 eq, u32 et) { sys_spu.warning("sys_spu_thread_group_connect_event(id=0x%x, eq=0x%x, et=%d)", id, eq, et); @@ -780,7 +780,7 @@ s32 sys_spu_thread_group_connect_event(u32 id, u32 eq, u32 et) return CELL_OK; } -s32 sys_spu_thread_group_disconnect_event(u32 id, u32 et) +error_code sys_spu_thread_group_disconnect_event(u32 id, u32 et) { sys_spu.warning("sys_spu_thread_group_disconnect_event(id=0x%x, et=%d)", id, et); @@ -835,7 +835,7 @@ s32 sys_spu_thread_group_disconnect_event(u32 id, u32 et) return CELL_OK; } -s32 sys_spu_thread_connect_event(u32 id, u32 eq, u32 et, u8 spup) +error_code sys_spu_thread_connect_event(u32 id, u32 eq, u32 et, u8 spup) { sys_spu.warning("sys_spu_thread_connect_event(id=0x%x, eq=0x%x, et=%d, spup=%d)", id, eq, et, spup); @@ -867,7 +867,7 @@ s32 sys_spu_thread_connect_event(u32 id, u32 eq, u32 et, u8 spup) return CELL_OK; } -s32 sys_spu_thread_disconnect_event(u32 id, u32 et, u8 spup) +error_code sys_spu_thread_disconnect_event(u32 id, u32 et, u8 spup) { sys_spu.warning("sys_spu_thread_disconnect_event(id=0x%x, et=%d, spup=%d)", id, et, spup); @@ -898,7 +898,7 @@ s32 sys_spu_thread_disconnect_event(u32 id, u32 et, u8 spup) return CELL_OK; } -s32 sys_spu_thread_bind_queue(u32 id, u32 spuq, u32 spuq_num) +error_code sys_spu_thread_bind_queue(u32 id, u32 spuq, u32 spuq_num) { sys_spu.warning("sys_spu_thread_bind_queue(id=0x%x, spuq=0x%x, spuq_num=0x%x)", id, spuq, spuq_num); @@ -942,7 +942,7 @@ s32 sys_spu_thread_bind_queue(u32 id, u32 spuq, u32 spuq_num) return CELL_EAGAIN; } -s32 sys_spu_thread_unbind_queue(u32 id, u32 spuq_num) +error_code sys_spu_thread_unbind_queue(u32 id, u32 spuq_num) { sys_spu.warning("sys_spu_thread_unbind_queue(id=0x%x, spuq_num=0x%x)", id, spuq_num); @@ -968,7 +968,7 @@ s32 sys_spu_thread_unbind_queue(u32 id, u32 spuq_num) return CELL_ESRCH; } -s32 sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq, u64 req, vm::ptr spup) +error_code sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq, u64 req, vm::ptr spup) { sys_spu.warning("sys_spu_thread_group_connect_event_all_threads(id=0x%x, eq=0x%x, req=0x%llx, spup=*0x%x)", id, eq, req, spup); @@ -1039,7 +1039,7 @@ s32 sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq, u64 req, vm:: return CELL_OK; } -s32 sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup) +error_code sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup) { sys_spu.warning("sys_spu_thread_group_disconnect_event_all_threads(id=0x%x, spup=%d)", id, spup); @@ -1068,7 +1068,7 @@ s32 sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup) return CELL_OK; } -s32 sys_raw_spu_create(vm::ptr id, vm::ptr attr) +error_code sys_raw_spu_create(vm::ptr id, vm::ptr attr) { sys_spu.warning("sys_raw_spu_create(id=*0x%x, attr=*0x%x)", id, attr); @@ -1088,7 +1088,7 @@ s32 sys_raw_spu_create(vm::ptr id, vm::ptr attr) return CELL_OK; } -s32 sys_raw_spu_destroy(ppu_thread& ppu, u32 id) +error_code sys_raw_spu_destroy(ppu_thread& ppu, u32 id) { sys_spu.warning("sys_raw_spu_destroy(id=%d)", id); @@ -1148,7 +1148,7 @@ s32 sys_raw_spu_destroy(ppu_thread& ppu, u32 id) return CELL_OK; } -s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, vm::ptr intrtag) +error_code sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, vm::ptr intrtag) { sys_spu.warning("sys_raw_spu_create_interrupt_tag(id=%d, class_id=%d, hwthread=0x%x, intrtag=*0x%x)", id, class_id, hwthread, intrtag); @@ -1193,7 +1193,7 @@ s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, vm::ptr return error; } -s32 sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask) +error_code sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask) { sys_spu.trace("sys_raw_spu_set_int_mask(id=%d, class_id=%d, mask=0x%llx)", id, class_id, mask); @@ -1214,7 +1214,7 @@ s32 sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask) return CELL_OK; } -s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, vm::ptr mask) +error_code sys_raw_spu_get_int_mask(u32 id, u32 class_id, vm::ptr mask) { sys_spu.trace("sys_raw_spu_get_int_mask(id=%d, class_id=%d, mask=*0x%x)", id, class_id, mask); @@ -1235,7 +1235,7 @@ s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, vm::ptr mask) return CELL_OK; } -s32 sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat) +error_code sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat) { sys_spu.trace("sys_raw_spu_set_int_stat(id=%d, class_id=%d, stat=0x%llx)", id, class_id, stat); @@ -1256,7 +1256,7 @@ s32 sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat) return CELL_OK; } -s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, vm::ptr stat) +error_code sys_raw_spu_get_int_stat(u32 id, u32 class_id, vm::ptr stat) { sys_spu.trace("sys_raw_spu_get_int_stat(id=%d, class_id=%d, stat=*0x%x)", id, class_id, stat); @@ -1277,7 +1277,7 @@ s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, vm::ptr stat) return CELL_OK; } -s32 sys_raw_spu_read_puint_mb(u32 id, vm::ptr value) +error_code sys_raw_spu_read_puint_mb(u32 id, vm::ptr value) { sys_spu.trace("sys_raw_spu_read_puint_mb(id=%d, value=*0x%x)", id, value); @@ -1293,7 +1293,7 @@ s32 sys_raw_spu_read_puint_mb(u32 id, vm::ptr value) return CELL_OK; } -s32 sys_raw_spu_set_spu_cfg(u32 id, u32 value) +error_code sys_raw_spu_set_spu_cfg(u32 id, u32 value) { sys_spu.trace("sys_raw_spu_set_spu_cfg(id=%d, value=0x%x)", id, value); @@ -1314,7 +1314,7 @@ s32 sys_raw_spu_set_spu_cfg(u32 id, u32 value) return CELL_OK; } -s32 sys_raw_spu_get_spu_cfg(u32 id, vm::ptr value) +error_code sys_raw_spu_get_spu_cfg(u32 id, vm::ptr value) { sys_spu.trace("sys_raw_spu_get_spu_afg(id=%d, value=*0x%x)", id, value); diff --git a/rpcs3/Emu/Cell/lv2/sys_spu.h b/rpcs3/Emu/Cell/lv2/sys_spu.h index e5eecff715..bb223ce4bc 100644 --- a/rpcs3/Emu/Cell/lv2/sys_spu.h +++ b/rpcs3/Emu/Cell/lv2/sys_spu.h @@ -208,43 +208,43 @@ class ppu_thread; void LoadSpuImage(const fs::file& stream, u32& spu_ep, u32 addr); u32 LoadSpuImage(const fs::file& stream, u32& spu_ep); -// SysCalls -s32 sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu); -s32 sys_spu_image_open(vm::ps3::ptr img, vm::ps3::cptr path); -s32 sys_spu_image_close(vm::ps3::ptr img); -s32 sys_spu_thread_initialize(vm::ps3::ptr thread, u32 group, u32 spu_num, vm::ps3::ptr img, vm::ps3::ptr attr, vm::ps3::ptr arg); -s32 sys_spu_thread_set_argument(u32 id, vm::ps3::ptr arg); -s32 sys_spu_thread_group_create(vm::ps3::ptr id, u32 num, s32 prio, vm::ps3::ptr attr); -s32 sys_spu_thread_group_destroy(u32 id); -s32 sys_spu_thread_group_start(u32 id); -s32 sys_spu_thread_group_suspend(u32 id); -s32 sys_spu_thread_group_resume(u32 id); -s32 sys_spu_thread_group_yield(u32 id); -s32 sys_spu_thread_group_terminate(u32 id, s32 value); -s32 sys_spu_thread_group_join(u32 id, vm::ps3::ptr cause, vm::ps3::ptr status); -s32 sys_spu_thread_group_connect_event(u32 id, u32 eq, u32 et); -s32 sys_spu_thread_group_disconnect_event(u32 id, u32 et); -s32 sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq_id, u64 req, vm::ps3::ptr spup); -s32 sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup); -s32 sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type); -s32 sys_spu_thread_read_ls(u32 id, u32 address, vm::ps3::ptr value, u32 type); -s32 sys_spu_thread_write_spu_mb(u32 id, u32 value); -s32 sys_spu_thread_set_spu_cfg(u32 id, u64 value); -s32 sys_spu_thread_get_spu_cfg(u32 id, vm::ps3::ptr value); -s32 sys_spu_thread_write_snr(u32 id, u32 number, u32 value); -s32 sys_spu_thread_connect_event(u32 id, u32 eq, u32 et, u8 spup); -s32 sys_spu_thread_disconnect_event(u32 id, u32 event_type, u8 spup); -s32 sys_spu_thread_bind_queue(u32 id, u32 spuq, u32 spuq_num); -s32 sys_spu_thread_unbind_queue(u32 id, u32 spuq_num); -s32 sys_spu_thread_get_exit_status(u32 id, vm::ps3::ptr status); +// Syscalls -s32 sys_raw_spu_create(vm::ps3::ptr id, vm::ps3::ptr attr); -s32 sys_raw_spu_destroy(ppu_thread& ppu, u32 id); -s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, vm::ps3::ptr intrtag); -s32 sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask); -s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, vm::ps3::ptr mask); -s32 sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat); -s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, vm::ps3::ptr stat); -s32 sys_raw_spu_read_puint_mb(u32 id, vm::ps3::ptr value); -s32 sys_raw_spu_set_spu_cfg(u32 id, u32 value); -s32 sys_raw_spu_get_spu_cfg(u32 id, vm::ps3::ptr value); +error_code sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu); +error_code sys_spu_image_open(vm::ps3::ptr img, vm::ps3::cptr path); +error_code sys_spu_thread_initialize(vm::ps3::ptr thread, u32 group, u32 spu_num, vm::ps3::ptr, vm::ps3::ptr, vm::ps3::ptr); +error_code sys_spu_thread_set_argument(u32 id, vm::ps3::ptr arg); +error_code sys_spu_thread_group_create(vm::ps3::ptr id, u32 num, s32 prio, vm::ps3::ptr attr); +error_code sys_spu_thread_group_destroy(u32 id); +error_code sys_spu_thread_group_start(u32 id); +error_code sys_spu_thread_group_suspend(u32 id); +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(u32 id, vm::ps3::ptr cause, vm::ps3::ptr status); +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 spup); +error_code sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup); +error_code sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type); +error_code sys_spu_thread_read_ls(u32 id, u32 address, vm::ps3::ptr value, u32 type); +error_code sys_spu_thread_write_spu_mb(u32 id, u32 value); +error_code sys_spu_thread_set_spu_cfg(u32 id, u64 value); +error_code sys_spu_thread_get_spu_cfg(u32 id, vm::ps3::ptr value); +error_code sys_spu_thread_write_snr(u32 id, u32 number, u32 value); +error_code sys_spu_thread_connect_event(u32 id, u32 eq, u32 et, u8 spup); +error_code sys_spu_thread_disconnect_event(u32 id, u32 event_type, u8 spup); +error_code sys_spu_thread_bind_queue(u32 id, u32 spuq, u32 spuq_num); +error_code sys_spu_thread_unbind_queue(u32 id, u32 spuq_num); +error_code sys_spu_thread_get_exit_status(u32 id, vm::ps3::ptr status); + +error_code sys_raw_spu_create(vm::ps3::ptr id, vm::ps3::ptr attr); +error_code sys_raw_spu_destroy(ppu_thread& ppu, u32 id); +error_code sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, vm::ps3::ptr intrtag); +error_code sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask); +error_code sys_raw_spu_get_int_mask(u32 id, u32 class_id, vm::ps3::ptr mask); +error_code sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat); +error_code sys_raw_spu_get_int_stat(u32 id, u32 class_id, vm::ps3::ptr stat); +error_code sys_raw_spu_read_puint_mb(u32 id, vm::ps3::ptr value); +error_code sys_raw_spu_set_spu_cfg(u32 id, u32 value); +error_code sys_raw_spu_get_spu_cfg(u32 id, vm::ps3::ptr value); diff --git a/rpcs3/Emu/Cell/lv2/sys_timer.cpp b/rpcs3/Emu/Cell/lv2/sys_timer.cpp index 011da7cff9..60e88d2f3b 100644 --- a/rpcs3/Emu/Cell/lv2/sys_timer.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_timer.cpp @@ -4,6 +4,7 @@ #include "Emu/IdManager.h" #include "Emu/Cell/ErrorCodes.h" +#include "Emu/Cell/PPUThread.h" #include "sys_event.h" #include "sys_process.h" #include "sys_timer.h" @@ -277,18 +278,18 @@ error_code sys_timer_disconnect_event_queue(u32 timer_id) return CELL_OK; } -error_code sys_timer_sleep(u32 sleep_time) +error_code sys_timer_sleep(ppu_thread& ppu, u32 sleep_time) { sys_timer.trace("sys_timer_sleep(sleep_time=%d) -> sys_timer_usleep()", sleep_time); - return sys_timer_usleep(sleep_time * u64{1000000}); + return sys_timer_usleep(ppu, sleep_time * u64{1000000}); } -error_code sys_timer_usleep(u64 sleep_time) +error_code sys_timer_usleep(ppu_thread& ppu, u64 sleep_time) { sys_timer.trace("sys_timer_usleep(sleep_time=0x%llx)", sleep_time); - u64 start = get_system_time(); + u64 start = ppu.gpr[10] = get_system_time(); u64 passed = 0; // SLEEP diff --git a/rpcs3/Emu/Cell/lv2/sys_timer.h b/rpcs3/Emu/Cell/lv2/sys_timer.h index aff126af13..591c2894fb 100644 --- a/rpcs3/Emu/Cell/lv2/sys_timer.h +++ b/rpcs3/Emu/Cell/lv2/sys_timer.h @@ -36,6 +36,8 @@ struct lv2_timer final : public lv2_obj, public named_thread atomic_t period{0}; // Period (oneshot if 0) }; +class ppu_thread; + // Syscalls error_code sys_timer_create(vm::ps3::ptr timer_id); @@ -45,5 +47,5 @@ error_code _sys_timer_start(u32 timer_id, u64 basetime, u64 period); // basetime error_code sys_timer_stop(u32 timer_id); error_code sys_timer_connect_event_queue(u32 timer_id, u32 queue_id, u64 name, u64 data1, u64 data2); error_code sys_timer_disconnect_event_queue(u32 timer_id); -error_code sys_timer_sleep(u32 sleep_time); -error_code sys_timer_usleep(u64 sleep_time); +error_code sys_timer_sleep(ppu_thread&, u32 sleep_time); +error_code sys_timer_usleep(ppu_thread&, u64 sleep_time);