diff --git a/src/core/hle/kernel/k_handle_table.cpp b/src/core/hle/kernel/k_handle_table.cpp index 1c7a766c89..3535ddc0ca 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 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); diff --git a/src/core/hle/kernel/k_handle_table.h b/src/core/hle/kernel/k_handle_table.h index 65cae3b275..37a24e7d94 100644 --- a/src/core/hle/kernel/k_handle_table.h +++ b/src/core/hle/kernel/k_handle_table.h @@ -113,21 +113,7 @@ public: return this->GetObjectImpl(handle); } - KScopedAutoObject GetObjectForIpc(Handle handle, KThread* cur_thread) const { - // Handle pseudo-handles. - ASSERT(cur_thread != nullptr); - if (handle == Svc::PseudoHandle::CurrentProcess) { - auto* const cur_process = - static_cast(static_cast(cur_thread->GetOwnerProcess())); - ASSERT(cur_process != nullptr); - return cur_process; - } - if (handle == Svc::PseudoHandle::CurrentThread) { - return static_cast(cur_thread); - } - - return GetObjectForIpcWithoutPseudoHandle(handle); - } + KScopedAutoObject GetObjectForIpc(Handle handle, KThread* cur_thread) const; KScopedAutoObject GetObjectByIndex(Handle* out_handle, size_t index) const { KScopedDisableDispatch dd{m_kernel};