1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-06 13:17:44 +03:00

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 2df8574af0)
This commit is contained in:
Jan Janssen 2023-01-26 23:10:53 +01:00 committed by Luca Boccassi
parent e1b0f8c20c
commit ce56d12f01

View File

@ -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