summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/mutex.cpp
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2020-03-07 18:59:42 -0400
committerGravatar Fernando Sahmkow2020-06-27 11:35:37 -0400
commitcd1c38be8d15d3caf52f566a9e8dc20504c61068 (patch)
tree2fed02ffd4f2151dfca14ddb33ef1939eaee2fba /src/core/hle/kernel/mutex.cpp
parentSVC: WaitSynchronization add Termination Pending Result. (diff)
downloadyuzu-cd1c38be8d15d3caf52f566a9e8dc20504c61068.tar.gz
yuzu-cd1c38be8d15d3caf52f566a9e8dc20504c61068.tar.xz
yuzu-cd1c38be8d15d3caf52f566a9e8dc20504c61068.zip
ARM/Memory: Correct Exclusive Monitor and Implement Exclusive Memory Writes.
Diffstat (limited to 'src/core/hle/kernel/mutex.cpp')
-rw-r--r--src/core/hle/kernel/mutex.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp
index ebe3f6050..16c95782a 100644
--- a/src/core/hle/kernel/mutex.cpp
+++ b/src/core/hle/kernel/mutex.cpp
@@ -10,6 +10,7 @@
10#include "common/logging/log.h" 10#include "common/logging/log.h"
11#include "core/core.h" 11#include "core/core.h"
12#include "core/arm/exclusive_monitor.h" 12#include "core/arm/exclusive_monitor.h"
13#include "core/core.h"
13#include "core/hle/kernel/errors.h" 14#include "core/hle/kernel/errors.h"
14#include "core/hle/kernel/handle_table.h" 15#include "core/hle/kernel/handle_table.h"
15#include "core/hle/kernel/kernel.h" 16#include "core/hle/kernel/kernel.h"
@@ -138,7 +139,7 @@ std::pair<ResultCode, std::shared_ptr<Thread>> Mutex::Unlock(std::shared_ptr<Thr
138 const std::size_t current_core = system.CurrentCoreIndex(); 139 const std::size_t current_core = system.CurrentCoreIndex();
139 if (new_owner == nullptr) { 140 if (new_owner == nullptr) {
140 do { 141 do {
141 monitor.SetExclusive(current_core, address); 142 monitor.SetExclusive32(current_core, address);
142 } while (!monitor.ExclusiveWrite32(current_core, address, 0)); 143 } while (!monitor.ExclusiveWrite32(current_core, address, 0));
143 return {RESULT_SUCCESS, nullptr}; 144 return {RESULT_SUCCESS, nullptr};
144 } 145 }
@@ -154,7 +155,7 @@ std::pair<ResultCode, std::shared_ptr<Thread>> Mutex::Unlock(std::shared_ptr<Thr
154 new_owner->ResumeFromWait(); 155 new_owner->ResumeFromWait();
155 156
156 do { 157 do {
157 monitor.SetExclusive(current_core, address); 158 monitor.SetExclusive32(current_core, address);
158 } while (!monitor.ExclusiveWrite32(current_core, address, mutex_value)); 159 } while (!monitor.ExclusiveWrite32(current_core, address, mutex_value));
159 return {RESULT_SUCCESS, new_owner}; 160 return {RESULT_SUCCESS, new_owner};
160} 161}