5 #include <asm/desc_defs.h>
9 static inline void fill_ldt(struct desc_struct *desc, struct user_desc *info)
11 desc->limit0 = info->limit & 0x0ffff;
12 desc->base0 = info->base_addr & 0x0000ffff;
14 desc->base1 = (info->base_addr & 0x00ff0000) >> 16;
15 desc->type = (info->read_exec_only ^ 1) << 1;
16 desc->type |= info->contents << 2;
19 desc->p = info->seg_not_present ^ 1;
20 desc->limit = (info->limit & 0xf0000) >> 16;
21 desc->avl = info->useable;
22 desc->d = info->seg_32bit;
23 desc->g = info->limit_in_pages;
24 desc->base2 = (info->base_addr & 0xff000000) >> 24;
27 extern struct desc_ptr idt_descr;
28 extern gate_desc idt_table[];
36 #define _LDT_empty(info) (\
37 (info)->base_addr == 0 && \
38 (info)->limit == 0 && \
39 (info)->contents == 0 && \
40 (info)->read_exec_only == 1 && \
41 (info)->seg_32bit == 0 && \
42 (info)->limit_in_pages == 0 && \
43 (info)->seg_not_present == 1 && \
47 #define LDT_empty(info) (_LDT_empty(info) && ((info)->lm == 0))
49 #define LDT_empty(info) (_LDT_empty(info))
52 static inline void clear_LDT(void)
58 * load one particular LDT into the current CPU
60 static inline void load_LDT_nolock(mm_context_t *pc)
62 set_ldt(pc->ldt, pc->size);
65 static inline void load_LDT(mm_context_t *pc)
72 static inline unsigned long get_desc_base(struct desc_struct *desc)
74 return desc->base0 | ((desc->base1) << 16) | ((desc->base2) << 24);
79 * GET_DESC_BASE reads the descriptor base of the specified segment.
82 * idx - descriptor index
84 * base - 32bit register to which the base will be written
85 * lo_w - lo word of the "base" register
86 * lo_b - lo byte of the "base" register
87 * hi_b - hi byte of the low word of the "base" register
90 * GET_DESC_BASE(GDT_ENTRY_ESPFIX_SS, %ebx, %eax, %ax, %al, %ah)
91 * Will read the base address of GDT_ENTRY_ESPFIX_SS and put it into %eax.
93 #define GET_DESC_BASE(idx, gdt, base, lo_w, lo_b, hi_b) \
94 movb idx*8+4(gdt), lo_b; \
95 movb idx*8+7(gdt), hi_b; \
97 movw idx*8+2(gdt), lo_w;
100 #endif /* __ASSEMBLY__ */