diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-04-10 14:06:41 +0200 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-04-10 14:06:41 +0200 |
commit | 3d0204fddb71ca377fa65952ede872583c8a7242 (patch) | |
tree | 4563132cbe6e9d103ea6e2178f7b9ecaae4c0246 /test/monniaux/cycles.h | |
parent | be92a8c71192e014caf292312865dee32ee1b901 (diff) | |
download | compcert-kvx-3d0204fddb71ca377fa65952ede872583c8a7242.tar.gz compcert-kvx-3d0204fddb71ca377fa65952ede872583c8a7242.zip |
various fixes for aarch64 profiling
Diffstat (limited to 'test/monniaux/cycles.h')
-rw-r--r-- | test/monniaux/cycles.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/monniaux/cycles.h b/test/monniaux/cycles.h index c7dc582b..097d6882 100644 --- a/test/monniaux/cycles.h +++ b/test/monniaux/cycles.h @@ -50,6 +50,11 @@ static inline cycle_t get_cycle(void) { typedef uint32_t cycle_t; #define PRcycle PRId32 +#ifdef ARM_NOPRIVILEGE +static inline cycle_t get_cycle(void) { + return 0; +} +#else /* need this kernel module https://github.com/zertyz/MTL/tree/master/cpp/time/kernel/arm */ static inline cycle_t get_cycle(void) { @@ -57,14 +62,20 @@ static inline cycle_t get_cycle(void) { __asm__ volatile ("mrc p15, 0, %0, c9, c13, 0":"=r" (cycles)); return cycles; } +#endif #else #define PRcycle PRId64 typedef uint64_t cycle_t; + +#ifdef ARM_NOPRIVILEGE +static inline cycle_t get_cycle(void) { + return 0; +} +#else /* need this kernel module: https://github.com/jerinjacobk/armv8_pmu_cycle_counter_el0 on 5+ kernels, remove first argument of access_ok macro */ - static inline cycle_t get_cycle(void) { uint64_t val; @@ -72,6 +83,7 @@ static inline cycle_t get_cycle(void) return val; } #endif +#endif #else #define PRcycle PRId32 |