[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231213163443.70490-2-brgerst@gmail.com>
Date: Wed, 13 Dec 2023 11:34:41 -0500
From: Brian Gerst <brgerst@...il.com>
To: linux-kernel@...r.kernel.org, x86@...nel.org
Cc: Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>,
"H . Peter Anvin" <hpa@...or.com>,
Peter Zijlstra <peterz@...radead.org>,
Linus Torvalds <torvalds@...uxfoundation.org>,
Brian Gerst <brgerst@...il.com>
Subject: [PATCH 1/3] x86: Move TSS and LDT to end of the GDT
This will make testing for system segments easier.
Signed-off-by: Brian Gerst <brgerst@...il.com>
---
arch/x86/include/asm/segment.h | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h
index 9d6411c65920..a155843d0c37 100644
--- a/arch/x86/include/asm/segment.h
+++ b/arch/x86/include/asm/segment.h
@@ -83,8 +83,8 @@
* 13 - kernel data segment
* 14 - default user CS
* 15 - default user DS
- * 16 - TSS <=== cacheline #5
- * 17 - LDT
+ * 16 - unused <=== cacheline #5
+ * 17 - unused
* 18 - PNPBIOS support (16->32 gate)
* 19 - PNPBIOS support
* 20 - PNPBIOS support <=== cacheline #6
@@ -97,8 +97,11 @@
* 26 - ESPFIX small SS
* 27 - per-cpu [ offset to per-cpu data area ]
* 28 - VDSO getcpu
- * 29 - unused
- * 30 - unused
+ *
+ * ------- start of system segments:
+ *
+ * 29 - TSS
+ * 30 - LDT
* 31 - TSS for double fault handler
*/
#define GDT_ENTRY_TLS_MIN 6
@@ -108,8 +111,6 @@
#define GDT_ENTRY_KERNEL_DS 13
#define GDT_ENTRY_DEFAULT_USER_CS 14
#define GDT_ENTRY_DEFAULT_USER_DS 15
-#define GDT_ENTRY_TSS 16
-#define GDT_ENTRY_LDT 17
#define GDT_ENTRY_PNPBIOS_CS32 18
#define GDT_ENTRY_PNPBIOS_CS16 19
#define GDT_ENTRY_PNPBIOS_DS 20
@@ -121,6 +122,10 @@
#define GDT_ENTRY_PERCPU 27
#define GDT_ENTRY_CPUNODE 28
+/* Start of system segments */
+
+#define GDT_ENTRY_TSS 29
+#define GDT_ENTRY_LDT 30
#define GDT_ENTRY_DOUBLEFAULT_TSS 31
/*
@@ -188,20 +193,22 @@
#define GDT_ENTRY_DEFAULT_USER_DS 5
#define GDT_ENTRY_DEFAULT_USER_CS 6
-/* Needs two entries */
-#define GDT_ENTRY_TSS 8
-/* Needs two entries */
-#define GDT_ENTRY_LDT 10
-
#define GDT_ENTRY_TLS_MIN 12
#define GDT_ENTRY_TLS_MAX 14
#define GDT_ENTRY_CPUNODE 15
+/* Start of system segments */
+
+/* Needs two entries */
+#define GDT_ENTRY_TSS 16
+/* Needs two entries */
+#define GDT_ENTRY_LDT 18
+
/*
* Number of entries in the GDT table:
*/
-#define GDT_ENTRIES 16
+#define GDT_ENTRIES 20
/*
* Segment selector values corresponding to the above entries:
@@ -219,6 +226,8 @@
#endif
+#define GDT_SYSTEM_START GDT_ENTRY_TSS
+
#define IDT_ENTRIES 256
#define NUM_EXCEPTION_VECTORS 32
--
2.43.0
Powered by blists - more mailing lists