mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2025-06-14 05:37:57 -05:00
Kernel: Properly keep track of mutex lock data in the guest memory. This fixes userland locking/unlocking.
This commit is contained in:
@ -204,7 +204,6 @@ static ResultCode LockMutex(Handle holding_thread_handle, VAddr mutex_addr,
|
||||
SharedPtr<Thread> holding_thread = g_handle_table.Get<Thread>(holding_thread_handle);
|
||||
SharedPtr<Thread> requesting_thread = g_handle_table.Get<Thread>(requesting_thread_handle);
|
||||
|
||||
ASSERT(holding_thread);
|
||||
ASSERT(requesting_thread);
|
||||
|
||||
SharedPtr<Mutex> mutex = g_object_address_table.Get<Mutex>(mutex_addr);
|
||||
@ -214,6 +213,8 @@ static ResultCode LockMutex(Handle holding_thread_handle, VAddr mutex_addr,
|
||||
mutex->name = Common::StringFromFormat("mutex-%llx", mutex_addr);
|
||||
}
|
||||
|
||||
ASSERT(holding_thread == mutex->GetHoldingThread());
|
||||
|
||||
return WaitSynchronization1(mutex, requesting_thread.get());
|
||||
}
|
||||
|
||||
@ -491,6 +492,8 @@ static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr semaphore_add
|
||||
mutex->name = Common::StringFromFormat("mutex-%llx", mutex_addr);
|
||||
}
|
||||
|
||||
ASSERT(mutex->GetOwnerHandle() == thread_handle);
|
||||
|
||||
SharedPtr<Semaphore> semaphore = g_object_address_table.Get<Semaphore>(semaphore_addr);
|
||||
if (!semaphore) {
|
||||
// Create a new semaphore for the specified address if one does not already exist
|
||||
|
Reference in New Issue
Block a user