summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/kernel/k_server_session.cpp3
-rw-r--r--src/core/hle/service/am/am.cpp6
-rw-r--r--src/core/hle/service/audio/audren_u.cpp6
-rw-r--r--src/core/hle/service/audio/hwopus.cpp16
-rw-r--r--src/core/hle/service/hid/hid_server.cpp9
-rw-r--r--src/core/hle/service/hid/hidbus.cpp3
-rw-r--r--src/core/hle/service/hid/irs.cpp6
-rw-r--r--src/core/hle/service/hle_ipc.cpp20
-rw-r--r--src/core/hle/service/hle_ipc.h16
-rw-r--r--src/core/hle/service/jit/jit.cpp12
-rw-r--r--src/core/hle/service/ro/ro.cpp12
-rw-r--r--src/core/hle/service/service.cpp2
12 files changed, 45 insertions, 66 deletions
diff --git a/src/core/hle/kernel/k_server_session.cpp b/src/core/hle/kernel/k_server_session.cpp
index f6ca3dc48..adaabdd6d 100644
--- a/src/core/hle/kernel/k_server_session.cpp
+++ b/src/core/hle/kernel/k_server_session.cpp
@@ -1147,8 +1147,7 @@ Result KServerSession::ReceiveRequest(uintptr_t server_message, uintptr_t server
1147 *out_context = 1147 *out_context =
1148 std::make_shared<Service::HLERequestContext>(m_kernel, memory, this, client_thread); 1148 std::make_shared<Service::HLERequestContext>(m_kernel, memory, this, client_thread);
1149 (*out_context)->SetSessionRequestManager(manager); 1149 (*out_context)->SetSessionRequestManager(manager);
1150 (*out_context) 1150 (*out_context)->PopulateFromIncomingCommandBuffer(cmd_buf);
1151 ->PopulateFromIncomingCommandBuffer(*client_thread->GetOwnerProcess(), cmd_buf);
1152 // We succeeded. 1151 // We succeeded.
1153 R_SUCCEED(); 1152 R_SUCCEED();
1154 } else { 1153 } else {
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index a266d7c21..dabec1119 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -1513,8 +1513,7 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(HLERequestContext& ctx)
1513 return; 1513 return;
1514 } 1514 }
1515 1515
1516 auto transfer_mem = 1516 auto transfer_mem = ctx.GetObjectFromHandle<Kernel::KTransferMemory>(handle);
1517 system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(handle);
1518 1517
1519 if (transfer_mem.IsNull()) { 1518 if (transfer_mem.IsNull()) {
1520 LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle); 1519 LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle);
@@ -1547,8 +1546,7 @@ void ILibraryAppletCreator::CreateHandleStorage(HLERequestContext& ctx) {
1547 return; 1546 return;
1548 } 1547 }
1549 1548
1550 auto transfer_mem = 1549 auto transfer_mem = ctx.GetObjectFromHandle<Kernel::KTransferMemory>(handle);
1551 system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(handle);
1552 1550
1553 if (transfer_mem.IsNull()) { 1551 if (transfer_mem.IsNull()) {
1554 LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle); 1552 LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle);
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index 23e56c77a..bd4ca753b 100644
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -454,10 +454,8 @@ void AudRenU::OpenAudioRenderer(HLERequestContext& ctx) {
454 return; 454 return;
455 } 455 }
456 456
457 const auto& handle_table{system.ApplicationProcess()->GetHandleTable()}; 457 auto process{ctx.GetObjectFromHandle<Kernel::KProcess>(process_handle)};
458 auto process{handle_table.GetObject<Kernel::KProcess>(process_handle)}; 458 auto transfer_memory{ctx.GetObjectFromHandle<Kernel::KTransferMemory>(transfer_memory_handle)};
459 auto transfer_memory{
460 process->GetHandleTable().GetObject<Kernel::KTransferMemory>(transfer_memory_handle)};
461 459
462 const auto session_id{impl->GetSessionId()}; 460 const auto session_id{impl->GetSessionId()};
463 if (session_id == -1) { 461 if (session_id == -1) {
diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp
index 6a7bf9416..91f33aabd 100644
--- a/src/core/hle/service/audio/hwopus.cpp
+++ b/src/core/hle/service/audio/hwopus.cpp
@@ -278,9 +278,7 @@ void HwOpus::OpenHardwareOpusDecoder(HLERequestContext& ctx) {
278 auto params = rp.PopRaw<OpusParameters>(); 278 auto params = rp.PopRaw<OpusParameters>();
279 auto transfer_memory_size{rp.Pop<u32>()}; 279 auto transfer_memory_size{rp.Pop<u32>()};
280 auto transfer_memory_handle{ctx.GetCopyHandle(0)}; 280 auto transfer_memory_handle{ctx.GetCopyHandle(0)};
281 auto transfer_memory{ 281 auto transfer_memory{ctx.GetObjectFromHandle<Kernel::KTransferMemory>(transfer_memory_handle)};
282 system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
283 transfer_memory_handle)};
284 282
285 LOG_DEBUG(Service_Audio, "sample_rate {} channel_count {} transfer_memory_size 0x{:X}", 283 LOG_DEBUG(Service_Audio, "sample_rate {} channel_count {} transfer_memory_size 0x{:X}",
286 params.sample_rate, params.channel_count, transfer_memory_size); 284 params.sample_rate, params.channel_count, transfer_memory_size);
@@ -323,9 +321,7 @@ void HwOpus::OpenHardwareOpusDecoderForMultiStream(HLERequestContext& ctx) {
323 321
324 auto transfer_memory_size{rp.Pop<u32>()}; 322 auto transfer_memory_size{rp.Pop<u32>()};
325 auto transfer_memory_handle{ctx.GetCopyHandle(0)}; 323 auto transfer_memory_handle{ctx.GetCopyHandle(0)};
326 auto transfer_memory{ 324 auto transfer_memory{ctx.GetObjectFromHandle<Kernel::KTransferMemory>(transfer_memory_handle)};
327 system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
328 transfer_memory_handle)};
329 325
330 LOG_DEBUG(Service_Audio, 326 LOG_DEBUG(Service_Audio,
331 "sample_rate {} channel_count {} total_stream_count {} stereo_stream_count {} " 327 "sample_rate {} channel_count {} total_stream_count {} stereo_stream_count {} "
@@ -374,9 +370,7 @@ void HwOpus::OpenHardwareOpusDecoderEx(HLERequestContext& ctx) {
374 auto params = rp.PopRaw<OpusParametersEx>(); 370 auto params = rp.PopRaw<OpusParametersEx>();
375 auto transfer_memory_size{rp.Pop<u32>()}; 371 auto transfer_memory_size{rp.Pop<u32>()};
376 auto transfer_memory_handle{ctx.GetCopyHandle(0)}; 372 auto transfer_memory_handle{ctx.GetCopyHandle(0)};
377 auto transfer_memory{ 373 auto transfer_memory{ctx.GetObjectFromHandle<Kernel::KTransferMemory>(transfer_memory_handle)};
378 system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
379 transfer_memory_handle)};
380 374
381 LOG_DEBUG(Service_Audio, "sample_rate {} channel_count {} transfer_memory_size 0x{:X}", 375 LOG_DEBUG(Service_Audio, "sample_rate {} channel_count {} transfer_memory_size 0x{:X}",
382 params.sample_rate, params.channel_count, transfer_memory_size); 376 params.sample_rate, params.channel_count, transfer_memory_size);
@@ -414,9 +408,7 @@ void HwOpus::OpenHardwareOpusDecoderForMultiStreamEx(HLERequestContext& ctx) {
414 408
415 auto transfer_memory_size{rp.Pop<u32>()}; 409 auto transfer_memory_size{rp.Pop<u32>()};
416 auto transfer_memory_handle{ctx.GetCopyHandle(0)}; 410 auto transfer_memory_handle{ctx.GetCopyHandle(0)};
417 auto transfer_memory{ 411 auto transfer_memory{ctx.GetObjectFromHandle<Kernel::KTransferMemory>(transfer_memory_handle)};
418 system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
419 transfer_memory_handle)};
420 412
421 LOG_DEBUG(Service_Audio, 413 LOG_DEBUG(Service_Audio,
422 "sample_rate {} channel_count {} total_stream_count {} stereo_stream_count {} " 414 "sample_rate {} channel_count {} total_stream_count {} stereo_stream_count {} "
diff --git a/src/core/hle/service/hid/hid_server.cpp b/src/core/hle/service/hid/hid_server.cpp
index 06a01c02c..3174672af 100644
--- a/src/core/hle/service/hid/hid_server.cpp
+++ b/src/core/hle/service/hid/hid_server.cpp
@@ -1850,8 +1850,7 @@ void IHidServer::InitializeSevenSixAxisSensor(HLERequestContext& ctx) {
1850 ASSERT_MSG(t_mem_1_size == 0x1000, "t_mem_1_size is not 0x1000 bytes"); 1850 ASSERT_MSG(t_mem_1_size == 0x1000, "t_mem_1_size is not 0x1000 bytes");
1851 ASSERT_MSG(t_mem_2_size == 0x7F000, "t_mem_2_size is not 0x7F000 bytes"); 1851 ASSERT_MSG(t_mem_2_size == 0x7F000, "t_mem_2_size is not 0x7F000 bytes");
1852 1852
1853 auto t_mem_1 = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>( 1853 auto t_mem_1 = ctx.GetObjectFromHandle<Kernel::KTransferMemory>(t_mem_1_handle);
1854 t_mem_1_handle);
1855 1854
1856 if (t_mem_1.IsNull()) { 1855 if (t_mem_1.IsNull()) {
1857 LOG_ERROR(Service_HID, "t_mem_1 is a nullptr for handle=0x{:08X}", t_mem_1_handle); 1856 LOG_ERROR(Service_HID, "t_mem_1 is a nullptr for handle=0x{:08X}", t_mem_1_handle);
@@ -1860,8 +1859,7 @@ void IHidServer::InitializeSevenSixAxisSensor(HLERequestContext& ctx) {
1860 return; 1859 return;
1861 } 1860 }
1862 1861
1863 auto t_mem_2 = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>( 1862 auto t_mem_2 = ctx.GetObjectFromHandle<Kernel::KTransferMemory>(t_mem_2_handle);
1864 t_mem_2_handle);
1865 1863
1866 if (t_mem_2.IsNull()) { 1864 if (t_mem_2.IsNull()) {
1867 LOG_ERROR(Service_HID, "t_mem_2 is a nullptr for handle=0x{:08X}", t_mem_2_handle); 1865 LOG_ERROR(Service_HID, "t_mem_2 is a nullptr for handle=0x{:08X}", t_mem_2_handle);
@@ -2142,8 +2140,7 @@ void IHidServer::WritePalmaWaveEntry(HLERequestContext& ctx) {
2142 2140
2143 ASSERT_MSG(t_mem_size == 0x3000, "t_mem_size is not 0x3000 bytes"); 2141 ASSERT_MSG(t_mem_size == 0x3000, "t_mem_size is not 0x3000 bytes");
2144 2142
2145 auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>( 2143 auto t_mem = ctx.GetObjectFromHandle<Kernel::KTransferMemory>(t_mem_handle);
2146 t_mem_handle);
2147 2144
2148 if (t_mem.IsNull()) { 2145 if (t_mem.IsNull()) {
2149 LOG_ERROR(Service_HID, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle); 2146 LOG_ERROR(Service_HID, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle);
diff --git a/src/core/hle/service/hid/hidbus.cpp b/src/core/hle/service/hid/hidbus.cpp
index 80aac221b..d12f9beb0 100644
--- a/src/core/hle/service/hid/hidbus.cpp
+++ b/src/core/hle/service/hid/hidbus.cpp
@@ -448,8 +448,7 @@ void HidBus::EnableJoyPollingReceiveMode(HLERequestContext& ctx) {
448 448
449 ASSERT_MSG(t_mem_size == 0x1000, "t_mem_size is not 0x1000 bytes"); 449 ASSERT_MSG(t_mem_size == 0x1000, "t_mem_size is not 0x1000 bytes");
450 450
451 auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>( 451 auto t_mem = ctx.GetObjectFromHandle<Kernel::KTransferMemory>(t_mem_handle);
452 t_mem_handle);
453 452
454 if (t_mem.IsNull()) { 453 if (t_mem.IsNull()) {
455 LOG_ERROR(Service_HID, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle); 454 LOG_ERROR(Service_HID, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle);
diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp
index 39b9a4474..008debfd1 100644
--- a/src/core/hle/service/hid/irs.cpp
+++ b/src/core/hle/service/hid/irs.cpp
@@ -197,8 +197,7 @@ void IRS::RunImageTransferProcessor(HLERequestContext& ctx) {
197 const auto parameters{rp.PopRaw<Parameters>()}; 197 const auto parameters{rp.PopRaw<Parameters>()};
198 const auto t_mem_handle{ctx.GetCopyHandle(0)}; 198 const auto t_mem_handle{ctx.GetCopyHandle(0)};
199 199
200 auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>( 200 auto t_mem = ctx.GetObjectFromHandle<Kernel::KTransferMemory>(t_mem_handle);
201 t_mem_handle);
202 201
203 if (t_mem.IsNull()) { 202 if (t_mem.IsNull()) {
204 LOG_ERROR(Service_IRS, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle); 203 LOG_ERROR(Service_IRS, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle);
@@ -444,8 +443,7 @@ void IRS::RunImageTransferExProcessor(HLERequestContext& ctx) {
444 const auto parameters{rp.PopRaw<Parameters>()}; 443 const auto parameters{rp.PopRaw<Parameters>()};
445 const auto t_mem_handle{ctx.GetCopyHandle(0)}; 444 const auto t_mem_handle{ctx.GetCopyHandle(0)};
446 445
447 auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>( 446 auto t_mem = ctx.GetObjectFromHandle<Kernel::KTransferMemory>(t_mem_handle);
448 t_mem_handle);
449 447
450 LOG_INFO(Service_IRS, 448 LOG_INFO(Service_IRS,
451 "called, npad_type={}, npad_id={}, transfer_memory_size={}, " 449 "called, npad_type={}, npad_id={}, transfer_memory_size={}, "
diff --git a/src/core/hle/service/hle_ipc.cpp b/src/core/hle/service/hle_ipc.cpp
index 38955932c..39df77e43 100644
--- a/src/core/hle/service/hle_ipc.cpp
+++ b/src/core/hle/service/hle_ipc.cpp
@@ -146,10 +146,7 @@ HLERequestContext::HLERequestContext(Kernel::KernelCore& kernel_, Core::Memory::
146 146
147HLERequestContext::~HLERequestContext() = default; 147HLERequestContext::~HLERequestContext() = default;
148 148
149void HLERequestContext::ParseCommandBuffer(Kernel::KProcess& process, u32_le* src_cmdbuf, 149void HLERequestContext::ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming) {
150 bool incoming) {
151 client_handle_table = &process.GetHandleTable();
152
153 IPC::RequestParser rp(src_cmdbuf); 150 IPC::RequestParser rp(src_cmdbuf);
154 command_header = rp.PopRaw<IPC::CommandHeader>(); 151 command_header = rp.PopRaw<IPC::CommandHeader>();
155 152
@@ -162,7 +159,7 @@ void HLERequestContext::ParseCommandBuffer(Kernel::KProcess& process, u32_le* sr
162 if (command_header->enable_handle_descriptor) { 159 if (command_header->enable_handle_descriptor) {
163 handle_descriptor_header = rp.PopRaw<IPC::HandleDescriptorHeader>(); 160 handle_descriptor_header = rp.PopRaw<IPC::HandleDescriptorHeader>();
164 if (handle_descriptor_header->send_current_pid) { 161 if (handle_descriptor_header->send_current_pid) {
165 pid = process.GetProcessId(); 162 pid = thread->GetOwnerProcess()->GetProcessId();
166 rp.Skip(2, false); 163 rp.Skip(2, false);
167 } 164 }
168 if (incoming) { 165 if (incoming) {
@@ -270,9 +267,10 @@ void HLERequestContext::ParseCommandBuffer(Kernel::KProcess& process, u32_le* sr
270 rp.Skip(1, false); // The command is actually an u64, but we don't use the high part. 267 rp.Skip(1, false); // The command is actually an u64, but we don't use the high part.
271} 268}
272 269
273Result HLERequestContext::PopulateFromIncomingCommandBuffer(Kernel::KProcess& process, 270Result HLERequestContext::PopulateFromIncomingCommandBuffer(u32_le* src_cmdbuf) {
274 u32_le* src_cmdbuf) { 271 client_handle_table = &thread->GetOwnerProcess()->GetHandleTable();
275 ParseCommandBuffer(process, src_cmdbuf, true); 272
273 ParseCommandBuffer(src_cmdbuf, true);
276 274
277 if (command_header->IsCloseCommand()) { 275 if (command_header->IsCloseCommand()) {
278 // Close does not populate the rest of the IPC header 276 // Close does not populate the rest of the IPC header
@@ -284,9 +282,9 @@ Result HLERequestContext::PopulateFromIncomingCommandBuffer(Kernel::KProcess& pr
284 return ResultSuccess; 282 return ResultSuccess;
285} 283}
286 284
287Result HLERequestContext::WriteToOutgoingCommandBuffer(Kernel::KThread& requesting_thread) { 285Result HLERequestContext::WriteToOutgoingCommandBuffer() {
288 auto current_offset = handles_offset; 286 auto current_offset = handles_offset;
289 auto& owner_process = *requesting_thread.GetOwnerProcess(); 287 auto& owner_process = *thread->GetOwnerProcess();
290 auto& handle_table = owner_process.GetHandleTable(); 288 auto& handle_table = owner_process.GetHandleTable();
291 289
292 for (auto& object : outgoing_copy_objects) { 290 for (auto& object : outgoing_copy_objects) {
@@ -319,7 +317,7 @@ Result HLERequestContext::WriteToOutgoingCommandBuffer(Kernel::KThread& requesti
319 } 317 }
320 318
321 // Copy the translated command buffer back into the thread's command buffer area. 319 // Copy the translated command buffer back into the thread's command buffer area.
322 memory.WriteBlock(requesting_thread.GetTlsAddress(), cmd_buf.data(), write_size * sizeof(u32)); 320 memory.WriteBlock(thread->GetTlsAddress(), cmd_buf.data(), write_size * sizeof(u32));
323 321
324 return ResultSuccess; 322 return ResultSuccess;
325} 323}
diff --git a/src/core/hle/service/hle_ipc.h b/src/core/hle/service/hle_ipc.h
index 18d464c63..69a3cce36 100644
--- a/src/core/hle/service/hle_ipc.h
+++ b/src/core/hle/service/hle_ipc.h
@@ -17,6 +17,7 @@
17#include "common/concepts.h" 17#include "common/concepts.h"
18#include "common/swap.h" 18#include "common/swap.h"
19#include "core/hle/ipc.h" 19#include "core/hle/ipc.h"
20#include "core/hle/kernel/k_handle_table.h"
20#include "core/hle/kernel/svc_common.h" 21#include "core/hle/kernel/svc_common.h"
21 22
22union Result; 23union Result;
@@ -196,10 +197,10 @@ public:
196 } 197 }
197 198
198 /// Populates this context with data from the requesting process/thread. 199 /// Populates this context with data from the requesting process/thread.
199 Result PopulateFromIncomingCommandBuffer(Kernel::KProcess& process, u32_le* src_cmdbuf); 200 Result PopulateFromIncomingCommandBuffer(u32_le* src_cmdbuf);
200 201
201 /// Writes data from this context back to the requesting process/thread. 202 /// Writes data from this context back to the requesting process/thread.
202 Result WriteToOutgoingCommandBuffer(Kernel::KThread& requesting_thread); 203 Result WriteToOutgoingCommandBuffer();
203 204
204 [[nodiscard]] u32_le GetHipcCommand() const { 205 [[nodiscard]] u32_le GetHipcCommand() const {
205 return command; 206 return command;
@@ -359,8 +360,13 @@ public:
359 return *thread; 360 return *thread;
360 } 361 }
361 362
362 Kernel::KHandleTable& GetClientHandleTable() { 363 template <typename T>
363 return *client_handle_table; 364 Kernel::KScopedAutoObject<T> GetObjectFromHandle(u32 handle) {
365 auto obj = client_handle_table->GetObjectForIpc(handle, thread);
366 if (obj.IsNotNull()) {
367 return obj->DynamicCast<T*>();
368 }
369 return nullptr;
364 } 370 }
365 371
366 [[nodiscard]] std::shared_ptr<SessionRequestManager> GetManager() const { 372 [[nodiscard]] std::shared_ptr<SessionRequestManager> GetManager() const {
@@ -378,7 +384,7 @@ public:
378private: 384private:
379 friend class IPC::ResponseBuilder; 385 friend class IPC::ResponseBuilder;
380 386
381 void ParseCommandBuffer(Kernel::KProcess& process, u32_le* src_cmdbuf, bool incoming); 387 void ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming);
382 388
383 std::array<u32, IPC::COMMAND_BUFFER_LENGTH> cmd_buf; 389 std::array<u32, IPC::COMMAND_BUFFER_LENGTH> cmd_buf;
384 Kernel::KServerSession* server_session{}; 390 Kernel::KServerSession* server_session{};
diff --git a/src/core/hle/service/jit/jit.cpp b/src/core/hle/service/jit/jit.cpp
index 65851fc05..8648c76fa 100644
--- a/src/core/hle/service/jit/jit.cpp
+++ b/src/core/hle/service/jit/jit.cpp
@@ -188,7 +188,7 @@ public:
188 return; 188 return;
189 } 189 }
190 190
191 auto tmem{process->GetHandleTable().GetObject<Kernel::KTransferMemory>(tmem_handle)}; 191 auto tmem{ctx.GetObjectFromHandle<Kernel::KTransferMemory>(tmem_handle)};
192 if (tmem.IsNull()) { 192 if (tmem.IsNull()) {
193 LOG_ERROR(Service_JIT, "attempted to load plugin with invalid transfer memory handle"); 193 LOG_ERROR(Service_JIT, "attempted to load plugin with invalid transfer memory handle");
194 IPC::ResponseBuilder rb{ctx, 2}; 194 IPC::ResponseBuilder rb{ctx, 2};
@@ -356,11 +356,7 @@ public:
356 return; 356 return;
357 } 357 }
358 358
359 // Fetch using the handle table for the application process here, 359 auto process{ctx.GetObjectFromHandle<Kernel::KProcess>(process_handle)};
360 // since we are not multiprocess yet.
361 const auto& handle_table{system.ApplicationProcess()->GetHandleTable()};
362
363 auto process{handle_table.GetObject<Kernel::KProcess>(process_handle)};
364 if (process.IsNull()) { 360 if (process.IsNull()) {
365 LOG_ERROR(Service_JIT, "process is null for handle=0x{:08X}", process_handle); 361 LOG_ERROR(Service_JIT, "process is null for handle=0x{:08X}", process_handle);
366 IPC::ResponseBuilder rb{ctx, 2}; 362 IPC::ResponseBuilder rb{ctx, 2};
@@ -368,7 +364,7 @@ public:
368 return; 364 return;
369 } 365 }
370 366
371 auto rx_mem{handle_table.GetObject<Kernel::KCodeMemory>(rx_mem_handle)}; 367 auto rx_mem{ctx.GetObjectFromHandle<Kernel::KCodeMemory>(rx_mem_handle)};
372 if (rx_mem.IsNull()) { 368 if (rx_mem.IsNull()) {
373 LOG_ERROR(Service_JIT, "rx_mem is null for handle=0x{:08X}", rx_mem_handle); 369 LOG_ERROR(Service_JIT, "rx_mem is null for handle=0x{:08X}", rx_mem_handle);
374 IPC::ResponseBuilder rb{ctx, 2}; 370 IPC::ResponseBuilder rb{ctx, 2};
@@ -376,7 +372,7 @@ public:
376 return; 372 return;
377 } 373 }
378 374
379 auto ro_mem{handle_table.GetObject<Kernel::KCodeMemory>(ro_mem_handle)}; 375 auto ro_mem{ctx.GetObjectFromHandle<Kernel::KCodeMemory>(ro_mem_handle)};
380 if (ro_mem.IsNull()) { 376 if (ro_mem.IsNull()) {
381 LOG_ERROR(Service_JIT, "ro_mem is null for handle=0x{:08X}", ro_mem_handle); 377 LOG_ERROR(Service_JIT, "ro_mem is null for handle=0x{:08X}", ro_mem_handle);
382 IPC::ResponseBuilder rb{ctx, 2}; 378 IPC::ResponseBuilder rb{ctx, 2};
diff --git a/src/core/hle/service/ro/ro.cpp b/src/core/hle/service/ro/ro.cpp
index 17110d3f1..f0658bb5d 100644
--- a/src/core/hle/service/ro/ro.cpp
+++ b/src/core/hle/service/ro/ro.cpp
@@ -651,10 +651,9 @@ private:
651 void RegisterProcessHandle(HLERequestContext& ctx) { 651 void RegisterProcessHandle(HLERequestContext& ctx) {
652 LOG_DEBUG(Service_LDR, "(called)"); 652 LOG_DEBUG(Service_LDR, "(called)");
653 653
654 auto process_h = ctx.GetClientHandleTable().GetObject(ctx.GetCopyHandle(0)); 654 auto process = ctx.GetObjectFromHandle<Kernel::KProcess>(ctx.GetCopyHandle(0));
655 auto client_pid = ctx.GetPID(); 655 auto client_pid = ctx.GetPID();
656 auto result = interface.RegisterProcessHandle(client_pid, 656 auto result = interface.RegisterProcessHandle(client_pid, process.GetPointerUnsafe());
657 process_h->DynamicCast<Kernel::KProcess*>());
658 657
659 IPC::ResponseBuilder rb{ctx, 2}; 658 IPC::ResponseBuilder rb{ctx, 2};
660 rb.Push(result); 659 rb.Push(result);
@@ -671,12 +670,11 @@ private:
671 670
672 IPC::RequestParser rp{ctx}; 671 IPC::RequestParser rp{ctx};
673 auto params = rp.PopRaw<InputParameters>(); 672 auto params = rp.PopRaw<InputParameters>();
674 auto process_h = ctx.GetClientHandleTable().GetObject(ctx.GetCopyHandle(0)); 673 auto process = ctx.GetObjectFromHandle<Kernel::KProcess>(ctx.GetCopyHandle(0));
675 674
676 auto client_pid = ctx.GetPID(); 675 auto client_pid = ctx.GetPID();
677 auto result = 676 auto result = interface.RegisterProcessModuleInfo(
678 interface.RegisterProcessModuleInfo(client_pid, params.nrr_address, params.nrr_size, 677 client_pid, params.nrr_address, params.nrr_size, process.GetPointerUnsafe());
679 process_h->DynamicCast<Kernel::KProcess*>());
680 678
681 IPC::ResponseBuilder rb{ctx, 2}; 679 IPC::ResponseBuilder rb{ctx, 2};
682 rb.Push(result); 680 rb.Push(result);
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 00531b021..39124c5fd 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -203,7 +203,7 @@ Result ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session,
203 // If emulation was shutdown, we are closing service threads, do not write the response back to 203 // If emulation was shutdown, we are closing service threads, do not write the response back to
204 // memory that may be shutting down as well. 204 // memory that may be shutting down as well.
205 if (system.IsPoweredOn()) { 205 if (system.IsPoweredOn()) {
206 ctx.WriteToOutgoingCommandBuffer(ctx.GetThread()); 206 ctx.WriteToOutgoingCommandBuffer();
207 } 207 }
208 208
209 return result; 209 return result;