read system timer on AARCH64

This commit is contained in:
Steffen Jaeckel 2020-10-24 17:59:42 +02:00 committed by Jamie Reece Wilson
parent 802907ba3f
commit 083ba719cf

View File

@ -86,6 +86,10 @@ static ulong64 rdtsc (void)
__asm__ __volatile__ ("rd %%tick, %0; clruw %0, %1; srlx %0, 32, %0" : "=r" (x), "=r" (y) : "0" (x), "1" (y));
return ((unsigned long long) x << 32) | y;
#endif
#elif defined(__aarch64__)
ulong64 CNTVCT_EL0;
__asm__ __volatile__ ("mrs %0, cntvct_el0" : "=r"(CNTVCT_EL0));
return CNTVCT_EL0;
#else
return XCLOCK();
#endif