i386/x86_64: move headers to include/asm-x86
[deliverable/linux.git] / include / asm-x86 / desc_defs.h
1 /* Written 2000 by Andi Kleen */
2 #ifndef __ARCH_DESC_DEFS_H
3 #define __ARCH_DESC_DEFS_H
4
5 /*
6 * Segment descriptor structure definitions, usable from both x86_64 and i386
7 * archs.
8 */
9
10 #ifndef __ASSEMBLY__
11
12 #include <linux/types.h>
13
14 // 8 byte segment descriptor
15 struct desc_struct {
16 u16 limit0;
17 u16 base0;
18 unsigned base1 : 8, type : 4, s : 1, dpl : 2, p : 1;
19 unsigned limit : 4, avl : 1, l : 1, d : 1, g : 1, base2 : 8;
20 } __attribute__((packed));
21
22 struct n_desc_struct {
23 unsigned int a,b;
24 };
25
26 enum {
27 GATE_INTERRUPT = 0xE,
28 GATE_TRAP = 0xF,
29 GATE_CALL = 0xC,
30 };
31
32 // 16byte gate
33 struct gate_struct {
34 u16 offset_low;
35 u16 segment;
36 unsigned ist : 3, zero0 : 5, type : 5, dpl : 2, p : 1;
37 u16 offset_middle;
38 u32 offset_high;
39 u32 zero1;
40 } __attribute__((packed));
41
42 #define PTR_LOW(x) ((unsigned long)(x) & 0xFFFF)
43 #define PTR_MIDDLE(x) (((unsigned long)(x) >> 16) & 0xFFFF)
44 #define PTR_HIGH(x) ((unsigned long)(x) >> 32)
45
46 enum {
47 DESC_TSS = 0x9,
48 DESC_LDT = 0x2,
49 };
50
51 // LDT or TSS descriptor in the GDT. 16 bytes.
52 struct ldttss_desc {
53 u16 limit0;
54 u16 base0;
55 unsigned base1 : 8, type : 5, dpl : 2, p : 1;
56 unsigned limit1 : 4, zero0 : 3, g : 1, base2 : 8;
57 u32 base3;
58 u32 zero1;
59 } __attribute__((packed));
60
61 struct desc_ptr {
62 unsigned short size;
63 unsigned long address;
64 } __attribute__((packed)) ;
65
66
67 #endif /* !__ASSEMBLY__ */
68
69 #endif
This page took 0.03335 seconds and 5 git commands to generate.