aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2025-09-19 02:37:14 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2025-09-24 13:02:27 +0000
commit50ee990e1874d6d40b8e3dc359c37e2ef2ebf477 (patch)
tree7351fbfaa32a1472db2fedc78ed0266a5172aea2
parent86114bae092bd023165e5b9df244fc0849172429 (diff)
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
-rw-r--r--sys/amd64/include/cpufunc.h9
1 files changed, 9 insertions, 0 deletions
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)
{