diff options
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 699d842fd..74643f598 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -520,8 +520,27 @@ static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr semaphore_add | |||
| 520 | } | 520 | } |
| 521 | 521 | ||
| 522 | /// Signal process wide key | 522 | /// Signal process wide key |
| 523 | static ResultCode SignalProcessWideKey(VAddr addr, u32 target) { | 523 | static ResultCode SignalProcessWideKey(VAddr semaphore_addr, s32 target) { |
| 524 | LOG_WARNING(Kernel_SVC, "(STUBBED) called, address=0x%llx, target=0x%08x", addr, target); | 524 | LOG_TRACE(Kernel_SVC, "called, semaphore_addr=0x%llx, target=0x%08x", semaphore_addr, target); |
| 525 | |||
| 526 | // Wakeup all or one thread - Any other value is unimplemented | ||
| 527 | ASSERT(target == -1 || target == 1); | ||
| 528 | |||
| 529 | SharedPtr<Semaphore> semaphore = g_object_address_table.Get<Semaphore>(semaphore_addr); | ||
| 530 | if (!semaphore) { | ||
| 531 | // Create a new semaphore for the specified address if one does not already exist | ||
| 532 | semaphore = Semaphore::Create(semaphore_addr).Unwrap(); | ||
| 533 | semaphore->name = Common::StringFromFormat("semaphore-%llx", semaphore_addr); | ||
| 534 | } | ||
| 535 | |||
| 536 | CASCADE_CODE(semaphore->Release(target)); | ||
| 537 | |||
| 538 | if (semaphore->mutex_addr) { | ||
| 539 | // If a mutex was created for this semaphore, wait the current thread on it | ||
| 540 | SharedPtr<Mutex> mutex = g_object_address_table.Get<Mutex>(semaphore->mutex_addr); | ||
| 541 | return WaitSynchronization1(mutex, GetCurrentThread()); | ||
| 542 | } | ||
| 543 | |||
| 525 | return RESULT_SUCCESS; | 544 | return RESULT_SUCCESS; |
| 526 | } | 545 | } |
| 527 | 546 | ||