summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Fernando S2021-12-22 17:39:17 +0100
committerGravatar GitHub2021-12-22 17:39:17 +0100
commitb85f5b13323965ea296a17e9aa81a1c8c8369ea0 (patch)
tree94a8e24ff3f150f958c16868e50d6b41df5ef45e /src
parentMerge pull request #7375 from vonchenplus/convert_legacy (diff)
parenthle: kernel: svc: GetInfo: Fix error checking with IdleTickCount. (diff)
downloadyuzu-b85f5b13323965ea296a17e9aa81a1c8c8369ea0.tar.gz
yuzu-b85f5b13323965ea296a17e9aa81a1c8c8369ea0.tar.xz
yuzu-b85f5b13323965ea296a17e9aa81a1c8c8369ea0.zip
Merge pull request #7616 from bunnei/fix-get-idle-ticks
hle: kernel: svc: GetInfo: Fix error checking with IdleTickCount.
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/svc.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index bb9475c56..37d67b72e 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -880,22 +880,17 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
880 return ResultSuccess; 880 return ResultSuccess;
881 } 881 }
882 case GetInfoType::IdleTickCount: { 882 case GetInfoType::IdleTickCount: {
883 if (handle == 0) { 883 // Verify the input handle is invalid.
884 LOG_ERROR(Kernel_SVC, "Thread handle does not exist, handle=0x{:08X}", 884 R_UNLESS(handle == InvalidHandle, ResultInvalidHandle);
885 static_cast<Handle>(handle));
886 return ResultInvalidHandle;
887 }
888 885
889 if (info_sub_id != 0xFFFFFFFFFFFFFFFF && 886 // Verify the requested core is valid.
890 info_sub_id != system.Kernel().CurrentPhysicalCoreIndex()) { 887 const bool core_valid =
891 LOG_ERROR(Kernel_SVC, "Core is not the current core, got {}", info_sub_id); 888 (info_sub_id == static_cast<u64>(-1ULL)) ||
892 return ResultInvalidCombination; 889 (info_sub_id == static_cast<u64>(system.Kernel().CurrentPhysicalCoreIndex()));
893 } 890 R_UNLESS(core_valid, ResultInvalidCombination);
894
895 const auto& scheduler = *system.Kernel().CurrentScheduler();
896 const auto* const idle_thread = scheduler.GetIdleThread();
897 891
898 *result = idle_thread->GetCpuTime(); 892 // Get the idle tick count.
893 *result = system.Kernel().CurrentScheduler()->GetIdleThread()->GetCpuTime();
899 return ResultSuccess; 894 return ResultSuccess;
900 } 895 }
901 default: 896 default: