WIP FPC-III support
[linux/fpc-iii.git] / tools / perf / arch / arm64 / util / tsc.c
blobcc85bd9e73f1e5c3b3e4a99b8d56a10ae286d740
1 // SPDX-License-Identifier: GPL-2.0
3 #include <linux/types.h>
5 #include "../../../util/tsc.h"
7 u64 rdtsc(void)
9 u64 val;
12 * According to ARM DDI 0487F.c, from Armv8.0 to Armv8.5 inclusive, the
13 * system counter is at least 56 bits wide; from Armv8.6, the counter
14 * must be 64 bits wide. So the system counter could be less than 64
15 * bits wide and it is attributed with the flag 'cap_user_time_short'
16 * is true.
18 asm volatile("mrs %0, cntvct_el0" : "=r" (val));
20 return val;