diff options
Diffstat (limited to 'include/asm-x86/desc_defs.h')
-rw-r--r-- | include/asm-x86/desc_defs.h | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/include/asm-x86/desc_defs.h b/include/asm-x86/desc_defs.h index 089004070099..e33f078b3e54 100644 --- a/include/asm-x86/desc_defs.h +++ b/include/asm-x86/desc_defs.h | |||
@@ -11,26 +11,36 @@ | |||
11 | 11 | ||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | 13 | ||
14 | /* | ||
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 | ||
20 | */ | ||
14 | // 8 byte segment descriptor | 21 | // 8 byte segment descriptor |
15 | struct desc_struct { | 22 | struct desc_struct { |
16 | u16 limit0; | 23 | union { |
17 | u16 base0; | 24 | struct { unsigned int a, b; }; |
18 | unsigned base1 : 8, type : 4, s : 1, dpl : 2, p : 1; | 25 | struct { |
19 | unsigned limit : 4, avl : 1, l : 1, d : 1, g : 1, base2 : 8; | 26 | u16 limit0; |
20 | } __attribute__((packed)); | 27 | u16 base0; |
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; | ||
30 | }; | ||
21 | 31 | ||
22 | struct n_desc_struct { | 32 | }; |
23 | unsigned int a,b; | 33 | } __attribute__((packed)); |
24 | }; | ||
25 | 34 | ||
26 | enum { | 35 | enum { |
27 | GATE_INTERRUPT = 0xE, | 36 | GATE_INTERRUPT = 0xE, |
28 | GATE_TRAP = 0xF, | 37 | GATE_TRAP = 0xF, |
29 | GATE_CALL = 0xC, | 38 | GATE_CALL = 0xC, |
39 | GATE_TASK = 0x5, | ||
30 | }; | 40 | }; |
31 | 41 | ||
32 | // 16byte gate | 42 | // 16byte gate |
33 | struct gate_struct { | 43 | struct gate_struct64 { |
34 | u16 offset_low; | 44 | u16 offset_low; |
35 | u16 segment; | 45 | u16 segment; |
36 | unsigned ist : 3, zero0 : 5, type : 5, dpl : 2, p : 1; | 46 | unsigned ist : 3, zero0 : 5, type : 5, dpl : 2, p : 1; |
@@ -39,17 +49,18 @@ struct gate_struct { | |||
39 | u32 zero1; | 49 | u32 zero1; |
40 | } __attribute__((packed)); | 50 | } __attribute__((packed)); |
41 | 51 | ||
42 | #define PTR_LOW(x) ((unsigned long)(x) & 0xFFFF) | 52 | #define PTR_LOW(x) ((unsigned long long)(x) & 0xFFFF) |
43 | #define PTR_MIDDLE(x) (((unsigned long)(x) >> 16) & 0xFFFF) | 53 | #define PTR_MIDDLE(x) (((unsigned long long)(x) >> 16) & 0xFFFF) |
44 | #define PTR_HIGH(x) ((unsigned long)(x) >> 32) | 54 | #define PTR_HIGH(x) ((unsigned long long)(x) >> 32) |
45 | 55 | ||
46 | enum { | 56 | enum { |
47 | DESC_TSS = 0x9, | 57 | DESC_TSS = 0x9, |
48 | DESC_LDT = 0x2, | 58 | DESC_LDT = 0x2, |
59 | DESCTYPE_S = 0x10, /* !system */ | ||
49 | }; | 60 | }; |
50 | 61 | ||
51 | // LDT or TSS descriptor in the GDT. 16 bytes. | 62 | // LDT or TSS descriptor in the GDT. 16 bytes. |
52 | struct ldttss_desc { | 63 | struct ldttss_desc64 { |
53 | u16 limit0; | 64 | u16 limit0; |
54 | u16 base0; | 65 | u16 base0; |
55 | unsigned base1 : 8, type : 5, dpl : 2, p : 1; | 66 | unsigned base1 : 8, type : 5, dpl : 2, p : 1; |
@@ -58,6 +69,16 @@ struct ldttss_desc { | |||
58 | u32 zero1; | 69 | u32 zero1; |
59 | } __attribute__((packed)); | 70 | } __attribute__((packed)); |
60 | 71 | ||
72 | #ifdef CONFIG_X86_64 | ||
73 | typedef struct gate_struct64 gate_desc; | ||
74 | typedef struct ldttss_desc64 ldt_desc; | ||
75 | typedef struct ldttss_desc64 tss_desc; | ||
76 | #else | ||
77 | typedef struct desc_struct gate_desc; | ||
78 | typedef struct desc_struct ldt_desc; | ||
79 | typedef struct desc_struct tss_desc; | ||
80 | #endif | ||
81 | |||
61 | struct desc_ptr { | 82 | struct desc_ptr { |
62 | unsigned short size; | 83 | unsigned short size; |
63 | unsigned long address; | 84 | unsigned long address; |