aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMatt Macy <mmacy@FreeBSD.org>2018-06-07 00:54:11 +0000
committerMatt Macy <mmacy@FreeBSD.org>2018-06-07 00:54:11 +0000
commit155046394a997e1341d5346364902fd84cb00a46 (patch)
tree7d34e814de0b8d7530261e545a567beb2b35cb78 /sys
parent60f18ad0b47af6cf88e6412237e58e3e3f9feb28 (diff)
downloadsrc-155046394a997e1341d5346364902fd84cb00a46.tar.gz
src-155046394a997e1341d5346364902fd84cb00a46.zip
cpufunc: add rdtscp for x86
Notes
Notes: svn path=/head/; revision=334746
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/include/cpufunc.h9
-rw-r--r--sys/i386/include/cpufunc.h9
2 files changed, 18 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)
{
diff --git a/sys/i386/include/cpufunc.h b/sys/i386/include/cpufunc.h
index 72bf666b3b04..44ba3ff4c4a3 100644
--- a/sys/i386/include/cpufunc.h
+++ b/sys/i386/include/cpufunc.h
@@ -368,6 +368,15 @@ rdtsc(void)
return (rv);
}
+static __inline uint64_t
+rdtscp(void)
+{
+ uint64_t rv;
+
+ __asm __volatile("rdtscp" : "=A" (rv));
+ return (rv);
+}
+
static __inline uint32_t
rdtsc32(void)
{