From: "H. Peter Anvin" <h...@linux.intel.com>

We don't want to advertise to user space how many slots the kernel
GDT has, but user space can trivially find out what the last
user-accessible GDT slot is.  Add a #define for that so we can use
that in sizing a regset.

Signed-off-by: H. Peter Anvin (Intel) <h...@zytor.com>
Cc: Ingo Molnar <mi...@kernel.org>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Andy Lutomirski <l...@kernel.org>
Cc: Chang S. Bae <chang.seok....@intel.com>
Cc: Markus T. Metzger <markus.t.metz...@intel.com>
---
 arch/x86/include/asm/segment.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h
index e293c122d0d5..5eb809eec048 100644
--- a/arch/x86/include/asm/segment.h
+++ b/arch/x86/include/asm/segment.h
@@ -115,6 +115,11 @@
  */
 #define GDT_ENTRIES                    32
 
+/*
+ * Last user-visible GDT slot
+ */
+#define GDT_LAST_USER                  GDT_ENTRY_DEFAULT_USER_DS
+
 /*
  * Segment selector values corresponding to the above entries:
  */
@@ -194,6 +199,11 @@
  */
 #define GDT_ENTRIES                    16
 
+/*
+ * Last user-visible GDT slot
+ */
+#define GDT_LAST_USER                  GDT_ENTRY_PER_CPU
+
 /*
  * Segment selector values corresponding to the above entries:
  *
-- 
2.14.4

Reply via email to