]> err.no Git - linux-2.6/blobdiff - include/asm-x86/processor.h
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx
[linux-2.6] / include / asm-x86 / processor.h
index 9054734589fe390b9d3061a9b429785869038e52..6e26c7c717a23a15255869f2b864350faf21d597 100644 (file)
@@ -3,8 +3,7 @@
 
 #include <asm/processor-flags.h>
 
-/* migration helpers, for KVM - will be removed in 2.6.25: */
-#include <asm/vm86.h>
+/* migration helper, for KVM - will be removed in 2.6.25: */
 #define Xgt_desc_struct        desc_ptr
 
 /* Forward declaration, a strange C thing */
@@ -101,6 +100,7 @@ struct cpuinfo_x86 {
        /* cpuid returned max cores value: */
        u16                      x86_max_cores;
        u16                     apicid;
+       u16                     initial_apicid;
        u16                     x86_clflush_size;
 #ifdef CONFIG_SMP
        /* number of cores as seen by the OS: */
@@ -144,6 +144,15 @@ DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info);
 #define current_cpu_data       boot_cpu_data
 #endif
 
+static inline int hlt_works(int cpu)
+{
+#ifdef CONFIG_X86_32
+       return cpu_data(cpu).hlt_works_ok;
+#else
+       return 1;
+#endif
+}
+
 #define cache_line_size()      (boot_cpu_data.x86_cache_alignment)
 
 extern void cpu_detect(struct cpuinfo_x86 *c);
@@ -166,12 +175,12 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
                                unsigned int *ecx, unsigned int *edx)
 {
        /* ecx is often an input as well as an output. */
-       __asm__("cpuid"
-               : "=a" (*eax),
-                 "=b" (*ebx),
-                 "=c" (*ecx),
-                 "=d" (*edx)
-               : "0" (*eax), "2" (*ecx));
+       asm("cpuid"
+           : "=a" (*eax),
+             "=b" (*ebx),
+             "=c" (*ecx),
+             "=d" (*edx)
+           : "0" (*eax), "2" (*ecx));
 }
 
 static inline void load_cr3(pgd_t *pgdir)
@@ -280,42 +289,47 @@ struct orig_ist {
 #define        MXCSR_DEFAULT           0x1f80
 
 struct i387_fsave_struct {
-       u32                     cwd;
-       u32                     swd;
-       u32                     twd;
-       u32                     fip;
-       u32                     fcs;
-       u32                     foo;
-       u32                     fos;
-       /* 8*10 bytes for each FP-reg = 80 bytes: */
+       u32                     cwd;    /* FPU Control Word             */
+       u32                     swd;    /* FPU Status Word              */
+       u32                     twd;    /* FPU Tag Word                 */
+       u32                     fip;    /* FPU IP Offset                */
+       u32                     fcs;    /* FPU IP Selector              */
+       u32                     foo;    /* FPU Operand Pointer Offset   */
+       u32                     fos;    /* FPU Operand Pointer Selector */
+
+       /* 8*10 bytes for each FP-reg = 80 bytes:                       */
        u32                     st_space[20];
-       /* Software status information: */
+
+       /* Software status information [not touched by FSAVE ]:         */
        u32                     status;
 };
 
 struct i387_fxsave_struct {
-       u16                     cwd;
-       u16                     swd;
-       u16                     twd;
-       u16                     fop;
+       u16                     cwd; /* Control Word                    */
+       u16                     swd; /* Status Word                     */
+       u16                     twd; /* Tag Word                        */
+       u16                     fop; /* Last Instruction Opcode         */
        union {
                struct {
-                       u64     rip;
-                       u64     rdp;
+                       u64     rip; /* Instruction Pointer             */
+                       u64     rdp; /* Data Pointer                    */
                };
                struct {
-                       u32     fip;
-                       u32     fcs;
-                       u32     foo;
-                       u32     fos;
+                       u32     fip; /* FPU IP Offset                   */
+                       u32     fcs; /* FPU IP Selector                 */
+                       u32     foo; /* FPU Operand Offset              */
+                       u32     fos; /* FPU Operand Selector            */
                };
        };
-       u32                     mxcsr;
-       u32                     mxcsr_mask;
-       /* 8*16 bytes for each FP-reg = 128 bytes: */
+       u32                     mxcsr;          /* MXCSR Register State */
+       u32                     mxcsr_mask;     /* MXCSR Mask           */
+
+       /* 8*16 bytes for each FP-reg = 128 bytes:                      */
        u32                     st_space[32];
-       /* 16*16 bytes for each XMM-reg = 256 bytes: */
+
+       /* 16*16 bytes for each XMM-reg = 256 bytes:                    */
        u32                     xmm_space[64];
+
        u32                     padding[24];
 
 } __attribute__((aligned(16)));
@@ -346,9 +360,7 @@ union i387_union {
        struct i387_soft_struct         soft;
 };
 
-#ifdef CONFIG_X86_32
-DECLARE_PER_CPU(u8, cpu_llc_id);
-#else
+#ifdef CONFIG_X86_64
 DECLARE_PER_CPU(struct orig_ist, orig_ist);
 #endif
 
@@ -415,17 +427,23 @@ static inline unsigned long native_get_debugreg(int regno)
 
        switch (regno) {
        case 0:
-               asm("mov %%db0, %0" :"=r" (val)); break;
+               asm("mov %%db0, %0" :"=r" (val));
+               break;
        case 1:
-               asm("mov %%db1, %0" :"=r" (val)); break;
+               asm("mov %%db1, %0" :"=r" (val));
+               break;
        case 2:
-               asm("mov %%db2, %0" :"=r" (val)); break;
+               asm("mov %%db2, %0" :"=r" (val));
+               break;
        case 3:
-               asm("mov %%db3, %0" :"=r" (val)); break;
+               asm("mov %%db3, %0" :"=r" (val));
+               break;
        case 6:
-               asm("mov %%db6, %0" :"=r" (val)); break;
+               asm("mov %%db6, %0" :"=r" (val));
+               break;
        case 7:
-               asm("mov %%db7, %0" :"=r" (val)); break;
+               asm("mov %%db7, %0" :"=r" (val));
+               break;
        default:
                BUG();
        }
@@ -466,14 +484,14 @@ static inline void native_set_iopl_mask(unsigned mask)
 #ifdef CONFIG_X86_32
        unsigned int reg;
 
-       __asm__ __volatile__ ("pushfl;"
-                             "popl %0;"
-                             "andl %1, %0;"
-                             "orl %2, %0;"
-                             "pushl %0;"
-                             "popfl"
-                               : "=&r" (reg)
-                               : "i" (~X86_EFLAGS_IOPL), "r" (mask));
+       asm volatile ("pushfl;"
+                     "popl %0;"
+                     "andl %1, %0;"
+                     "orl %2, %0;"
+                     "pushl %0;"
+                     "popfl"
+                     : "=&r" (reg)
+                     : "i" (~X86_EFLAGS_IOPL), "r" (mask));
 #endif
 }
 
@@ -511,8 +529,8 @@ static inline void native_swapgs(void)
 #define set_debugreg(value, register)                          \
        native_set_debugreg(register, value)
 
-static inline void
-load_sp0(struct tss_struct *tss, struct thread_struct *thread)
+static inline void load_sp0(struct tss_struct *tss,
+                           struct thread_struct *thread)
 {
        native_load_sp0(tss, thread);
 }
@@ -668,7 +686,7 @@ static inline unsigned int cpuid_edx(unsigned int op)
 /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
 static inline void rep_nop(void)
 {
-       __asm__ __volatile__("rep; nop" ::: "memory");
+       asm volatile("rep; nop" ::: "memory");
 }
 
 static inline void cpu_relax(void)
@@ -682,32 +700,29 @@ static inline void sync_core(void)
        int tmp;
 
        asm volatile("cpuid" : "=a" (tmp) : "0" (1)
-                                         : "ebx", "ecx", "edx", "memory");
+                    : "ebx", "ecx", "edx", "memory");
 }
 
-static inline void
-__monitor(const void *eax, unsigned long ecx, unsigned long edx)
+static inline void __monitor(const void *eax, unsigned long ecx,
+                            unsigned long edx)
 {
        /* "monitor %eax, %ecx, %edx;" */
-       asm volatile(
-               ".byte 0x0f, 0x01, 0xc8;"
-               :: "a" (eax), "c" (ecx), "d"(edx));
+       asm volatile(".byte 0x0f, 0x01, 0xc8;"
+                    :: "a" (eax), "c" (ecx), "d"(edx));
 }
 
 static inline void __mwait(unsigned long eax, unsigned long ecx)
 {
        /* "mwait %eax, %ecx;" */
-       asm volatile(
-               ".byte 0x0f, 0x01, 0xc9;"
-               :: "a" (eax), "c" (ecx));
+       asm volatile(".byte 0x0f, 0x01, 0xc9;"
+                    :: "a" (eax), "c" (ecx));
 }
 
 static inline void __sti_mwait(unsigned long eax, unsigned long ecx)
 {
        /* "mwait %eax, %ecx;" */
-       asm volatile(
-               "sti; .byte 0x0f, 0x01, 0xc9;"
-               :: "a" (eax), "c" (ecx));
+       asm volatile("sti; .byte 0x0f, 0x01, 0xc9;"
+                    :: "a" (eax), "c" (ecx));
 }
 
 extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx);
@@ -729,6 +744,15 @@ extern void switch_to_new_gdt(void);
 extern void cpu_init(void);
 extern void init_gdt(int cpu);
 
+static inline void update_debugctlmsr(unsigned long debugctlmsr)
+{
+#ifndef CONFIG_X86_DEBUGCTLMSR
+       if (boot_cpu_data.x86 < 6)
+               return;
+#endif
+       wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctlmsr);
+}
+
 /*
  * from system description table in BIOS. Mostly for MCA use, but
  * others may find it useful:
@@ -849,7 +873,7 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
 /*
  * User space process size. 47bits minus one guard page.
  */
-#define TASK_SIZE64            (0x800000000000UL - 4096)
+#define TASK_SIZE64    ((1UL << 47) - PAGE_SIZE)
 
 /* This decides where the kernel will search for a free chunk of vm
  * space during mmap's.