git: 45974de8fb23 - main - x86: Add rdtscp32() into cpufunc.h.

Konstantin Belousov kib at FreeBSD.org
Sun Jan 10 02:43:13 UTC 2021


The branch main has been updated by kib:

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

commit 45974de8fb23710873417f1d2ca513761da6cacc
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-10 02:42:34 +0000

    x86: Add rdtscp32() into cpufunc.h.
    
    Suggested by:   markj
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D27986
---
 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 94e9c15b5117..2bf2339c7d6e 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