Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 
0003 #include <linux/types.h>
0004 
0005 #include "../../../util/tsc.h"
0006 
0007 u64 rdtsc(void)
0008 {
0009     u64 val;
0010 
0011     /*
0012      * According to ARM DDI 0487F.c, from Armv8.0 to Armv8.5 inclusive, the
0013      * system counter is at least 56 bits wide; from Armv8.6, the counter
0014      * must be 64 bits wide.  So the system counter could be less than 64
0015      * bits wide and it is attributed with the flag 'cap_user_time_short'
0016      * is true.
0017      */
0018     asm volatile("mrs %0, cntvct_el0" : "=r" (val));
0019 
0020     return val;
0021 }