Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jan 2021 02:43:12 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 45974de8fb23 - main - x86: Add rdtscp32() into cpufunc.h.
Message-ID:  <202101100243.10A2hCOY058064@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib:

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

commit 45974de8fb23710873417f1d2ca513761da6cacc
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-01-09 20:39:19 +0000
Commit:     Konstantin Belousov <kib@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)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101100243.10A2hCOY058064>