From 492ed2749501020c9fdf3f8c3cee0675d995b141 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Thu, 15 Oct 2020 20:43:08 +0300 Subject: [PATCH] RSX: fix rsx::nv406e::semaphore_release partially Properly release reservation (non-TSX path). At least update and notify reservation (TSX). --- rpcs3/Emu/RSX/rsx_methods.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index 991a045f1d..68ec9ec259 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -147,21 +147,33 @@ namespace rsx const u32 addr = get_address(offset, ctxt, HERE); atomic_t* res{}; + bool upd = false; // TODO: Check if possible to write on reservations - if (!g_use_rtm && rsx->label_addr >> 28 != addr >> 28) [[likely]] + if (rsx->label_addr >> 28 != addr >> 28) { - res = &vm::reservation_lock(addr).first; + if (g_use_rtm) + { + upd = true; + } + else + { + res = &vm::reservation_lock(addr).first; + } } vm::_ref(addr).val = arg; if (res) { - res += 64; + res->fetch_add(64); + res->notify_all(); + } + else if (upd) + { + // TODO: simply writing semaphore from RSX thread is wrong on TSX path + vm::reservation_update(addr); } - - vm::reservation_notifier(addr, 4).notify_all(); } }