summaryrefslogtreecommitdiffhomepage
path: root/vdso/cycle_clock.h
diff options
context:
space:
mode:
authorHaibo Xu <haibo.xu@arm.com>2019-04-18 16:20:45 -0700
committerShentubot <shentubot@google.com>2019-04-18 16:22:08 -0700
commitf4d434c18002c96511decf8ff1ebdbede46ca6a1 (patch)
treecc781d877ef0ea64ce33c46d6a30b76eefa4753a /vdso/cycle_clock.h
parentc931c8e0829914718a729e20d7db0c2bf4e73f0b (diff)
Enable vDSO support on arm64.
Signed-off-by: Haibo Xu <haibo.xu@arm.com> Change-Id: I20103cd6d193431ab7e8120005da1f567b9bc2eb PiperOrigin-RevId: 244280119
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