summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/k_handle_table.cpp
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2022-11-22 23:47:53 +0100
committerGitHub <noreply@github.com>2022-11-22 23:47:53 +0100
commit168c9ee3415bf6400ef0b0cc0eb2dfa73fac2464 (patch)
tree135fb961ff5f842da81a1f06e2835ed8e49b5e25 /src/core/hle/kernel/k_handle_table.cpp
parentMerge pull request #9219 from german77/nfc_impl (diff)
parentk_handle_table: Remove cast to void* in GetObjectForIpc (diff)
downloadyuzu-168c9ee3415bf6400ef0b0cc0eb2dfa73fac2464.tar
yuzu-168c9ee3415bf6400ef0b0cc0eb2dfa73fac2464.tar.gz
yuzu-168c9ee3415bf6400ef0b0cc0eb2dfa73fac2464.tar.bz2
yuzu-168c9ee3415bf6400ef0b0cc0eb2dfa73fac2464.tar.lz
yuzu-168c9ee3415bf6400ef0b0cc0eb2dfa73fac2464.tar.xz
yuzu-168c9ee3415bf6400ef0b0cc0eb2dfa73fac2464.tar.zst
yuzu-168c9ee3415bf6400ef0b0cc0eb2dfa73fac2464.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/k_handle_table.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/hle/kernel/k_handle_table.cpp b/src/core/hle/kernel/k_handle_table.cpp
index 1c7a766c8..3535ddc0c 100644
--- a/src/core/hle/kernel/k_handle_table.cpp
+++ b/src/core/hle/kernel/k_handle_table.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/kernel/k_handle_table.h"
+#include "core/hle/kernel/k_process.h"
namespace Kernel {
@@ -82,6 +83,22 @@ Result KHandleTable::Add(Handle* out_handle, KAutoObject* obj) {
R_SUCCEED();
}
+KScopedAutoObject<KAutoObject> KHandleTable::GetObjectForIpc(Handle handle,
+ KThread* cur_thread) const {
+ // Handle pseudo-handles.
+ ASSERT(cur_thread != nullptr);
+ if (handle == Svc::PseudoHandle::CurrentProcess) {
+ auto* const cur_process = cur_thread->GetOwnerProcess();
+ ASSERT(cur_process != nullptr);
+ return cur_process;
+ }
+ if (handle == Svc::PseudoHandle::CurrentThread) {
+ return cur_thread;
+ }
+
+ return GetObjectForIpcWithoutPseudoHandle(handle);
+}
+
Result KHandleTable::Reserve(Handle* out_handle) {
KScopedDisableDispatch dd{m_kernel};
KScopedSpinLock lk(m_lock);