sys_spu diag

This commit is contained in:
Nekotekina 2017-02-05 15:48:11 +03:00
parent cb1f30e9d2
commit 11b0b6958f
14 changed files with 99 additions and 92 deletions

View file

@ -17,6 +17,8 @@
logs::channel cellSpurs("cellSpurs", logs::level::notice); logs::channel cellSpurs("cellSpurs", logs::level::notice);
s32 sys_spu_image_close(vm::ptr<sys_spu_image_t> img);
// TODO // TODO
struct cell_error_t struct cell_error_t
{ {

View file

@ -43,6 +43,8 @@
#include "Modules/cellMsgDialog.h" #include "Modules/cellMsgDialog.h"
#endif #endif
extern u64 get_system_time();
namespace vm { using namespace ps3; } namespace vm { using namespace ps3; }
enum class ppu_decoder_type enum class ppu_decoder_type
@ -374,7 +376,7 @@ void ppu_thread::fast_call(u32 addr, u32 rtoc)
} }
catch (EmulationStopped) 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; last_function = old_func;
throw; throw;
} }

View file

@ -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); 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<lv2_obj, lv2_cond>(cond_id, [&](lv2_cond& cond) const auto cond = idm::get<lv2_obj, lv2_cond>(cond_id, [&](lv2_cond& cond)
{ {

View file

@ -222,7 +222,7 @@ error_code sys_event_queue_receive(ppu_thread& ppu, u32 equeue_id, vm::ptr<sys_e
{ {
sys_event.trace("sys_event_queue_receive(equeue_id=0x%x, *0x%x, timeout=0x%llx)", equeue_id, dummy_event, timeout); sys_event.trace("sys_event_queue_receive(equeue_id=0x%x, *0x%x, timeout=0x%llx)", equeue_id, dummy_event, timeout);
const u64 start_time = get_system_time(); const u64 start_time = ppu.gpr[10] = get_system_time();
const auto queue = idm::get<lv2_obj, lv2_event_queue>(equeue_id, [&](lv2_event_queue& queue) -> CellError const auto queue = idm::get<lv2_obj, lv2_event_queue>(equeue_id, [&](lv2_event_queue& queue) -> CellError
{ {

View file

@ -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); 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 // Fix function arguments for external access
ppu.gpr[4] = bitptn; ppu.gpr[4] = bitptn;

View file

@ -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); 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<lv2_lwmutex> mutex; std::shared_ptr<lv2_lwmutex> mutex;

View file

@ -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); 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<lv2_obj, lv2_lwmutex>(lwmutex_id, [&](lv2_lwmutex& mutex) const auto mutex = idm::get<lv2_obj, lv2_lwmutex>(lwmutex_id, [&](lv2_lwmutex& mutex)
{ {

View file

@ -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); 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<lv2_obj, lv2_mutex>(mutex_id, [&](lv2_mutex& mutex) const auto mutex = idm::get<lv2_obj, lv2_mutex>(mutex_id, [&](lv2_mutex& mutex)
{ {

View file

@ -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); 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<lv2_obj, lv2_rwlock>(rw_lock_id, [&](lv2_rwlock& rwlock) const auto rwlock = idm::get<lv2_obj, lv2_rwlock>(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); 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<lv2_obj, lv2_rwlock>(rw_lock_id, [&](lv2_rwlock& rwlock) const auto rwlock = idm::get<lv2_obj, lv2_rwlock>(rw_lock_id, [&](lv2_rwlock& rwlock)
{ {

View file

@ -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); 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<lv2_obj, lv2_sema>(sem_id, [&](lv2_sema& sema) const auto sem = idm::get<lv2_obj, lv2_sema>(sem_id, [&](lv2_sema& sema)
{ {

View file

@ -44,7 +44,7 @@ u32 LoadSpuImage(const fs::file& stream, u32& spu_ep)
return spu_offset; 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); 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; return CELL_OK;
} }
s32 sys_spu_image_open(vm::ptr<sys_spu_image_t> img, vm::cptr<char> path) error_code sys_spu_image_open(vm::ptr<sys_spu_image_t> img, vm::cptr<char> path)
{ {
sys_spu.warning("sys_spu_image_open(img=*0x%x, path=%s)", img, 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<sys_spu_image_t> img, vm::cptr<char> path)
return CELL_OK; return CELL_OK;
} }
s32 sys_spu_thread_initialize(vm::ptr<u32> thread, u32 group_id, u32 spu_num, vm::ptr<sys_spu_image_t> img, vm::ptr<sys_spu_thread_attribute> attr, vm::ptr<sys_spu_thread_argument> arg) error_code sys_spu_thread_initialize(vm::ptr<u32> thread, u32 group_id, u32 spu_num, vm::ptr<sys_spu_image_t> img, vm::ptr<sys_spu_thread_attribute> attr, vm::ptr<sys_spu_thread_argument> 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); 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<u32> thread, u32 group_id, u32 spu_num, vm
return CELL_OK; return CELL_OK;
} }
s32 sys_spu_thread_set_argument(u32 id, vm::ptr<sys_spu_thread_argument> arg) error_code sys_spu_thread_set_argument(u32 id, vm::ptr<sys_spu_thread_argument> arg)
{ {
sys_spu.warning("sys_spu_thread_set_argument(id=0x%x, arg=*0x%x)", id, 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<sys_spu_thread_argument> arg)
return CELL_OK; return CELL_OK;
} }
s32 sys_spu_thread_get_exit_status(u32 id, vm::ptr<u32> status) error_code sys_spu_thread_get_exit_status(u32 id, vm::ptr<u32> status)
{ {
sys_spu.warning("sys_spu_thread_get_exit_status(id=0x%x, status=*0x%x)", id, 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<u32> status)
return CELL_OK; return CELL_OK;
} }
s32 sys_spu_thread_group_create(vm::ptr<u32> id, u32 num, s32 prio, vm::ptr<sys_spu_thread_group_attribute> attr) error_code sys_spu_thread_group_create(vm::ptr<u32> id, u32 num, s32 prio, vm::ptr<sys_spu_thread_group_attribute> attr)
{ {
sys_spu.warning("sys_spu_thread_group_create(id=*0x%x, num=%d, prio=%d, attr=*0x%x)", id, num, prio, 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<u32> id, u32 num, s32 prio, vm::ptr<sys_
return CELL_OK; return CELL_OK;
} }
s32 sys_spu_thread_group_destroy(u32 id) error_code sys_spu_thread_group_destroy(u32 id)
{ {
sys_spu.warning("sys_spu_thread_group_destroy(id=0x%x)", id); sys_spu.warning("sys_spu_thread_group_destroy(id=0x%x)", id);
@ -235,7 +235,7 @@ s32 sys_spu_thread_group_destroy(u32 id)
return CELL_OK; return CELL_OK;
} }
s32 sys_spu_thread_group_start(u32 id) error_code sys_spu_thread_group_start(u32 id)
{ {
sys_spu.warning("sys_spu_thread_group_start(id=0x%x)", id); sys_spu.warning("sys_spu_thread_group_start(id=0x%x)", id);
@ -296,7 +296,7 @@ s32 sys_spu_thread_group_start(u32 id)
return CELL_OK; return CELL_OK;
} }
s32 sys_spu_thread_group_suspend(u32 id) error_code sys_spu_thread_group_suspend(u32 id)
{ {
sys_spu.trace("sys_spu_thread_group_suspend(id=0x%x)", id); sys_spu.trace("sys_spu_thread_group_suspend(id=0x%x)", id);
@ -349,7 +349,7 @@ s32 sys_spu_thread_group_suspend(u32 id)
return CELL_OK; return CELL_OK;
} }
s32 sys_spu_thread_group_resume(u32 id) error_code sys_spu_thread_group_resume(u32 id)
{ {
sys_spu.trace("sys_spu_thread_group_resume(id=0x%x)", id); sys_spu.trace("sys_spu_thread_group_resume(id=0x%x)", id);
@ -394,7 +394,7 @@ s32 sys_spu_thread_group_resume(u32 id)
return CELL_OK; return CELL_OK;
} }
s32 sys_spu_thread_group_yield(u32 id) error_code sys_spu_thread_group_yield(u32 id)
{ {
sys_spu.trace("sys_spu_thread_group_yield(id=0x%x)", id); sys_spu.trace("sys_spu_thread_group_yield(id=0x%x)", id);
@ -420,7 +420,7 @@ s32 sys_spu_thread_group_yield(u32 id)
return CELL_OK; return CELL_OK;
} }
s32 sys_spu_thread_group_terminate(u32 id, s32 value) error_code sys_spu_thread_group_terminate(u32 id, s32 value)
{ {
sys_spu.warning("sys_spu_thread_group_terminate(id=0x%x, value=0x%x)", id, value); sys_spu.warning("sys_spu_thread_group_terminate(id=0x%x, value=0x%x)", id, value);
@ -479,7 +479,7 @@ s32 sys_spu_thread_group_terminate(u32 id, s32 value)
return CELL_OK; return CELL_OK;
} }
s32 sys_spu_thread_group_join(u32 id, vm::ptr<u32> cause, vm::ptr<u32> status) error_code sys_spu_thread_group_join(u32 id, vm::ptr<u32> cause, vm::ptr<u32> status)
{ {
sys_spu.warning("sys_spu_thread_group_join(id=0x%x, cause=*0x%x, status=*0x%x)", id, cause, 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<u32> cause, vm::ptr<u32> status)
return CELL_OK; 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); 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; return CELL_OK;
} }
s32 sys_spu_thread_read_ls(u32 id, u32 lsa, vm::ptr<u64> value, u32 type) error_code sys_spu_thread_read_ls(u32 id, u32 lsa, vm::ptr<u64> 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); 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<u64> value, u32 type)
return CELL_OK; 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); 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; 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); 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; return CELL_OK;
} }
s32 sys_spu_thread_get_spu_cfg(u32 id, vm::ptr<u64> value) error_code sys_spu_thread_get_spu_cfg(u32 id, vm::ptr<u64> value)
{ {
sys_spu.warning("sys_spu_thread_get_spu_cfg(id=0x%x, value=*0x%x)", id, 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<u64> value)
return CELL_OK; 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); 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; 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); 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; 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); 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; 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); 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; 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); 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; 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); 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; 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); 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; return CELL_ESRCH;
} }
s32 sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq, u64 req, vm::ptr<u8> spup) error_code sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq, u64 req, vm::ptr<u8> 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); 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; 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); 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; return CELL_OK;
} }
s32 sys_raw_spu_create(vm::ptr<u32> id, vm::ptr<void> attr) error_code sys_raw_spu_create(vm::ptr<u32> id, vm::ptr<void> attr)
{ {
sys_spu.warning("sys_raw_spu_create(id=*0x%x, attr=*0x%x)", id, 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<u32> id, vm::ptr<void> attr)
return CELL_OK; 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); 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; return CELL_OK;
} }
s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, vm::ptr<u32> intrtag) error_code sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, vm::ptr<u32> 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); 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; 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); 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; return CELL_OK;
} }
s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, vm::ptr<u64> mask) error_code sys_raw_spu_get_int_mask(u32 id, u32 class_id, vm::ptr<u64> mask)
{ {
sys_spu.trace("sys_raw_spu_get_int_mask(id=%d, class_id=%d, mask=*0x%x)", id, class_id, 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<u64> mask)
return CELL_OK; 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); 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; return CELL_OK;
} }
s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, vm::ptr<u64> stat) error_code sys_raw_spu_get_int_stat(u32 id, u32 class_id, vm::ptr<u64> stat)
{ {
sys_spu.trace("sys_raw_spu_get_int_stat(id=%d, class_id=%d, stat=*0x%x)", id, class_id, 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<u64> stat)
return CELL_OK; return CELL_OK;
} }
s32 sys_raw_spu_read_puint_mb(u32 id, vm::ptr<u32> value) error_code sys_raw_spu_read_puint_mb(u32 id, vm::ptr<u32> value)
{ {
sys_spu.trace("sys_raw_spu_read_puint_mb(id=%d, value=*0x%x)", id, 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<u32> value)
return CELL_OK; 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); 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; return CELL_OK;
} }
s32 sys_raw_spu_get_spu_cfg(u32 id, vm::ptr<u32> value) error_code sys_raw_spu_get_spu_cfg(u32 id, vm::ptr<u32> value)
{ {
sys_spu.trace("sys_raw_spu_get_spu_afg(id=%d, value=*0x%x)", id, value); sys_spu.trace("sys_raw_spu_get_spu_afg(id=%d, value=*0x%x)", id, value);

View file

@ -208,43 +208,43 @@ class ppu_thread;
void LoadSpuImage(const fs::file& stream, u32& spu_ep, u32 addr); void LoadSpuImage(const fs::file& stream, u32& spu_ep, u32 addr);
u32 LoadSpuImage(const fs::file& stream, u32& spu_ep); u32 LoadSpuImage(const fs::file& stream, u32& spu_ep);
// SysCalls // Syscalls
s32 sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu);
s32 sys_spu_image_open(vm::ps3::ptr<sys_spu_image_t> img, vm::ps3::cptr<char> path);
s32 sys_spu_image_close(vm::ps3::ptr<sys_spu_image_t> img);
s32 sys_spu_thread_initialize(vm::ps3::ptr<u32> thread, u32 group, u32 spu_num, vm::ps3::ptr<sys_spu_image_t> img, vm::ps3::ptr<sys_spu_thread_attribute> attr, vm::ps3::ptr<sys_spu_thread_argument> arg);
s32 sys_spu_thread_set_argument(u32 id, vm::ps3::ptr<sys_spu_thread_argument> arg);
s32 sys_spu_thread_group_create(vm::ps3::ptr<u32> id, u32 num, s32 prio, vm::ps3::ptr<sys_spu_thread_group_attribute> 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<u32> cause, vm::ps3::ptr<u32> 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<u8> 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<u64> 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<u64> 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<u32> status);
s32 sys_raw_spu_create(vm::ps3::ptr<u32> id, vm::ps3::ptr<void> attr); error_code sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu);
s32 sys_raw_spu_destroy(ppu_thread& ppu, u32 id); error_code sys_spu_image_open(vm::ps3::ptr<sys_spu_image_t> img, vm::ps3::cptr<char> path);
s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, vm::ps3::ptr<u32> intrtag); error_code sys_spu_thread_initialize(vm::ps3::ptr<u32> thread, u32 group, u32 spu_num, vm::ps3::ptr<sys_spu_image_t>, vm::ps3::ptr<sys_spu_thread_attribute>, vm::ps3::ptr<sys_spu_thread_argument>);
s32 sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask); error_code sys_spu_thread_set_argument(u32 id, vm::ps3::ptr<sys_spu_thread_argument> arg);
s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, vm::ps3::ptr<u64> mask); error_code sys_spu_thread_group_create(vm::ps3::ptr<u32> id, u32 num, s32 prio, vm::ps3::ptr<sys_spu_thread_group_attribute> attr);
s32 sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat); error_code sys_spu_thread_group_destroy(u32 id);
s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, vm::ps3::ptr<u64> stat); error_code sys_spu_thread_group_start(u32 id);
s32 sys_raw_spu_read_puint_mb(u32 id, vm::ps3::ptr<u32> value); error_code sys_spu_thread_group_suspend(u32 id);
s32 sys_raw_spu_set_spu_cfg(u32 id, u32 value); error_code sys_spu_thread_group_resume(u32 id);
s32 sys_raw_spu_get_spu_cfg(u32 id, vm::ps3::ptr<u32> value); 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<u32> cause, vm::ps3::ptr<u32> 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<u8> 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<u64> 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<u64> 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<u32> status);
error_code sys_raw_spu_create(vm::ps3::ptr<u32> id, vm::ps3::ptr<void> 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<u32> 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<u64> 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<u64> stat);
error_code sys_raw_spu_read_puint_mb(u32 id, vm::ps3::ptr<u32> 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<u32> value);

View file

@ -4,6 +4,7 @@
#include "Emu/IdManager.h" #include "Emu/IdManager.h"
#include "Emu/Cell/ErrorCodes.h" #include "Emu/Cell/ErrorCodes.h"
#include "Emu/Cell/PPUThread.h"
#include "sys_event.h" #include "sys_event.h"
#include "sys_process.h" #include "sys_process.h"
#include "sys_timer.h" #include "sys_timer.h"
@ -277,18 +278,18 @@ error_code sys_timer_disconnect_event_queue(u32 timer_id)
return CELL_OK; 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); 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); 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; u64 passed = 0;
// SLEEP // SLEEP

View file

@ -36,6 +36,8 @@ struct lv2_timer final : public lv2_obj, public named_thread
atomic_t<u64> period{0}; // Period (oneshot if 0) atomic_t<u64> period{0}; // Period (oneshot if 0)
}; };
class ppu_thread;
// Syscalls // Syscalls
error_code sys_timer_create(vm::ps3::ptr<u32> timer_id); error_code sys_timer_create(vm::ps3::ptr<u32> 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_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_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_disconnect_event_queue(u32 timer_id);
error_code sys_timer_sleep(u32 sleep_time); error_code sys_timer_sleep(ppu_thread&, u32 sleep_time);
error_code sys_timer_usleep(u64 sleep_time); error_code sys_timer_usleep(ppu_thread&, u64 sleep_time);