diff options
author | Matt Macy <mmacy@FreeBSD.org> | 2018-06-07 00:54:11 +0000 |
---|---|---|
committer | Matt Macy <mmacy@FreeBSD.org> | 2018-06-07 00:54:11 +0000 |
commit | 155046394a997e1341d5346364902fd84cb00a46 (patch) | |
tree | 7d34e814de0b8d7530261e545a567beb2b35cb78 /sys/amd64/include/cpufunc.h | |
parent | 60f18ad0b47af6cf88e6412237e58e3e3f9feb28 (diff) | |
download | src-155046394a997e1341d5346364902fd84cb00a46.tar.gz src-155046394a997e1341d5346364902fd84cb00a46.zip |
cpufunc: add rdtscp for x86
Notes
Notes:
svn path=/head/; revision=334746
Diffstat (limited to 'sys/amd64/include/cpufunc.h')
-rw-r--r-- | sys/amd64/include/cpufunc.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h index e50deb01964f..7123e7b8f58a 100644 --- a/sys/amd64/include/cpufunc.h +++ b/sys/amd64/include/cpufunc.h @@ -386,6 +386,15 @@ rdtsc(void) return (low | ((uint64_t)high << 32)); } +static __inline uint64_t +rdtscp(void) +{ + uint32_t low, high; + + __asm __volatile("rdtscp" : "=a" (low), "=d" (high)); + return (low | ((uint64_t)high << 32)); +} + static __inline uint32_t rdtsc32(void) { |