From 2b721b9e29f60c31053a10be78bba90085f714dc Mon Sep 17 00:00:00 2001 From: Eladash Date: Sun, 21 Jul 2019 03:30:14 +0400 Subject: [PATCH] correctness fix Not that it really matters because of gcm's lwmutex but just in case the syscall is useb directly. --- rpcs3/Emu/Cell/lv2/sys_rsx.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/Cell/lv2/sys_rsx.cpp b/rpcs3/Emu/Cell/lv2/sys_rsx.cpp index e70e338870..06e2b48abd 100644 --- a/rpcs3/Emu/Cell/lv2/sys_rsx.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_rsx.cpp @@ -14,6 +14,8 @@ LOG_CHANNEL(sys_rsx); extern u64 get_timebased_time(); +static shared_mutex s_rsxmem_mtx; + u64 rsxTimeStamp() { return get_timebased_time(); @@ -194,6 +196,8 @@ error_code sys_rsx_context_iomap(u32 context_id, u32 io, u32 ea, u32 size, u64 f io >>= 20, ea >>= 20, size >>= 20; + std::scoped_lock lock(s_rsxmem_mtx); + for (u32 i = 0; i < size; i++) { RSXIOMem.io[ea + i].raw() = io + i; @@ -218,6 +222,8 @@ error_code sys_rsx_context_iounmap(u32 context_id, u32 io, u32 size) return CELL_EINVAL; } + std::scoped_lock lock(s_rsxmem_mtx); + const u32 end = (io >>= 20) + (size >>= 20); while (io < end) @@ -226,7 +232,6 @@ error_code sys_rsx_context_iounmap(u32 context_id, u32 io, u32 size) if (ea_entry < 512) RSXIOMem.io[ea_entry].raw() = 0xFFFF; } - std::atomic_thread_fence(std::memory_order_seq_cst); return CELL_OK; }