aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2017-02-02 11:58:10 -0500
committerBjoern Brandenburg <bbb@mpi-sws.org>2017-03-08 02:18:16 -0500
commit89b126bcef6bac4cd6c78c67b58407f4ff2182c4 (patch)
tree3b57b068871d21b3e7f7d564b4322a3b1e59ffc8
parent875e24f01d2775e4229abf8eb82e97e0884c97c7 (diff)
arm64: add cycles.h
Required for get_cycles() in userspace. This is required to compile the tools. Whether or not get_cycles() works in userspace depends on whether the kernel has enabled access to the CNTVCT_EL0 register from userspace (= exception level EL0).
-rw-r--r--arch/arm64/include/asm/cycles.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/cycles.h b/arch/arm64/include/asm/cycles.h
new file mode 100644
index 0000000..e832d82
--- /dev/null
+++ b/arch/arm64/include/asm/cycles.h
@@ -0,0 +1,20 @@
1#ifndef ASM_CYCLES_H
2#define ASM_CYCLES_H
3
4#include <stdint.h>
5#include <inttypes.h>
6
7typedef uint64_t cycles_t;
8
9#define CYCLES_FMT PRIu64
10
11static inline cycles_t get_cycles(void)
12{
13 cycles_t c;
14 asm volatile(
15 "isb\n"
16 "mrs %0, cntvct_el0" : "=r" (c));
17 return c;
18}
19
20#endif