summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorFernando S <fsahmkow27@gmail.com>2021-12-22 17:39:17 +0100
committerGitHub <noreply@github.com>2021-12-22 17:39:17 +0100
commitb85f5b13323965ea296a17e9aa81a1c8c8369ea0 (patch)
tree94a8e24ff3f150f958c16868e50d6b41df5ef45e /src/core/hle/kernel
parentMerge pull request #7375 from vonchenplus/convert_legacy (diff)
parenthle: kernel: svc: GetInfo: Fix error checking with IdleTickCount. (diff)
downloadyuzu-b85f5b13323965ea296a17e9aa81a1c8c8369ea0.tar
yuzu-b85f5b13323965ea296a17e9aa81a1c8c8369ea0.tar.gz
yuzu-b85f5b13323965ea296a17e9aa81a1c8c8369ea0.tar.bz2
yuzu-b85f5b13323965ea296a17e9aa81a1c8c8369ea0.tar.lz
yuzu-b85f5b13323965ea296a17e9aa81a1c8c8369ea0.tar.xz
yuzu-b85f5b13323965ea296a17e9aa81a1c8c8369ea0.tar.zst
yuzu-b85f5b13323965ea296a17e9aa81a1c8c8369ea0.zip
Diffstat (limited to 'src/core/hle/kernel')
-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
return ResultSuccess;
}
case GetInfoType::IdleTickCount: {
- if (handle == 0) {
- LOG_ERROR(Kernel_SVC, "Thread handle does not exist, handle=0x{:08X}",
- static_cast<Handle>(handle));
- return ResultInvalidHandle;
- }
+ // Verify the input handle is invalid.
+ R_UNLESS(handle == InvalidHandle, ResultInvalidHandle);
- if (info_sub_id != 0xFFFFFFFFFFFFFFFF &&
- info_sub_id != system.Kernel().CurrentPhysicalCoreIndex()) {
- LOG_ERROR(Kernel_SVC, "Core is not the current core, got {}", info_sub_id);
- return ResultInvalidCombination;
- }
-
- const auto& scheduler = *system.Kernel().CurrentScheduler();
- const auto* const idle_thread = scheduler.GetIdleThread();
+ // Verify the requested core is valid.
+ const bool core_valid =
+ (info_sub_id == static_cast<u64>(-1ULL)) ||
+ (info_sub_id == static_cast<u64>(system.Kernel().CurrentPhysicalCoreIndex()));
+ R_UNLESS(core_valid, ResultInvalidCombination);
- *result = idle_thread->GetCpuTime();
+ // Get the idle tick count.
+ *result = system.Kernel().CurrentScheduler()->GetIdleThread()->GetCpuTime();
return ResultSuccess;
}
default: