aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386/desc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-i386/desc.h')
-rw-r--r--include/asm-i386/desc.h27
1 files changed, 23 insertions, 4 deletions
diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h
index a0398f780ca..6cf2ac2bfde 100644
--- a/include/asm-i386/desc.h
+++ b/include/asm-i386/desc.h
@@ -4,8 +4,6 @@
4#include <asm/ldt.h> 4#include <asm/ldt.h>
5#include <asm/segment.h> 5#include <asm/segment.h>
6 6
7#define CPU_16BIT_STACK_SIZE 1024
8
9#ifndef __ASSEMBLY__ 7#ifndef __ASSEMBLY__
10 8
11#include <linux/preempt.h> 9#include <linux/preempt.h>
@@ -16,8 +14,6 @@
16 14
17extern struct desc_struct cpu_gdt_table[GDT_ENTRIES]; 15extern struct desc_struct cpu_gdt_table[GDT_ENTRIES];
18 16
19DECLARE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]);
20
21struct Xgt_desc_struct { 17struct Xgt_desc_struct {
22 unsigned short size; 18 unsigned short size;
23 unsigned long address __attribute__((packed)); 19 unsigned long address __attribute__((packed));
@@ -181,6 +177,29 @@ static inline unsigned long get_desc_base(unsigned long *desc)
181 return base; 177 return base;
182} 178}
183 179
180#else /* __ASSEMBLY__ */
181
182/*
183 * GET_DESC_BASE reads the descriptor base of the specified segment.
184 *
185 * Args:
186 * idx - descriptor index
187 * gdt - GDT pointer
188 * base - 32bit register to which the base will be written
189 * lo_w - lo word of the "base" register
190 * lo_b - lo byte of the "base" register
191 * hi_b - hi byte of the low word of the "base" register
192 *
193 * Example:
194 * GET_DESC_BASE(GDT_ENTRY_ESPFIX_SS, %ebx, %eax, %ax, %al, %ah)
195 * Will read the base address of GDT_ENTRY_ESPFIX_SS and put it into %eax.
196 */
197#define GET_DESC_BASE(idx, gdt, base, lo_w, lo_b, hi_b) \
198 movb idx*8+4(gdt), lo_b; \
199 movb idx*8+7(gdt), hi_b; \
200 shll $16, base; \
201 movw idx*8+2(gdt), lo_w;
202
184#endif /* !__ASSEMBLY__ */ 203#endif /* !__ASSEMBLY__ */
185 204
186#endif 205#endif