summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-01-09 21:02:04 +0100
committerSubv <subv2112@gmail.com>2018-01-09 21:02:04 +0100
commitbc91ebacc1810db003d4a87cb595e0d07fc14000 (patch)
tree63ad470353220d39274ec0446f534e7f2e871827 /src/core
parentErrorCodes: Updated the InvalidHandle and Timeout kernel error codes. (diff)
downloadyuzu-bc91ebacc1810db003d4a87cb595e0d07fc14000.tar
yuzu-bc91ebacc1810db003d4a87cb595e0d07fc14000.tar.gz
yuzu-bc91ebacc1810db003d4a87cb595e0d07fc14000.tar.bz2
yuzu-bc91ebacc1810db003d4a87cb595e0d07fc14000.tar.lz
yuzu-bc91ebacc1810db003d4a87cb595e0d07fc14000.tar.xz
yuzu-bc91ebacc1810db003d4a87cb595e0d07fc14000.tar.zst
yuzu-bc91ebacc1810db003d4a87cb595e0d07fc14000.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/kernel/errors.h2
-rw-r--r--src/core/hle/kernel/svc.cpp18
2 files changed, 19 insertions, 1 deletions
diff --git a/src/core/hle/kernel/errors.h b/src/core/hle/kernel/errors.h
index c963d7e9a..3b7b6f7a9 100644
--- a/src/core/hle/kernel/errors.h
+++ b/src/core/hle/kernel/errors.h
@@ -22,6 +22,8 @@ enum {
// Confirmed Switch OS error codes
InvalidHandle = 114,
Timeout = 117,
+ SynchronizationCanceled = 118,
+ TooLarge = 119,
};
}
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
return WaitSynchronization1(objects[0], GetCurrentThread(), nano_seconds);
}
+/// Resumes a thread waiting on WaitSynchronization
+static ResultCode CancelSynchronization(Handle thread_handle) {
+ LOG_TRACE(Kernel_SVC, "called thread=0x%08X", thread_handle);
+
+ const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle);
+ if (!thread) {
+ return ERR_INVALID_HANDLE;
+ }
+
+ ASSERT(thread->status == THREADSTATUS_WAIT_SYNCH_ANY);
+ thread->SetWaitSynchronizationResult(
+ ResultCode(ErrorModule::Kernel, ErrCodes::SynchronizationCanceled));
+ thread->ResumeFromWait();
+ return RESULT_SUCCESS;
+}
+
/// Attempts to locks a mutex, creating it if it does not already exist
static ResultCode LockMutex(Handle holding_thread_handle, VAddr mutex_addr,
Handle requesting_thread_handle) {
@@ -646,7 +662,7 @@ static const FunctionDef SVC_Table[] = {
{0x16, SvcWrap<CloseHandle>, "CloseHandle"},
{0x17, nullptr, "ResetSignal"},
{0x18, SvcWrap<WaitSynchronization>, "WaitSynchronization"},
- {0x19, nullptr, "CancelSynchronization"},
+ {0x19, SvcWrap<CancelSynchronization>, "CancelSynchronization"},
{0x1A, SvcWrap<LockMutex>, "LockMutex"},
{0x1B, SvcWrap<UnlockMutex>, "UnlockMutex"},
{0x1C, SvcWrap<WaitProcessWideKeyAtomic>, "WaitProcessWideKeyAtomic"},