From ab8f2b03447dc3480160451096a65d3d344dc407 Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Thu, 8 Dec 2016 23:15:23 +0300 Subject: [PATCH] Add AArch64 timer support to rdtsc(). Add support for RDTSC-like timer on AArch64. This is only used by the internal regression/benchmark test suite. --- regressions/common.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/regressions/common.h b/regressions/common.h index 1377532..f67c2af 100644 --- a/regressions/common.h +++ b/regressions/common.h @@ -442,6 +442,11 @@ rdtsc(void) } while (snapshot != high); return (((uint64_t)high << 32) | low); +#elif defined(__aarch64__) + uint64_t r; + + __asm __volatile__ ("mrs %0, cntvct_el0" : "=r" (r) : : "memory"); + return r; #else return 0; #endif