Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Sep 2025 13:02:46 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: 50ee990e1874 - main - amd64 cpufunc.h: add rcs(), to read code selector
Message-ID:  <202509241302.58OD2kpJ034401@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=50ee990e1874d6d40b8e3dc359c37e2ef2ebf477

commit 50ee990e1874d6d40b8e3dc359c37e2ef2ebf477
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-09-19 02:37:14 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-09-24 13:02:27 +0000

    amd64 cpufunc.h: add rcs(), to read code selector
    
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D52607
---
 sys/amd64/include/cpufunc.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h
index e6c9f47ea261..9a4c82275a99 100644
--- a/sys/amd64/include/cpufunc.h
+++ b/sys/amd64/include/cpufunc.h
@@ -572,6 +572,15 @@ rss(void)
 	return (sel);
 }
 
+static __inline u_short
+rcs(void)
+{
+	u_short sel;
+
+	__asm __volatile("movw %%cs,%0" : "=rm" (sel));
+	return (sel);
+}
+
 static __inline void
 load_ds(u_short sel)
 {



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