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
This commit is contained in:
committed by
Lennart Poettering
parent
5783c4f0a4
commit
2df8574af0
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user