brintos

brintos / linux-shallow public Read only

0
0
Text · 498 B · cc85bd9 Raw
22 lines · c
1// SPDX-License-Identifier: GPL-2.02 3#include <linux/types.h>4 5#include "../../../util/tsc.h"6 7u64 rdtsc(void)8{9	u64 val;10 11	/*12	 * According to ARM DDI 0487F.c, from Armv8.0 to Armv8.5 inclusive, the13	 * system counter is at least 56 bits wide; from Armv8.6, the counter14	 * must be 64 bits wide.  So the system counter could be less than 6415	 * bits wide and it is attributed with the flag 'cap_user_time_short'16	 * is true.17	 */18	asm volatile("mrs %0, cntvct_el0" : "=r" (val));19 20	return val;21}22