]> err.no Git - linux-2.6/blobdiff - include/asm-i386/desc.h
Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6
[linux-2.6] / include / asm-i386 / desc.h
index 6cf2ac2bfde747111ce5e3b46f69811b22f6978a..050831f34f71ce8f2001872c41b982c61262043e 100644 (file)
@@ -22,7 +22,7 @@ struct Xgt_desc_struct {
 
 extern struct Xgt_desc_struct idt_descr;
 DECLARE_PER_CPU(struct Xgt_desc_struct, cpu_gdt_descr);
-
+extern struct Xgt_desc_struct early_gdt_descr;
 
 static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu)
 {
@@ -55,6 +55,9 @@ static inline void pack_gate(__u32 *a, __u32 *b,
 #define DESCTYPE_DPL3  0x60    /* DPL-3 */
 #define DESCTYPE_S     0x10    /* !system */
 
+#ifdef CONFIG_PARAVIRT
+#include <asm/paravirt.h>
+#else
 #define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8))
 
 #define load_gdt(dtr) __asm__ __volatile("lgdt %0"::"m" (*dtr))
@@ -78,6 +81,10 @@ static inline void load_TLS(struct thread_struct *t, unsigned int cpu)
 #undef C
 }
 
+#define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
+#define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
+#define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
+
 static inline void write_dt_entry(void *dt, int entry, __u32 entry_a, __u32 entry_b)
 {
        __u32 *lp = (__u32 *)((char *)dt + entry*8);
@@ -85,9 +92,25 @@ static inline void write_dt_entry(void *dt, int entry, __u32 entry_a, __u32 entr
        *(lp+1) = entry_b;
 }
 
-#define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
-#define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
-#define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
+#define set_ldt native_set_ldt
+#endif /* CONFIG_PARAVIRT */
+
+static inline fastcall void native_set_ldt(const void *addr,
+                                          unsigned int entries)
+{
+       if (likely(entries == 0))
+               __asm__ __volatile__("lldt %w0"::"q" (0));
+       else {
+               unsigned cpu = smp_processor_id();
+               __u32 a, b;
+
+               pack_descriptor(&a, &b, (unsigned long)addr,
+                               entries * sizeof(struct desc_struct) - 1,
+                               DESCTYPE_LDT, 0);
+               write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_LDT, a, b);
+               __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8));
+       }
+}
 
 static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned short seg)
 {
@@ -105,21 +128,6 @@ static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const vo
        write_gdt_entry(get_cpu_gdt_table(cpu), entry, a, b);
 }
 
-static inline void set_ldt(void *addr, unsigned int entries)
-{
-       if (likely(entries == 0))
-               __asm__ __volatile__("lldt %w0"::"q" (0));
-       else {
-               unsigned cpu = smp_processor_id();
-               __u32 a, b;
-
-               pack_descriptor(&a, &b, (unsigned long)addr,
-                               entries * sizeof(struct desc_struct) - 1,
-                               DESCTYPE_LDT, 0);
-               write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_LDT, a, b);
-               __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8));
-       }
-}
 
 #define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr)