diff --git a/rpcs3/Emu/Cell/lv2/sys_timer.cpp b/rpcs3/Emu/Cell/lv2/sys_timer.cpp index 989b3e207f..f11cd262a1 100644 --- a/rpcs3/Emu/Cell/lv2/sys_timer.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_timer.cpp @@ -67,8 +67,10 @@ void lv2_timer_context::on_abort() state = -1; } -error_code sys_timer_create(vm::ptr timer_id) +error_code sys_timer_create(ppu_thread& ppu, vm::ptr timer_id) { + vm::temporary_unlock(ppu); + sys_timer.warning("sys_timer_create(timer_id=*0x%x)", timer_id); if (const u32 id = idm::make("Timer Thread")) @@ -80,8 +82,10 @@ error_code sys_timer_create(vm::ptr timer_id) return CELL_EAGAIN; } -error_code sys_timer_destroy(u32 timer_id) +error_code sys_timer_destroy(ppu_thread& ppu, u32 timer_id) { + vm::temporary_unlock(ppu); + sys_timer.warning("sys_timer_destroy(timer_id=0x%x)", timer_id); const auto timer = idm::withdraw(timer_id, [&](lv2_timer& timer) -> CellError @@ -109,8 +113,10 @@ error_code sys_timer_destroy(u32 timer_id) return CELL_OK; } -error_code sys_timer_get_information(u32 timer_id, vm::ptr info) +error_code sys_timer_get_information(ppu_thread& ppu, u32 timer_id, vm::ptr info) { + vm::temporary_unlock(ppu); + sys_timer.trace("sys_timer_get_information(timer_id=0x%x, info=*0x%x)", timer_id, info); const auto timer = idm::check(timer_id, [&](lv2_timer& timer) @@ -130,8 +136,10 @@ error_code sys_timer_get_information(u32 timer_id, vm::ptr(timer_id, [](lv2_timer& timer) @@ -204,8 +214,10 @@ error_code sys_timer_stop(u32 timer_id) return CELL_OK; } -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(ppu_thread& ppu, u32 timer_id, u32 queue_id, u64 name, u64 data1, u64 data2) { + vm::temporary_unlock(ppu); + sys_timer.warning("sys_timer_connect_event_queue(timer_id=0x%x, queue_id=0x%x, name=0x%llx, data1=0x%llx, data2=0x%llx)", timer_id, queue_id, name, data1, data2); const auto timer = idm::check(timer_id, [&](lv2_timer& timer) -> CellError @@ -245,8 +257,10 @@ error_code sys_timer_connect_event_queue(u32 timer_id, u32 queue_id, u64 name, u return CELL_OK; } -error_code sys_timer_disconnect_event_queue(u32 timer_id) +error_code sys_timer_disconnect_event_queue(ppu_thread& ppu, u32 timer_id) { + vm::temporary_unlock(ppu); + sys_timer.warning("sys_timer_disconnect_event_queue(timer_id=0x%x)", timer_id); const auto timer = idm::check(timer_id, [](lv2_timer& timer) -> CellError @@ -322,7 +336,7 @@ error_code sys_timer_usleep(ppu_thread& ppu, u64 sleep_time) // Do not wait for the last quantum to avoid loss of accuracy thread_ctrl::wait_for(remaining - ((remaining % host_min_quantum) + host_min_quantum)); #else - // Wait on multiple of min quantum for large durations to avoid overloading low thread cpus + // Wait on multiple of min quantum for large durations to avoid overloading low thread cpus thread_ctrl::wait_for(remaining - (remaining % host_min_quantum)); #endif } diff --git a/rpcs3/Emu/Cell/lv2/sys_timer.h b/rpcs3/Emu/Cell/lv2/sys_timer.h index 142da7444d..0de1f4ade4 100644 --- a/rpcs3/Emu/Cell/lv2/sys_timer.h +++ b/rpcs3/Emu/Cell/lv2/sys_timer.h @@ -46,12 +46,12 @@ class ppu_thread; // Syscalls -error_code sys_timer_create(vm::ptr timer_id); -error_code sys_timer_destroy(u32 timer_id); -error_code sys_timer_get_information(u32 timer_id, vm::ptr info); -error_code _sys_timer_start(u32 timer_id, u64 basetime, u64 period); // basetime type changed from s64 -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_create(ppu_thread&, vm::ptr timer_id); +error_code sys_timer_destroy(ppu_thread&, u32 timer_id); +error_code sys_timer_get_information(ppu_thread&, u32 timer_id, vm::ptr info); +error_code _sys_timer_start(ppu_thread&, u32 timer_id, u64 basetime, u64 period); // basetime type changed from s64 +error_code sys_timer_stop(ppu_thread&, u32 timer_id); +error_code sys_timer_connect_event_queue(ppu_thread&, u32 timer_id, u32 queue_id, u64 name, u64 data1, u64 data2); +error_code sys_timer_disconnect_event_queue(ppu_thread&, u32 timer_id); error_code sys_timer_sleep(ppu_thread&, u32 sleep_time); error_code sys_timer_usleep(ppu_thread&, u64 sleep_time);