x86: Add an enum for some commonly-used GDT bits
authorSimon Glass <sjg@chromium.org>
Tue, 4 Aug 2015 18:33:54 +0000 (12:33 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 5 Aug 2015 14:44:07 +0000 (08:44 -0600)
Rather than add these as open-coded values, create an enum with the commonly
used flags.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
arch/x86/include/asm/cpu.h

index 08284ee29530c46a3d33ed52956b4f661113de01..5b891394fb6a6af65a7bef8f8a9d11e0d7333ee5 100644 (file)
@@ -27,6 +27,24 @@ enum {
        X86_VENDOR_UNKNOWN = 0xff
 };
 
+/* Global descriptor table (GDT) bits */
+enum {
+       GDT_4KB                 = 1ULL << 55,
+       GDT_32BIT               = 1ULL << 54,
+       GDT_LONG                = 1ULL << 53,
+       GDT_PRESENT             = 1ULL << 47,
+       GDT_NOTSYS              = 1ULL << 44,
+       GDT_CODE                = 1ULL << 43,
+       GDT_LIMIT_LOW_SHIFT     = 0,
+       GDT_LIMIT_LOW_MASK      = 0xffff,
+       GDT_LIMIT_HIGH_SHIFT    = 48,
+       GDT_LIMIT_HIGH_MASK     = 0xf,
+       GDT_BASE_LOW_SHIFT      = 16,
+       GDT_BASE_LOW_MASK       = 0xffff,
+       GDT_BASE_HIGH_SHIFT     = 56,
+       GDT_BASE_HIGH_MASK      = 0xf,
+};
+
 struct cpuid_result {
        uint32_t eax;
        uint32_t ebx;