summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorGravatar Subv2018-01-09 15:02:04 -0500
committerGravatar Subv2018-01-09 15:02:04 -0500
commitbc91ebacc1810db003d4a87cb595e0d07fc14000 (patch)
tree63ad470353220d39274ec0446f534e7f2e871827 /src/core/hle/kernel/svc.cpp
parentErrorCodes: Updated the InvalidHandle and Timeout kernel error codes. (diff)
downloadyuzu-bc91ebacc1810db003d4a87cb595e0d07fc14000.tar.gz
yuzu-bc91ebacc1810db003d4a87cb595e0d07fc14000.tar.xz
yuzu-bc91ebacc1810db003d4a87cb595e0d07fc14000.zip
SVC: Implemented CancelSynchronization.
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index c3280bfa3..b7cad2248 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -216,6 +216,22 @@ static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64
216 return WaitSynchronization1(objects[0], GetCurrentThread(), nano_seconds); 216 return WaitSynchronization1(objects[0], GetCurrentThread(), nano_seconds);
217} 217}
218 218
219/// Resumes a thread waiting on WaitSynchronization
220static ResultCode CancelSynchronization(Handle thread_handle) {
221 LOG_TRACE(Kernel_SVC, "called thread=0x%08X", thread_handle);
222
223 const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle);
224 if (!thread) {
225 return ERR_INVALID_HANDLE;
226 }
227
228 ASSERT(thread->status == THREADSTATUS_WAIT_SYNCH_ANY);
229 thread->SetWaitSynchronizationResult(
230 ResultCode(ErrorModule::Kernel, ErrCodes::SynchronizationCanceled));
231 thread->ResumeFromWait();
232 return RESULT_SUCCESS;
233}
234
219/// Attempts to locks a mutex, creating it if it does not already exist 235/// Attempts to locks a mutex, creating it if it does not already exist
220static ResultCode LockMutex(Handle holding_thread_handle, VAddr mutex_addr, 236static ResultCode LockMutex(Handle holding_thread_handle, VAddr mutex_addr,
221 Handle requesting_thread_handle) { 237 Handle requesting_thread_handle) {
@@ -646,7 +662,7 @@ static const FunctionDef SVC_Table[] = {
646 {0x16, SvcWrap<CloseHandle>, "CloseHandle"}, 662 {0x16, SvcWrap<CloseHandle>, "CloseHandle"},
647 {0x17, nullptr, "ResetSignal"}, 663 {0x17, nullptr, "ResetSignal"},
648 {0x18, SvcWrap<WaitSynchronization>, "WaitSynchronization"}, 664 {0x18, SvcWrap<WaitSynchronization>, "WaitSynchronization"},
649 {0x19, nullptr, "CancelSynchronization"}, 665 {0x19, SvcWrap<CancelSynchronization>, "CancelSynchronization"},
650 {0x1A, SvcWrap<LockMutex>, "LockMutex"}, 666 {0x1A, SvcWrap<LockMutex>, "LockMutex"},
651 {0x1B, SvcWrap<UnlockMutex>, "UnlockMutex"}, 667 {0x1B, SvcWrap<UnlockMutex>, "UnlockMutex"},
652 {0x1C, SvcWrap<WaitProcessWideKeyAtomic>, "WaitProcessWideKeyAtomic"}, 668 {0x1C, SvcWrap<WaitProcessWideKeyAtomic>, "WaitProcessWideKeyAtomic"},