From 944a67a59656f577e167b4c2adf31eae03ff5b2e Mon Sep 17 00:00:00 2001 From: Ali Mashtizadeh Date: Tue, 7 Nov 2023 18:48:48 -0500 Subject: [PATCH] Add Time_GetTSC code for ARM64 --- sys/arm64/time.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/arm64/time.c b/sys/arm64/time.c index 8eec58a..f1f89cb 100644 --- a/sys/arm64/time.c +++ b/sys/arm64/time.c @@ -12,7 +12,17 @@ uint64_t Time_GetTSC() { - return 0; + uint64_t ui; + asm volatile("mrs %0, CNTVCT_EL0" : "=&r" (ui)); + return ui; +} + +uint64_t +Time_GetTSCFreq() +{ + uint64_t ui; + asm volatile("mrs %0, CNTFRQ_EL0" : "=&r" (ui)); + return ui; } static void