diff --git a/rpcs3/Emu/Cell/lv2/sys_rsx.cpp b/rpcs3/Emu/Cell/lv2/sys_rsx.cpp index 042867af4d..596d8c1399 100644 --- a/rpcs3/Emu/Cell/lv2/sys_rsx.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_rsx.cpp @@ -204,8 +204,8 @@ error_code sys_rsx_context_allocate(vm::ptr context_id, vm::ptr lpar_d for (int i = 0; i < 256; ++i) { reports.semaphore[i].val = 0x1337C0D3; - reports.semaphore[i].pad = 0x1337BABE; - reports.semaphore[i].timestamp = -1; // technically different but should be fine + reports.semaphore[i].zero = 0x1337BABE; + reports.semaphore[i].zero2 = 0x1337BEEF1337F001; } for (int i = 0; i < 2048; ++i) diff --git a/rpcs3/Emu/Cell/lv2/sys_rsx.h b/rpcs3/Emu/Cell/lv2/sys_rsx.h index 6e4285f62e..308a71cb05 100644 --- a/rpcs3/Emu/Cell/lv2/sys_rsx.h +++ b/rpcs3/Emu/Cell/lv2/sys_rsx.h @@ -87,8 +87,8 @@ struct RsxDmaControl struct alignas(16) RsxSemaphore { be_t val; - be_t pad; - be_t timestamp; + be_t zero; + be_t zero2; }; struct alignas(16) RsxNotify diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index 31ac692104..27e44b40cc 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -126,7 +126,7 @@ namespace rsx { rsx->sync(); - const u32 offset = method_registers.semaphore_offset_406e(); + const u32 offset = method_registers.semaphore_offset_406e() & -16; const u32 ctxt = method_registers.semaphore_context_dma_406e(); // By avoiding doing this on flip's semaphore release @@ -139,15 +139,19 @@ namespace rsx const u32 addr = get_address(offset, ctxt, HERE); - if (g_use_rtm) [[likely]] + atomic_t* res{}; + + // TODO: Check if possible to write on reservations + if (!g_use_rtm && rsx->label_addr >> 28 != addr >> 28) [[likely]] { - vm::_ref>(addr) = arg; + res = &vm::reservation_lock(addr, 4); } - else + + vm::_ref>(addr).store({arg, 0, 0}); + + if (res) { - auto& res = vm::reservation_lock(addr, 4); - vm::write32(addr, arg); - res &= -128; + res->release(*res & -128); } vm::reservation_notifier(addr, 4).notify_all(); @@ -226,7 +230,7 @@ namespace rsx { arg, 0, - rsx->timestamp() + 0 }); } @@ -242,7 +246,7 @@ namespace rsx { val, 0, - rsx->timestamp() + 0 }); }