Merge branch 'splice-2.6.22' of git://git.kernel.dk/data/git/linux-2.6-block
[linux-2.6/kmemtrace.git] / include / asm-x86_64 / desc_defs.h
blob089004070099200c53ce9550ebd945b7ea9f9931
1 /* Written 2000 by Andi Kleen */
2 #ifndef __ARCH_DESC_DEFS_H
3 #define __ARCH_DESC_DEFS_H
5 /*
6 * Segment descriptor structure definitions, usable from both x86_64 and i386
7 * archs.
8 */
10 #ifndef __ASSEMBLY__
12 #include <linux/types.h>
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));
22 struct n_desc_struct {
23 unsigned int a,b;
26 enum {
27 GATE_INTERRUPT = 0xE,
28 GATE_TRAP = 0xF,
29 GATE_CALL = 0xC,
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));
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)
46 enum {
47 DESC_TSS = 0x9,
48 DESC_LDT = 0x2,
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));
61 struct desc_ptr {
62 unsigned short size;
63 unsigned long address;
64 } __attribute__((packed)) ;
67 #endif /* !__ASSEMBLY__ */
69 #endif