summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2021-04-17 22:21:59 -0700
committerGravatar bunnei2021-05-05 16:40:51 -0700
commit126aaeb6d30c4f99c7ee28e38de00d2994bf8853 (patch)
tree0f67bcef63b7aa3b47b5247017b03d13239a684a /src/core/hle/kernel/svc.cpp
parenthle: kernel: Migrate KTransferMemory to KAutoObject. (diff)
downloadyuzu-126aaeb6d30c4f99c7ee28e38de00d2994bf8853.tar.gz
yuzu-126aaeb6d30c4f99c7ee28e38de00d2994bf8853.tar.xz
yuzu-126aaeb6d30c4f99c7ee28e38de00d2994bf8853.zip
hle: kernel: svc: Use new handle table API for Process.
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 0b7eb0740..790839a4b 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -686,7 +686,7 @@ static void OutputDebugString(Core::System& system, VAddr address, u64 len) {
686} 686}
687 687
688/// Gets system/memory information for the current process 688/// Gets system/memory information for the current process
689static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, u64 handle, 689static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle handle,
690 u64 info_sub_id) { 690 u64 info_sub_id) {
691 std::lock_guard lock{HLE::g_hle_lock}; 691 std::lock_guard lock{HLE::g_hle_lock};
692 LOG_TRACE(Kernel_SVC, "called info_id=0x{:X}, info_sub_id=0x{:X}, handle=0x{:08X}", info_id, 692 LOG_TRACE(Kernel_SVC, "called info_id=0x{:X}, info_sub_id=0x{:X}, handle=0x{:08X}", info_id,
@@ -752,10 +752,9 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, u64 ha
752 return ResultInvalidEnumValue; 752 return ResultInvalidEnumValue;
753 } 753 }
754 754
755 const auto& current_process_handle_table = 755 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
756 system.Kernel().CurrentProcess()->GetHandleTable(); 756 KScopedAutoObject process = handle_table.GetObject<Process>(handle);
757 const auto process = current_process_handle_table.Get<Process>(static_cast<Handle>(handle)); 757 if (process.IsNull()) {
758 if (!process) {
759 LOG_ERROR(Kernel_SVC, "Process is not valid! info_id={}, info_sub_id={}, handle={:08X}", 758 LOG_ERROR(Kernel_SVC, "Process is not valid! info_id={}, info_sub_id={}, handle={:08X}",
760 info_id, info_sub_id, handle); 759 info_id, info_sub_id, handle);
761 return ResultInvalidHandle; 760 return ResultInvalidHandle;
@@ -1287,8 +1286,8 @@ static ResultCode QueryProcessMemory(Core::System& system, VAddr memory_info_add
1287 std::lock_guard lock{HLE::g_hle_lock}; 1286 std::lock_guard lock{HLE::g_hle_lock};
1288 LOG_TRACE(Kernel_SVC, "called process=0x{:08X} address={:X}", process_handle, address); 1287 LOG_TRACE(Kernel_SVC, "called process=0x{:08X} address={:X}", process_handle, address);
1289 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 1288 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
1290 auto process = handle_table.Get<Process>(process_handle); 1289 KScopedAutoObject process = handle_table.GetObject<Process>(process_handle);
1291 if (!process) { 1290 if (process.IsNull()) {
1292 LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}", 1291 LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}",
1293 process_handle); 1292 process_handle);
1294 return ResultInvalidHandle; 1293 return ResultInvalidHandle;
@@ -1369,8 +1368,8 @@ static ResultCode MapProcessCodeMemory(Core::System& system, Handle process_hand
1369 } 1368 }
1370 1369
1371 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 1370 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
1372 auto process = handle_table.Get<Process>(process_handle); 1371 KScopedAutoObject process = handle_table.GetObject<Process>(process_handle);
1373 if (!process) { 1372 if (process.IsNull()) {
1374 LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).", 1373 LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).",
1375 process_handle); 1374 process_handle);
1376 return ResultInvalidHandle; 1375 return ResultInvalidHandle;
@@ -1437,8 +1436,8 @@ static ResultCode UnmapProcessCodeMemory(Core::System& system, Handle process_ha
1437 } 1436 }
1438 1437
1439 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 1438 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
1440 auto process = handle_table.Get<Process>(process_handle); 1439 KScopedAutoObject process = handle_table.GetObject<Process>(process_handle);
1441 if (!process) { 1440 if (process.IsNull()) {
1442 LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).", 1441 LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).",
1443 process_handle); 1442 process_handle);
1444 return ResultInvalidHandle; 1443 return ResultInvalidHandle;
@@ -2100,8 +2099,8 @@ static ResultCode GetProcessInfo(Core::System& system, u64* out, Handle process_
2100 }; 2099 };
2101 2100
2102 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 2101 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
2103 const auto process = handle_table.Get<Process>(process_handle); 2102 KScopedAutoObject process = handle_table.GetObject<Process>(process_handle);
2104 if (!process) { 2103 if (process.IsNull()) {
2105 LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}", 2104 LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}",
2106 process_handle); 2105 process_handle);
2107 return ResultInvalidHandle; 2106 return ResultInvalidHandle;