aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/desc_defs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86/desc_defs.h')
-rw-r--r--include/asm-x86/desc_defs.h47
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
15struct desc_struct { 22struct 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
22struct n_desc_struct { 32 };
23 unsigned int a,b; 33} __attribute__((packed));
24};
25 34
26enum { 35enum {
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
33struct gate_struct { 43struct 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
46enum { 56enum {
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.
52struct ldttss_desc { 63struct 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
73typedef struct gate_struct64 gate_desc;
74typedef struct ldttss_desc64 ldt_desc;
75typedef struct ldttss_desc64 tss_desc;
76#else
77typedef struct desc_struct gate_desc;
78typedef struct desc_struct ldt_desc;
79typedef struct desc_struct tss_desc;
80#endif
81
61struct desc_ptr { 82struct desc_ptr {
62 unsigned short size; 83 unsigned short size;
63 unsigned long address; 84 unsigned long address;