]> xenbits.xensource.com Git - people/julieng/xen-unstable.git/commitdiff
x86: remove unused x87 remnants of 32-bit days
authorJan Beulich <jbeulich@suse.com>
Fri, 16 Oct 2015 15:44:35 +0000 (17:44 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 16 Oct 2015 15:44:35 +0000 (17:44 +0200)
x86-64 requires FXSR, XMM, and XMM2, so there's no point in hiding
respective code behind conditionals.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/hvm/emulate.c
xen/arch/x86/i387.c
xen/arch/x86/setup.c
xen/include/asm-x86/cpufeature.h
xen/include/asm-x86/i387.h
xen/include/asm-x86/page.h

index 39774b77163b01f2842c69f99d3ba858a4bb9d83..eeb596335a310cfc5fa70d313b6128d1b24c6db1 100644 (file)
@@ -1542,8 +1542,7 @@ static int hvmemul_get_fpu(
             return X86EMUL_UNHANDLEABLE;
         break;
     case X86EMUL_FPU_xmm:
-        if ( !cpu_has_xmm ||
-             (curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_EM) ||
+        if ( (curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_EM) ||
              !(curr->arch.hvm_vcpu.guest_cr[4] & X86_CR4_OSFXSR) )
             return X86EMUL_UNHANDLEABLE;
         break;
index 14f2a79e7b333d9d53918bfe2c7df8ac123f75e8..66b51cbcb4c924728147780a8ef27f355705c6d5 100644 (file)
 
 static void fpu_init(void)
 {
-    unsigned long val;
-    
+    uint32_t val = MXCSR_DEFAULT;
+
     asm volatile ( "fninit" );
-    if ( cpu_has_xmm )
-    {
-        /* load default value into MXCSR control/status register */
-        val = MXCSR_DEFAULT;
-        asm volatile ( "ldmxcsr %0" : : "m" (val) );
-    }
+
+    /* load default value into MXCSR control/status register */
+    asm volatile ( "ldmxcsr %0" : : "m" (val) );
 }
 
 /*******************************/
@@ -122,14 +119,6 @@ static inline void fpu_fxrstor(struct vcpu *v)
     }
 }
 
-/* Restore x87 extended state */
-static inline void fpu_frstor(struct vcpu *v)
-{
-    const char *fpu_ctxt = v->arch.fpu_ctxt;
-
-    asm volatile ( "frstor %0" : : "m" (*fpu_ctxt) );
-}
-
 /*******************************/
 /*      FPU Save Functions     */
 /*******************************/
@@ -206,15 +195,6 @@ static inline void fpu_fxsave(struct vcpu *v)
         fpu_ctxt->x[FPU_WORD_SIZE_OFFSET] = word_size;
 }
 
-/* Save x87 FPU state */
-static inline void fpu_fsave(struct vcpu *v)
-{
-    char *fpu_ctxt = v->arch.fpu_ctxt;
-
-    /* FWAIT is required to make FNSAVE synchronous. */
-    asm volatile ( "fnsave %0 ; fwait" : "=m" (*fpu_ctxt) );
-}
-
 /*******************************/
 /*       VCPU FPU Functions    */
 /*******************************/
@@ -249,12 +229,7 @@ void vcpu_restore_fpu_lazy(struct vcpu *v)
     if ( cpu_has_xsave )
         fpu_xrstor(v, XSTATE_LAZY);
     else if ( v->fpu_initialised )
-    {
-        if ( cpu_has_fxsr )
-            fpu_fxrstor(v);
-        else
-            fpu_frstor(v);
-    }
+        fpu_fxrstor(v);
     else
         fpu_init();
 
@@ -278,10 +253,8 @@ static bool_t _vcpu_save_fpu(struct vcpu *v)
 
     if ( cpu_has_xsave )
         fpu_xsave(v);
-    else if ( cpu_has_fxsr )
-        fpu_fxsave(v);
     else
-        fpu_fsave(v);
+        fpu_fxsave(v);
 
     v->fpu_dirtied = 0;
 
index 972fbef36fd7060f747b18af5d9c502c9dcccf44..9975cd2421537a4b095262e14eb5a06b01122a22 100644 (file)
@@ -1295,10 +1295,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     identify_cpu(&boot_cpu_data);
 
-    if ( cpu_has_fxsr )
-        set_in_cr4(X86_CR4_OSFXSR);
-    if ( cpu_has_xmm )
-        set_in_cr4(X86_CR4_OSXMMEXCPT);
+    set_in_cr4(X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT);
 
     if ( disable_smep )
         setup_clear_cpu_cap(X86_FEATURE_SMEP);
index 39349349b5e61198bebf082044e49b8011bd2f1c..9f0368e1a0b4a4357af08a7f9f975a2766a326d2 100644 (file)
 #define cpu_has_sep            boot_cpu_has(X86_FEATURE_SEP)
 #define cpu_has_mtrr           1
 #define cpu_has_mmx            1
-#define cpu_has_fxsr           1
-#define cpu_has_xmm            1
-#define cpu_has_xmm2           1
 #define cpu_has_xmm3           boot_cpu_has(X86_FEATURE_XMM3)
 #define cpu_has_ht             boot_cpu_has(X86_FEATURE_HT)
 #define cpu_has_syscall                1
index 150a09e41f150ccf5509dd972af967122515e06f..7cfa215d303b273a832b4ea512aef9e11023a40a 100644 (file)
 /* Byte offset of the stored word size within the FXSAVE area/portion. */
 #define FPU_WORD_SIZE_OFFSET 511
 
-struct ix87_state {
-    struct ix87_env {
-        uint16_t fcw, _res0;
-        uint16_t fsw, _res1;
-        uint16_t ftw, _res2;
-        uint32_t fip;
-        uint16_t fcs;
-        uint16_t fop;
-        uint32_t fdp;
-        uint16_t fds, _res6;
-    } env;
-    struct __packed ix87_reg {
-        uint64_t mantissa;
-        uint16_t exponent:15;
-        uint16_t sign:1;
-    } r[8];
+struct ix87_env {
+    uint16_t fcw, _res0;
+    uint16_t fsw, _res1;
+    uint16_t ftw, _res2;
+    uint32_t fip;
+    uint16_t fcs;
+    uint16_t fop;
+    uint32_t fdp;
+    uint16_t fds, _res6;
 };
 
 void vcpu_restore_fpu_eager(struct vcpu *v);
index 87b33418c60c902d998d00cc402f1f5f3e78aa19..a095a936a0ee743088281ca5e6051d23f39b5c3e 100644 (file)
@@ -206,13 +206,10 @@ typedef struct { u64 pfn; } pagetable_t;
 #define pagetable_null()        pagetable_from_pfn(0)
 
 void clear_page_sse2(void *);
-#define clear_page(_p)      (cpu_has_xmm2 ?                             \
-                             clear_page_sse2((void *)(_p)) :            \
-                             (void)memset((void *)(_p), 0, PAGE_SIZE))
 void copy_page_sse2(void *, const void *);
-#define copy_page(_t,_f)    (cpu_has_xmm2 ?                             \
-                             copy_page_sse2(_t, _f) :                   \
-                             (void)memcpy(_t, _f, PAGE_SIZE))
+
+#define clear_page(_p)      clear_page_sse2(_p)
+#define copy_page(_t, _f)   copy_page_sse2(_t, _f)
 
 /* Convert between Xen-heap virtual addresses and machine addresses. */
 #define __pa(x)             (virt_to_maddr(x))