summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2021-12-21 22:41:23 -0800
committerGravatar bunnei2021-12-21 22:41:23 -0800
commit49e3c073a5195587a0d48bc1895bb2d07a0bdb3f (patch)
treea29c196417069715258b3d4a5df7aae9895f2bed
parentMerge pull request #7604 from ameerj/fullscreen-render-window (diff)
downloadyuzu-49e3c073a5195587a0d48bc1895bb2d07a0bdb3f.tar.gz
yuzu-49e3c073a5195587a0d48bc1895bb2d07a0bdb3f.tar.xz
yuzu-49e3c073a5195587a0d48bc1895bb2d07a0bdb3f.zip
hle: kernel: svc: GetInfo: Fix error checking with IdleTickCount.
- Enforce tha the supplied handle is invalid, not valid. - This gets Witcher 3 booting.
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: