git: b9f6bda16b27 - stable/12 - x86: Add rdtscp32() into cpufunc.h.

Konstantin Belousov kib at FreeBSD.org
Sun Jan 17 05:10:39 UTC 2021


The branch stable/12 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=b9f6bda16b274b2b090db39781f7eb315b80c126

commit b9f6bda16b274b2b090db39781f7eb315b80c126
Author:     Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-01-09 20:39:19 +0000
Commit:     Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-01-17 04:44:18 +0000

    x86: Add rdtscp32() into cpufunc.h.
    
    (cherry picked from commit 45974de8fb23710873417f1d2ca513761da6cacc)
---
 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 2a03d9b61941..85e6c60a4ffd 100644
--- a/sys/amd64/include/cpufunc.h
+++ b/sys/amd64/include/cpufunc.h
@@ -412,6 +412,15 @@ rdtsc32(void)
 	return (rv);
 }
 
+static __inline uint32_t
+rdtscp32(void)
+{
+	uint32_t rv;
+
+	__asm __volatile("rdtscp" : "=a" (rv) : : "ecx", "edx");
+	return (rv);
+}
+
 static __inline void
 wbinvd(void)
 {
diff --git a/sys/i386/include/cpufunc.h b/sys/i386/include/cpufunc.h
index 3feeef02499c..9646590a6a40 100644
--- a/sys/i386/include/cpufunc.h
+++ b/sys/i386/include/cpufunc.h
@@ -412,6 +412,15 @@ rdtsc32(void)
 	return (rv);
 }
 
+static __inline uint32_t
+rdtscp32(void)
+{
+	uint32_t rv;
+
+	__asm __volatile("rdtscp" : "=a" (rv) : : "ecx", "edx");
+	return (rv);
+}
+
 static __inline void
 wbinvd(void)
 {


More information about the dev-commits-src-all mailing list