Kernel/SVC: Don't let svcReleaseMutex release a mutex owned by another thread.

This behavior was reverse engineered from the 3DS kernel.
This commit is contained in:
Subv 2017-10-23 15:52:23 -05:00
parent ceb9880034
commit 68dba11805
4 changed files with 39 additions and 18 deletions

View file

@ -8,6 +8,7 @@
#include "common/common_types.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/wait_object.h"
#include "core/hle/result.h"
namespace Kernel {
@ -52,7 +53,12 @@ public:
void AddWaitingThread(SharedPtr<Thread> thread) override;
void RemoveWaitingThread(Thread* thread) override;
void Release();
/**
* Attempts to release the mutex from the specified thread.
* @param thread Thread that wants to release the mutex.
* @returns The result code of the operation.
*/
ResultCode Release(Thread* thread);
private:
Mutex();
@ -65,4 +71,4 @@ private:
*/
void ReleaseThreadMutexes(Thread* thread);
} // namespace
} // namespace Kernel