]> err.no Git - linux-2.6/blobdiff - include/asm-x86/processor.h
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-2.6] / include / asm-x86 / processor.h
index b0dece41dbc4628111f13db792bb271f1a3a9a98..117343b0c271f7f3781d8d67e5e0370671b1e1a7 100644 (file)
@@ -118,7 +118,6 @@ struct cpuinfo_x86 {
 #define X86_VENDOR_CYRIX       1
 #define X86_VENDOR_AMD         2
 #define X86_VENDOR_UMC         3
-#define X86_VENDOR_NEXGEN      4
 #define X86_VENDOR_CENTAUR     5
 #define X86_VENDOR_TRANSMETA   7
 #define X86_VENDOR_NSC         8
@@ -175,12 +174,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)
@@ -354,7 +353,7 @@ struct i387_soft_struct {
        u32                     entry_eip;
 };
 
-union i387_union {
+union thread_xstate {
        struct i387_fsave_struct        fsave;
        struct i387_fxsave_struct       fxsave;
        struct i387_soft_struct         soft;
@@ -365,6 +364,9 @@ DECLARE_PER_CPU(struct orig_ist, orig_ist);
 #endif
 
 extern void print_cpu_info(struct cpuinfo_x86 *);
+extern unsigned int xstate_size;
+extern void free_thread_xstate(struct task_struct *);
+extern struct kmem_cache *task_xstate_cachep;
 extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
 extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
 extern unsigned short num_cache_leaves;
@@ -397,8 +399,8 @@ struct thread_struct {
        unsigned long           cr2;
        unsigned long           trap_no;
        unsigned long           error_code;
-       /* Floating point info: */
-       union i387_union        i387 __attribute__((aligned(16)));;
+       /* floating point and extended processor state */
+       union thread_xstate     *xstate;
 #ifdef CONFIG_X86_32
        /* Virtual 86 mode info */
        struct vm86_struct __user *vm86_info;
@@ -427,17 +429,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();
        }
@@ -478,14 +486,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
 }
 
@@ -523,8 +531,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);
 }
@@ -680,7 +688,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)
@@ -694,32 +702,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);
@@ -915,4 +920,11 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
 
 #define KSTK_EIP(task)         (task_pt_regs(task)->ip)
 
+/* Get/set a process' ability to use the timestamp counter instruction */
+#define GET_TSC_CTL(adr)       get_tsc_mode((adr))
+#define SET_TSC_CTL(val)       set_tsc_mode((val))
+
+extern int get_tsc_mode(unsigned long adr);
+extern int set_tsc_mode(unsigned int val);
+
 #endif