]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: Use aarch64 virtual counter
authorJan Janssen <medhefgo@web.de>
Thu, 26 Jan 2023 22:10:53 +0000 (23:10 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 27 Jan 2023 08:26:16 +0000 (09:26 +0100)
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
src/boot/efi/ticks.c

index 2f6ff878ca9a6e8d868aabed569b5dc22c785395..654929699890bcbd583d9d5ea6a65f310a926da4 100644 (file)
@@ -33,7 +33,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
@@ -45,7 +45,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