diff --git a/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp b/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp index 68c6ffdf88..008845e5c0 100644 --- a/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp @@ -10,16 +10,16 @@ #include - - LOG_CHANNEL(sys_event_flag); template<> DECLARE(ipc_manager::g_ipc) {}; extern u64 get_system_time(); -error_code sys_event_flag_create(vm::ptr id, vm::ptr attr, u64 init) +error_code sys_event_flag_create(ppu_thread& ppu, vm::ptr id, vm::ptr attr, u64 init) { + vm::temporary_unlock(ppu); + sys_event_flag.warning("sys_event_flag_create(id=*0x%x, attr=*0x%x, init=0x%llx)", id, attr, init); if (!id || !attr) @@ -62,8 +62,10 @@ error_code sys_event_flag_create(vm::ptr id, vm::ptr(id, [&](lv2_event_flag& flag) -> CellError @@ -91,6 +93,8 @@ error_code sys_event_flag_destroy(u32 id) error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm::ptr result, u64 timeout) { + vm::temporary_unlock(ppu); + 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); // Fix function arguments for external access @@ -202,8 +206,10 @@ error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm return not_an_error(ppu.gpr[3]); } -error_code sys_event_flag_trywait(u32 id, u64 bitptn, u32 mode, vm::ptr result) +error_code sys_event_flag_trywait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm::ptr result) { + vm::temporary_unlock(ppu); + sys_event_flag.trace("sys_event_flag_trywait(id=0x%x, bitptn=0x%llx, mode=0x%x, result=*0x%x)", id, bitptn, mode, result); if (result) *result = 0; @@ -240,6 +246,8 @@ error_code sys_event_flag_trywait(u32 id, u64 bitptn, u32 mode, vm::ptr res error_code sys_event_flag_set(u32 id, u64 bitptn) { + vm::temporary_unlock(); + // Warning: may be called from SPU thread. sys_event_flag.trace("sys_event_flag_set(id=0x%x, bitptn=0x%llx)", id, bitptn); @@ -321,8 +329,10 @@ error_code sys_event_flag_set(u32 id, u64 bitptn) return CELL_OK; } -error_code sys_event_flag_clear(u32 id, u64 bitptn) +error_code sys_event_flag_clear(ppu_thread& ppu, u32 id, u64 bitptn) { + vm::temporary_unlock(ppu); + sys_event_flag.trace("sys_event_flag_clear(id=0x%x, bitptn=0x%llx)", id, bitptn); const auto flag = idm::check(id, [&](lv2_event_flag& flag) @@ -340,6 +350,8 @@ error_code sys_event_flag_clear(u32 id, u64 bitptn) error_code sys_event_flag_cancel(ppu_thread& ppu, u32 id, vm::ptr num) { + vm::temporary_unlock(ppu); + sys_event_flag.trace("sys_event_flag_cancel(id=0x%x, num=*0x%x)", id, num); if (num) *num = 0; @@ -383,8 +395,10 @@ error_code sys_event_flag_cancel(ppu_thread& ppu, u32 id, vm::ptr num) return CELL_OK; } -error_code sys_event_flag_get(u32 id, vm::ptr flags) +error_code sys_event_flag_get(ppu_thread& ppu, u32 id, vm::ptr flags) { + vm::temporary_unlock(ppu); + sys_event_flag.trace("sys_event_flag_get(id=0x%x, flags=*0x%x)", id, flags); if (!flags) diff --git a/rpcs3/Emu/Cell/lv2/sys_event_flag.h b/rpcs3/Emu/Cell/lv2/sys_event_flag.h index 4bca382522..e36d244c15 100644 --- a/rpcs3/Emu/Cell/lv2/sys_event_flag.h +++ b/rpcs3/Emu/Cell/lv2/sys_event_flag.h @@ -114,11 +114,11 @@ class ppu_thread; // Syscalls -error_code sys_event_flag_create(vm::ptr id, vm::ptr attr, u64 init); -error_code sys_event_flag_destroy(u32 id); +error_code sys_event_flag_create(ppu_thread& ppu, vm::ptr id, vm::ptr attr, u64 init); +error_code sys_event_flag_destroy(ppu_thread& ppu, u32 id); error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm::ptr result, u64 timeout); -error_code sys_event_flag_trywait(u32 id, u64 bitptn, u32 mode, vm::ptr result); +error_code sys_event_flag_trywait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm::ptr result); error_code sys_event_flag_set(u32 id, u64 bitptn); -error_code sys_event_flag_clear(u32 id, u64 bitptn); +error_code sys_event_flag_clear(ppu_thread& ppu, u32 id, u64 bitptn); error_code sys_event_flag_cancel(ppu_thread& ppu, u32 id, vm::ptr num); -error_code sys_event_flag_get(u32 id, vm::ptr flags); +error_code sys_event_flag_get(ppu_thread& ppu, u32 id, vm::ptr flags);