From 6eaf7ab55f9ca6df9439d3e382d49faeb1dffe00 Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 22 Nov 2019 15:55:42 -0500 Subject: [PATCH 1/2] svc: GetSystemTick should return cntpct_el0, not core ticks. --- src/core/hle/kernel/svc.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 8c67ada435..04ca094823 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -1777,7 +1777,9 @@ static u64 GetSystemTick(Core::System& system) { LOG_TRACE(Kernel_SVC, "called"); auto& core_timing = system.CoreTiming(); - const u64 result{core_timing.GetTicks()}; + + // Returns the value of cntpct_el0 (https://switchbrew.org/wiki/SVC#svcGetSystemTick) + const u64 result{Core::Timing::CpuCyclesToClockCycles(system.CoreTiming().GetTicks())}; // Advance time to defeat dumb games that busy-wait for the frame to end. core_timing.AddTicks(400); From 63248f4edd4c8c4ad47d0cc46e1f7c08371054d4 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 23 Nov 2019 16:01:06 -0500 Subject: [PATCH 2/2] Update svc.cpp --- src/core/hle/kernel/svc.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 04ca094823..4c3b53a880 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -17,6 +17,7 @@ #include "core/core.h" #include "core/core_cpu.h" #include "core/core_timing.h" +#include "core/core_timing_util.h" #include "core/hle/kernel/address_arbiter.h" #include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_session.h"