git: e088ad2d0efe - stable/12 - x86: cpufunc: Add rdtscp_aux()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 12 Oct 2021 16:01:41 UTC
The branch stable/12 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=e088ad2d0efec94462d5c10c992f2ac0b5aa22fd
commit e088ad2d0efec94462d5c10c992f2ac0b5aa22fd
Author: Adam Fenn <adam@fenn.io>
AuthorDate: 2021-07-26 19:59:55 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-10-12 16:01:25 +0000
x86: cpufunc: Add rdtscp_aux()
Add a variant of 'rdtscp()' that retains and returns the 'IA32_TSC_AUX'
value read by 'rdtscp'.
Sponsored By: Juniper Networks, Inc.
Sponsored By: Klara, Inc.
Reviewed by: markj, kib
Differential Revision: https://reviews.freebsd.org/D31415
(cherry picked from commit 908e277230ef1a80589f85687f5b422b0e863e79)
---
sys/amd64/include/cpufunc.h | 9 +++++++++
sys/i386/include/cpufunc.h | 9 +++++++++
2 files changed, 18 insertions(+)
diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h
index 85e6c60a4ffd..93e62c0df73a 100644
--- a/sys/amd64/include/cpufunc.h
+++ b/sys/amd64/include/cpufunc.h
@@ -403,6 +403,15 @@ rdtscp(void)
return (low | ((uint64_t)high << 32));
}
+static __inline uint64_t
+rdtscp_aux(uint32_t *aux)
+{
+ uint32_t low, high;
+
+ __asm __volatile("rdtscp" : "=a" (low), "=d" (high), "=c" (*aux));
+ 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 9646590a6a40..7b99978facc3 100644
--- a/sys/i386/include/cpufunc.h
+++ b/sys/i386/include/cpufunc.h
@@ -403,6 +403,15 @@ rdtscp(void)
return (rv);
}
+static __inline uint64_t
+rdtscp_aux(uint32_t *aux)
+{
+ uint64_t rv;
+
+ __asm __volatile("rdtscp" : "=A" (rv), "=c" (*aux));
+ return (rv);
+}
+
static __inline uint32_t
rdtsc32(void)
{