diff --git a/lib/x86/desc.h b/lib/x86/desc.h
index 92c45a48..a4459127 100644
--- a/lib/x86/desc.h
+++ b/lib/x86/desc.h
@@ -1,7 +1,61 @@
 #ifndef _X86_DESC_H_
 #define _X86_DESC_H_
 
-#include <setjmp.h>
+/*
+ * selector     32-bit                        64-bit
+ * 0x00         NULL descriptor               NULL descriptor
+ * 0x08         ring-0 code segment (32-bit)  ring-0 code segment (64-bit)
+ * 0x10         ring-0 data segment (32-bit)  ring-0 data segment (32/64-bit)
+ * 0x18         ring-0 code segment (P=0)     ring-0 code segment (64-bit, P=0)
+ * 0x20         intr_alt_stack TSS            ring-0 code segment (32-bit)
+ * 0x28         ring-0 code segment (16-bit)  same
+ * 0x30         ring-0 data segment (16-bit)  same
+ * 0x38 (0x3b)  ring-3 code segment (32-bit)  same
+ * 0x40 (0x43)  ring-3 data segment (32-bit)  ring-3 data segment (32/64-bit)
+ * 0x48 (0x4b)  **unused**                    ring-3 code segment (64-bit)
+ * 0x50-0x78    free to use for test cases    same
+ * 0x80-0x870   primary TSS (CPU 0..254)      same
+ * 0x878-0x1068 percpu area (CPU 0..254)      not used
+ *
+ * Note that the same segment can be used for 32-bit and 64-bit data segments
+ * (the L bit is only defined for code segments)
+ *
+ * Selectors 0x08-0x10 and 0x3b-0x4b are set up for use with the SYSCALL
+ * and SYSRET instructions.
+ */
+
+#define KERNEL_CS   0x08
+#define KERNEL_DS   0x10
+#define NP_SEL      0x18
+#ifdef __x86_64__
+#define KERNEL_CS32 0x20
+#else
+#define TSS_INTR    0x20
+#endif
+#define KERNEL_CS16 0x28
+#define KERNEL_DS16 0x30
+#define USER_CS32   0x3b
+#define USER_DS     0x43
+#ifdef __x86_64__
+#define USER_CS64   0x4b
+#endif
+
+/* Synonyms */
+#define KERNEL_DS32 KERNEL_DS
+#define USER_DS32   USER_DS
+
+#ifdef __x86_64__
+#define KERNEL_CS64 KERNEL_CS
+#define USER_CS     USER_CS64
+#define KERNEL_DS64 KERNEL_DS
+#define USER_DS64   USER_DS
+#else
+#define KERNEL_CS32 KERNEL_CS
+#define USER_CS     USER_CS32
+#endif
+
+#define FIRST_SPARE_SEL 0x50
+#define TSS_MAIN 0x80
 
 #ifdef __ASSEMBLY__
 #define __ASM_FORM(x, ...)	x,## __VA_ARGS__
@@ -15,6 +69,8 @@
 #define __ASM_SEL(a,b)		__ASM_FORM(b)
 #endif
 
+#include <setjmp.h>
+
 void setup_idt(void);
 void load_idt(void);
 void setup_alt_stack(void);
@@ -120,62 +176,6 @@ fep_unavailable:
 	return false;
 }
 
-/*
- * selector     32-bit                        64-bit
- * 0x00         NULL descriptor               NULL descriptor
- * 0x08         ring-0 code segment (32-bit)  ring-0 code segment (64-bit)
- * 0x10         ring-0 data segment (32-bit)  ring-0 data segment (32/64-bit)
- * 0x18         ring-0 code segment (P=0)     ring-0 code segment (64-bit, P=0)
- * 0x20         intr_alt_stack TSS            ring-0 code segment (32-bit)
- * 0x28         ring-0 code segment (16-bit)  same
- * 0x30         ring-0 data segment (16-bit)  same
- * 0x38 (0x3b)  ring-3 code segment (32-bit)  same
- * 0x40 (0x43)  ring-3 data segment (32-bit)  ring-3 data segment (32/64-bit)
- * 0x48 (0x4b)  **unused**                    ring-3 code segment (64-bit)
- * 0x50-0x78    free to use for test cases    same
- * 0x80-0x870   primary TSS (CPU 0..254)      same
- * 0x878-0x1068 percpu area (CPU 0..254)      not used
- *
- * Note that the same segment can be used for 32-bit and 64-bit data segments
- * (the L bit is only defined for code segments)
- *
- * Selectors 0x08-0x10 and 0x3b-0x4b are set up for use with the SYSCALL
- * and SYSRET instructions.
- */
-
-#define KERNEL_CS   0x08
-#define KERNEL_DS   0x10
-#define NP_SEL      0x18
-#ifdef __x86_64__
-#define KERNEL_CS32 0x20
-#else
-#define TSS_INTR    0x20
-#endif
-#define KERNEL_CS16 0x28
-#define KERNEL_DS16 0x30
-#define USER_CS32   0x3b
-#define USER_DS     0x43
-#ifdef __x86_64__
-#define USER_CS64   0x4b
-#endif
-
-/* Synonyms */
-#define KERNEL_DS32 KERNEL_DS
-#define USER_DS32   USER_DS
-
-#ifdef __x86_64__
-#define KERNEL_CS64 KERNEL_CS
-#define USER_CS     USER_CS64
-#define KERNEL_DS64 KERNEL_DS
-#define USER_DS64   USER_DS
-#else
-#define KERNEL_CS32 KERNEL_CS
-#define USER_CS     USER_CS32
-#endif
-
-#define FIRST_SPARE_SEL 0x50
-#define TSS_MAIN 0x80
-
 typedef struct {
 	unsigned short offset0;
 	unsigned short selector;
