diff options
Diffstat (limited to 'src/core/hle/kernel')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 25 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc_wrap.h | 8 |
2 files changed, 17 insertions, 16 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 |
| 689 | static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, u64 handle, | 689 | static 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; |
diff --git a/src/core/hle/kernel/svc_wrap.h b/src/core/hle/kernel/svc_wrap.h index 819eadfbb..61986bb52 100644 --- a/src/core/hle/kernel/svc_wrap.h +++ b/src/core/hle/kernel/svc_wrap.h | |||
| @@ -252,11 +252,13 @@ void SvcWrap64(Core::System& system) { | |||
| 252 | .raw); | 252 | .raw); |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | template <ResultCode func(Core::System&, u64*, u64, u64, u64)> | 255 | // Used by GetInfo |
| 256 | template <ResultCode func(Core::System&, u64*, u64, Handle, u64)> | ||
| 256 | void SvcWrap64(Core::System& system) { | 257 | void SvcWrap64(Core::System& system) { |
| 257 | u64 param_1 = 0; | 258 | u64 param_1 = 0; |
| 258 | const u32 retval = | 259 | const u32 retval = func(system, ¶m_1, Param(system, 1), |
| 259 | func(system, ¶m_1, Param(system, 1), Param(system, 2), Param(system, 3)).raw; | 260 | static_cast<Handle>(Param(system, 2)), Param(system, 3)) |
| 261 | .raw; | ||
| 260 | 262 | ||
| 261 | system.CurrentArmInterface().SetReg(1, param_1); | 263 | system.CurrentArmInterface().SetReg(1, param_1); |
| 262 | FuncReturn(system, retval); | 264 | FuncReturn(system, retval); |