diff --git a/rpcs3/Emu/Cell/lv2/sys_rwlock.cpp b/rpcs3/Emu/Cell/lv2/sys_rwlock.cpp index 75205035da..5f6a76ec5c 100644 --- a/rpcs3/Emu/Cell/lv2/sys_rwlock.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_rwlock.cpp @@ -8,16 +8,16 @@ #include "Emu/Cell/ErrorCodes.h" #include "Emu/Cell/PPUThread.h" - - LOG_CHANNEL(sys_rwlock); template<> DECLARE(ipc_manager::g_ipc) {}; extern u64 get_system_time(); -error_code sys_rwlock_create(vm::ptr rw_lock_id, vm::ptr attr) +error_code sys_rwlock_create(ppu_thread& ppu, vm::ptr rw_lock_id, vm::ptr attr) { + vm::temporary_unlock(ppu); + sys_rwlock.warning("sys_rwlock_create(rw_lock_id=*0x%x, attr=*0x%x)", rw_lock_id, attr); if (!rw_lock_id || !attr) @@ -48,8 +48,10 @@ error_code sys_rwlock_create(vm::ptr rw_lock_id, vm::ptr(rw_lock_id, [](lv2_rwlock& rw) -> CellError @@ -77,6 +79,8 @@ error_code sys_rwlock_destroy(u32 rw_lock_id) error_code sys_rwlock_rlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout) { + vm::temporary_unlock(ppu); + sys_rwlock.trace("sys_rwlock_rlock(rw_lock_id=0x%x, timeout=0x%llx)", rw_lock_id, timeout); const auto rwlock = idm::get(rw_lock_id, [&](lv2_rwlock& rwlock) @@ -163,8 +167,10 @@ error_code sys_rwlock_rlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout) return not_an_error(ppu.gpr[3]); } -error_code sys_rwlock_tryrlock(u32 rw_lock_id) +error_code sys_rwlock_tryrlock(ppu_thread& ppu, u32 rw_lock_id) { + vm::temporary_unlock(ppu); + sys_rwlock.trace("sys_rwlock_tryrlock(rw_lock_id=0x%x)", rw_lock_id); const auto rwlock = idm::check(rw_lock_id, [](lv2_rwlock& rwlock) @@ -198,6 +204,8 @@ error_code sys_rwlock_tryrlock(u32 rw_lock_id) error_code sys_rwlock_runlock(ppu_thread& ppu, u32 rw_lock_id) { + vm::temporary_unlock(ppu); + sys_rwlock.trace("sys_rwlock_runlock(rw_lock_id=0x%x)", rw_lock_id); const auto rwlock = idm::get(rw_lock_id, [](lv2_rwlock& rwlock) @@ -264,6 +272,8 @@ error_code sys_rwlock_runlock(ppu_thread& ppu, u32 rw_lock_id) error_code sys_rwlock_wlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout) { + vm::temporary_unlock(ppu); + sys_rwlock.trace("sys_rwlock_wlock(rw_lock_id=0x%x, timeout=0x%llx)", rw_lock_id, timeout); const auto rwlock = idm::get(rw_lock_id, [&](lv2_rwlock& rwlock) -> s64 @@ -375,6 +385,8 @@ error_code sys_rwlock_wlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout) error_code sys_rwlock_trywlock(ppu_thread& ppu, u32 rw_lock_id) { + vm::temporary_unlock(ppu); + sys_rwlock.trace("sys_rwlock_trywlock(rw_lock_id=0x%x)", rw_lock_id); const auto rwlock = idm::check(rw_lock_id, [&](lv2_rwlock& rwlock) @@ -405,6 +417,8 @@ error_code sys_rwlock_trywlock(ppu_thread& ppu, u32 rw_lock_id) error_code sys_rwlock_wunlock(ppu_thread& ppu, u32 rw_lock_id) { + vm::temporary_unlock(ppu); + sys_rwlock.trace("sys_rwlock_wunlock(rw_lock_id=0x%x)", rw_lock_id); const auto rwlock = idm::get(rw_lock_id, [&](lv2_rwlock& rwlock) diff --git a/rpcs3/Emu/Cell/lv2/sys_rwlock.h b/rpcs3/Emu/Cell/lv2/sys_rwlock.h index a500f5cde9..a21ae592c0 100644 --- a/rpcs3/Emu/Cell/lv2/sys_rwlock.h +++ b/rpcs3/Emu/Cell/lv2/sys_rwlock.h @@ -49,10 +49,10 @@ class ppu_thread; // Syscalls -error_code sys_rwlock_create(vm::ptr rw_lock_id, vm::ptr attr); -error_code sys_rwlock_destroy(u32 rw_lock_id); +error_code sys_rwlock_create(ppu_thread& ppu, vm::ptr rw_lock_id, vm::ptr attr); +error_code sys_rwlock_destroy(ppu_thread& ppu, u32 rw_lock_id); error_code sys_rwlock_rlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout); -error_code sys_rwlock_tryrlock(u32 rw_lock_id); +error_code sys_rwlock_tryrlock(ppu_thread& ppu, u32 rw_lock_id); error_code sys_rwlock_runlock(ppu_thread& ppu, u32 rw_lock_id); error_code sys_rwlock_wlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout); error_code sys_rwlock_trywlock(ppu_thread& ppu, u32 rw_lock_id);