mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-27 01:02:48 +01:00
hle: kernel: svc: GetInfo: Fix error checking with IdleTickCount.
- Enforce tha the supplied handle is invalid, not valid. - This gets Witcher 3 booting.
This commit is contained in:
parent
6991d447d4
commit
49e3c073a5
1 changed files with 9 additions and 14 deletions
|
@ -880,22 +880,17 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
case GetInfoType::IdleTickCount: {
|
case GetInfoType::IdleTickCount: {
|
||||||
if (handle == 0) {
|
// Verify the input handle is invalid.
|
||||||
LOG_ERROR(Kernel_SVC, "Thread handle does not exist, handle=0x{:08X}",
|
R_UNLESS(handle == InvalidHandle, ResultInvalidHandle);
|
||||||
static_cast<Handle>(handle));
|
|
||||||
return ResultInvalidHandle;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info_sub_id != 0xFFFFFFFFFFFFFFFF &&
|
// Verify the requested core is valid.
|
||||||
info_sub_id != system.Kernel().CurrentPhysicalCoreIndex()) {
|
const bool core_valid =
|
||||||
LOG_ERROR(Kernel_SVC, "Core is not the current core, got {}", info_sub_id);
|
(info_sub_id == static_cast<u64>(-1ULL)) ||
|
||||||
return ResultInvalidCombination;
|
(info_sub_id == static_cast<u64>(system.Kernel().CurrentPhysicalCoreIndex()));
|
||||||
}
|
R_UNLESS(core_valid, ResultInvalidCombination);
|
||||||
|
|
||||||
const auto& scheduler = *system.Kernel().CurrentScheduler();
|
// Get the idle tick count.
|
||||||
const auto* const idle_thread = scheduler.GetIdleThread();
|
*result = system.Kernel().CurrentScheduler()->GetIdleThread()->GetCpuTime();
|
||||||
|
|
||||||
*result = idle_thread->GetCpuTime();
|
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue