diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-10-16 11:54:09 +0200 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-10-16 20:33:44 +0200 |
commit | da6673e79acf26d728d347edc15c123d6c96a42f (patch) | |
tree | c2fd1dc9f2673bd7e279434f79fea2cdc5a64f70 /src | |
parent | Merge pull request #7190 from Morph1984/missing-ui-main (diff) | |
download | yuzu-da6673e79acf26d728d347edc15c123d6c96a42f.tar yuzu-da6673e79acf26d728d347edc15c123d6c96a42f.tar.gz yuzu-da6673e79acf26d728d347edc15c123d6c96a42f.tar.bz2 yuzu-da6673e79acf26d728d347edc15c123d6c96a42f.tar.lz yuzu-da6673e79acf26d728d347edc15c123d6c96a42f.tar.xz yuzu-da6673e79acf26d728d347edc15c123d6c96a42f.tar.zst yuzu-da6673e79acf26d728d347edc15c123d6c96a42f.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/hle/kernel/k_scheduler.h | 5 | ||||
-rw-r--r-- | src/core/hle/kernel/svc.cpp | 17 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/core/hle/kernel/k_scheduler.h b/src/core/hle/kernel/k_scheduler.h index c8ccc1ae4..7df288438 100644 --- a/src/core/hle/kernel/k_scheduler.h +++ b/src/core/hle/kernel/k_scheduler.h @@ -49,6 +49,11 @@ public: /// Gets the current running thread [[nodiscard]] KThread* GetCurrentThread() const; + /// Gets the idle thread + [[nodiscard]] KThread* GetIdleThread() const { + return idle_thread; + } + /// Returns true if the scheduler is idle [[nodiscard]] bool IsIdle() const { return GetCurrentThread() == idle_thread; diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index f98f24a60..7f38ade1c 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -886,7 +886,24 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle *result = out_ticks; 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; + } + if (info_sub_id != 0xFFFFFFFFFFFFFFFF && info_sub_id != system.CurrentCoreIndex()) { + 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(); + + *result = idle_thread->GetCpuTime(); + return ResultSuccess; + } default: LOG_ERROR(Kernel_SVC, "Unimplemented svcGetInfo id=0x{:016X}", info_id); return ResultInvalidEnumValue; |