yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

Mutex: Revert workaround due to poor exclusive memory.

This commit is contained in:
Fernando Sahmkow 2020-03-07 19:04:02 -04:00
parent cd1c38be8d
commit 445b4342b3
1 changed files with 2 additions and 9 deletions

View File

@ -9,7 +9,6 @@
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/core.h" #include "core/core.h"
#include "core/arm/exclusive_monitor.h"
#include "core/core.h" #include "core/core.h"
#include "core/hle/kernel/errors.h" #include "core/hle/kernel/errors.h"
#include "core/hle/kernel/handle_table.h" #include "core/hle/kernel/handle_table.h"
@ -135,12 +134,8 @@ std::pair<ResultCode, std::shared_ptr<Thread>> Mutex::Unlock(std::shared_ptr<Thr
} }
auto [new_owner, num_waiters] = GetHighestPriorityMutexWaitingThread(owner, address); auto [new_owner, num_waiters] = GetHighestPriorityMutexWaitingThread(owner, address);
auto& monitor = system.Monitor();
const std::size_t current_core = system.CurrentCoreIndex();
if (new_owner == nullptr) { if (new_owner == nullptr) {
do { system.Memory().Write32(address, 0);
monitor.SetExclusive32(current_core, address);
} while (!monitor.ExclusiveWrite32(current_core, address, 0));
return {RESULT_SUCCESS, nullptr}; return {RESULT_SUCCESS, nullptr};
} }
// Transfer the ownership of the mutex from the previous owner to the new one. // Transfer the ownership of the mutex from the previous owner to the new one.
@ -154,9 +149,7 @@ std::pair<ResultCode, std::shared_ptr<Thread>> Mutex::Unlock(std::shared_ptr<Thr
new_owner->SetLockOwner(nullptr); new_owner->SetLockOwner(nullptr);
new_owner->ResumeFromWait(); new_owner->ResumeFromWait();
do { system.Memory().Write32(address, mutex_value);
monitor.SetExclusive32(current_core, address);
} while (!monitor.ExclusiveWrite32(current_core, address, mutex_value));
return {RESULT_SUCCESS, new_owner}; return {RESULT_SUCCESS, new_owner};
} }