From a6bce296ad3fa8e7da66df3d32cd148448ac0abb Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Wed, 4 Mar 2020 22:46:22 -0400 Subject: [PATCH] Mutex: Correct Result writting to clear exclusivity. --- src/core/hle/kernel/mutex.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 18325db57..ebe3f6050 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -9,6 +9,7 @@ #include "common/assert.h" #include "common/logging/log.h" #include "core/core.h" +#include "core/arm/exclusive_monitor.h" #include "core/hle/kernel/errors.h" #include "core/hle/kernel/handle_table.h" #include "core/hle/kernel/kernel.h" @@ -133,8 +134,12 @@ std::pair> Mutex::Unlock(std::shared_ptr> Mutex::Unlock(std::shared_ptrSetSynchronizationResults(nullptr, RESULT_SUCCESS); - new_owner->ResumeFromWait(); new_owner->SetLockOwner(nullptr); - system.Memory().Write32(address, mutex_value); + new_owner->ResumeFromWait(); + + do { + monitor.SetExclusive(current_core, address); + } while (!monitor.ExclusiveWrite32(current_core, address, mutex_value)); return {RESULT_SUCCESS, new_owner}; }