diff options
author | Subv <subv2112@gmail.com> | 2018-01-08 14:12:03 -0500 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2018-01-08 21:12:51 -0500 |
commit | 1bbe9309daa96b5fbac7a2df5a2edcb17ab7a05c (patch) | |
tree | 71a8fc9f6ab552fb242923372238f691caa4e3d6 /src/core/hle/kernel/mutex.h | |
parent | 2a3f8e8484fca54767c9874cc21f5985d2be1463 (diff) |
Kernel: Properly keep track of mutex lock data in the guest memory. This fixes userland locking/unlocking.
Diffstat (limited to 'src/core/hle/kernel/mutex.h')
-rw-r--r-- | src/core/hle/kernel/mutex.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/core/hle/kernel/mutex.h b/src/core/hle/kernel/mutex.h index 87e3c15ee6..49b6b454e6 100644 --- a/src/core/hle/kernel/mutex.h +++ b/src/core/hle/kernel/mutex.h @@ -41,10 +41,8 @@ public: return HANDLE_TYPE; } - int lock_count; ///< Number of times the mutex has been acquired u32 priority; ///< The priority of the mutex, used for priority inheritance. std::string name; ///< Name of mutex (optional) - SharedPtr<Thread> holding_thread; ///< Thread that has acquired the mutex VAddr guest_addr; ///< Address of the guest mutex value /** @@ -66,6 +64,19 @@ public: */ ResultCode Release(Thread* thread); + /// Gets the handle to the holding process stored in the guest state. + Handle GetOwnerHandle() const; + + /// Gets the Thread pointed to by the owner handle + SharedPtr<Thread> GetHoldingThread() const; + /// Sets the holding process handle in the guest state. + void SetHoldingThread(SharedPtr<Thread> thread); + + /// Returns the has_waiters bit in the guest state. + bool GetHasWaiters() const; + /// Sets the has_waiters bit in the guest state. + void SetHasWaiters(bool has_waiters); + private: Mutex(); ~Mutex() override; @@ -79,12 +90,6 @@ private: BitField<30, 1, u32_le> has_waiters; }; static_assert(sizeof(GuestState) == 4, "GuestState size is incorrect"); - - /// Updates the state of the object tracking this mutex in guest memory - void UpdateGuestState(); - - /// Verifies the state of the object tracking this mutex in guest memory - void VerifyGuestState(); }; /** |