summaryrefslogtreecommitdiffhomepage
path: root/vdso/cycle_clock.h
diff options
context:
space:
mode:
Diffstat (limited to 'vdso/cycle_clock.h')
-rw-r--r--vdso/cycle_clock.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/vdso/cycle_clock.h b/vdso/cycle_clock.h
index dfb5b427d..26d6690c0 100644
--- a/vdso/cycle_clock.h
+++ b/vdso/cycle_clock.h
@@ -33,6 +33,15 @@ static inline uint64_t cycle_clock(void) {
asm volatile("rdtsc" : "=a"(lo), "=d"(hi));
return ((uint64_t)hi << 32) | lo;
}
+
+#elif __aarch64__
+
+static inline uint64_t cycle_clock(void) {
+ uint64_t val;
+ asm volatile("mrs %0, CNTVCT_EL0" : "=r"(val)::"memory");
+ return val;
+}
+
#else
#error "unsupported architecture"
#endif