Skip to content

Commit

Permalink
aarch cycle_count - use a version of code from elsewhere
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesm committed Mar 11, 2024
1 parent 20ed49f commit c443b60
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/native/entropy_cpu_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,11 @@ static inline uint32_t read_virtual_count (void)
#endif /* arm */

#if defined (__aarch64__)
#define isb() __asm__ __volatile__("isb" : : : "memory")
/* from https://github.com/ARM-software/synchronization-benchmarks/blob/master/benchmarks/lockhammer/include/perf_timer.h */
static inline uint64_t read_virtual_count(void)
{
uint64_t c;
isb();
__asm__ __volatile__("mrs %0, cntvct_el0":"=r"(c));
__asm__ __volatile__("isb; mrs %0, cntvct_el0":"=r"(c));
return c;
}
#endif /* aarch64 */
Expand Down

0 comments on commit c443b60

Please sign in to comment.