1 /* Written 2000 by Andi Kleen */
2 #ifndef __ARCH_DESC_DEFS_H
3 #define __ARCH_DESC_DEFS_H
6 * Segment descriptor structure definitions, usable from both x86_64 and i386
12 #include <linux/types.h>
15 * FIXME: Acessing the desc_struct through its fields is more elegant,
16 * and should be the one valid thing to do. However, a lot of open code
17 * still touches the a and b acessors, and doing this allow us to do it
18 * incrementally. We keep the signature as a struct, rather than an union,
19 * so we can get rid of it transparently in the future -- glommer
21 // 8 byte segment descriptor
24 struct { unsigned int a, b; };
28 unsigned base1: 8, type: 4, s: 1, dpl: 2, p: 1;
29 unsigned limit: 4, avl: 1, l: 1, d: 1, g: 1, base2: 8;
33 } __attribute__((packed));
42 struct gate_struct64 {
45 unsigned ist : 3, zero0 : 5, type : 5, dpl : 2, p : 1;
49 } __attribute__((packed));
51 #define PTR_LOW(x) ((unsigned long)(x) & 0xFFFF)
52 #define PTR_MIDDLE(x) (((unsigned long)(x) >> 16) & 0xFFFF)
53 #define PTR_HIGH(x) ((unsigned long)(x) >> 32)
58 DESCTYPE_TASK = 0x85, /* present, system, DPL-0, task gate */
59 DESCTYPE_INT = 0x8e, /* present, system, DPL-0, interrupt gate */
60 DESCTYPE_TRAP = 0x8f, /* present, system, DPL-0, trap gate */
61 DESCTYPE_DPL3 = 0x60, /* DPL-3 */
62 DESCTYPE_S = 0x10, /* !system */
65 // LDT or TSS descriptor in the GDT. 16 bytes.
66 struct ldttss_desc64 {
69 unsigned base1 : 8, type : 5, dpl : 2, p : 1;
70 unsigned limit1 : 4, zero0 : 3, g : 1, base2 : 8;
73 } __attribute__((packed));
76 typedef struct gate_struct64 gate_desc;
77 typedef struct ldttss_desc64 ldt_desc;
78 typedef struct ldttss_desc64 tss_desc;
80 typedef struct desc_struct gate_desc;
81 typedef struct desc_struct ldt_desc;
82 typedef struct desc_struct tss_desc;
87 unsigned long address;
88 } __attribute__((packed)) ;
91 #endif /* !__ASSEMBLY__ */