From ce56d12f01b3e83e6c9a691cb4c1010222422eb2 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Thu, 26 Jan 2023 23:10:53 +0100 Subject: [PATCH] boot: Use aarch64 virtual counter This should be used in VMs and should also yield the same value when running on real devices. It is also what grub uses. Fixes: #26224 (cherry picked from commit 2df8574af035ce4f515beb7c0adf83973440a8a6) --- src/boot/efi/ticks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/boot/efi/ticks.c b/src/boot/efi/ticks.c index 1b74ba15d0..889980a40d 100644 --- a/src/boot/efi/ticks.c +++ b/src/boot/efi/ticks.c @@ -32,7 +32,7 @@ static uint64_t ticks_read(void) { #elif defined(__aarch64__) static uint64_t ticks_read(void) { uint64_t val; - __asm__ volatile ("mrs %0, cntpct_el0" : "=r" (val)); + asm volatile("mrs %0, cntvct_el0" : "=r"(val)); return val; } #else @@ -44,7 +44,7 @@ static uint64_t ticks_read(void) { #if defined(__aarch64__) static uint64_t ticks_freq(void) { uint64_t freq; - __asm__ volatile ("mrs %0, cntfrq_el0": "=r" (freq)); + asm volatile("mrs %0, cntfrq_el0" : "=r"(freq)); return freq; } #else