summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2022-11-22 13:43:53 -0500
committerGravatar Lioncash2022-11-22 13:58:42 -0500
commit8d99aae45b04f1a70cad90e6fdc7ff91aee57edc (patch)
tree4a004b735d08ee3181a478a33facc7bb87887643 /src
parentMerge pull request #9292 from Morph1984/amiibo-web-service (diff)
downloadyuzu-8d99aae45b04f1a70cad90e6fdc7ff91aee57edc.tar.gz
yuzu-8d99aae45b04f1a70cad90e6fdc7ff91aee57edc.tar.xz
yuzu-8d99aae45b04f1a70cad90e6fdc7ff91aee57edc.zip
k_handle_table: Remove cast to void* in GetObjectForIpc
This was used to get around the KProcess class being incomplete. We can just move this to the cpp file and eliminate the cast entirely, letting the compiler do its work.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/k_handle_table.cpp17
-rw-r--r--src/core/hle/kernel/k_handle_table.h16
2 files changed, 18 insertions, 15 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 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/hle/kernel/k_handle_table.h" 4#include "core/hle/kernel/k_handle_table.h"
5#include "core/hle/kernel/k_process.h"
5 6
6namespace Kernel { 7namespace Kernel {
7 8
@@ -82,6 +83,22 @@ Result KHandleTable::Add(Handle* out_handle, KAutoObject* obj) {
82 R_SUCCEED(); 83 R_SUCCEED();
83} 84}
84 85
86KScopedAutoObject<KAutoObject> KHandleTable::GetObjectForIpc(Handle handle,
87 KThread* cur_thread) const {
88 // Handle pseudo-handles.
89 ASSERT(cur_thread != nullptr);
90 if (handle == Svc::PseudoHandle::CurrentProcess) {
91 auto* const cur_process = cur_thread->GetOwnerProcess();
92 ASSERT(cur_process != nullptr);
93 return cur_process;
94 }
95 if (handle == Svc::PseudoHandle::CurrentThread) {
96 return cur_thread;
97 }
98
99 return GetObjectForIpcWithoutPseudoHandle(handle);
100}
101
85Result KHandleTable::Reserve(Handle* out_handle) { 102Result KHandleTable::Reserve(Handle* out_handle) {
86 KScopedDisableDispatch dd{m_kernel}; 103 KScopedDisableDispatch dd{m_kernel};
87 KScopedSpinLock lk(m_lock); 104 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 65cae3b27..37a24e7d9 100644
--- a/src/core/hle/kernel/k_handle_table.h
+++ b/src/core/hle/kernel/k_handle_table.h
@@ -113,21 +113,7 @@ public:
113 return this->GetObjectImpl(handle); 113 return this->GetObjectImpl(handle);
114 } 114 }
115 115
116 KScopedAutoObject<KAutoObject> GetObjectForIpc(Handle handle, KThread* cur_thread) const { 116 KScopedAutoObject<KAutoObject> GetObjectForIpc(Handle handle, KThread* cur_thread) const;
117 // Handle pseudo-handles.
118 ASSERT(cur_thread != nullptr);
119 if (handle == Svc::PseudoHandle::CurrentProcess) {
120 auto* const cur_process =
121 static_cast<KAutoObject*>(static_cast<void*>(cur_thread->GetOwnerProcess()));
122 ASSERT(cur_process != nullptr);
123 return cur_process;
124 }
125 if (handle == Svc::PseudoHandle::CurrentThread) {
126 return static_cast<KAutoObject*>(cur_thread);
127 }
128
129 return GetObjectForIpcWithoutPseudoHandle(handle);
130 }
131 117
132 KScopedAutoObject<KAutoObject> GetObjectByIndex(Handle* out_handle, size_t index) const { 118 KScopedAutoObject<KAutoObject> GetObjectByIndex(Handle* out_handle, size_t index) const {
133 KScopedDisableDispatch dd{m_kernel}; 119 KScopedDisableDispatch dd{m_kernel};