[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86: remove unused x87 remnants of 32-bit days
commit 3638ec1c5cdf48811b18c4059ce339c6a8b278b2 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Fri Oct 16 17:44:35 2015 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Fri Oct 16 17:44:35 2015 +0200 x86: remove unused x87 remnants of 32-bit days x86-64 requires FXSR, XMM, and XMM2, so there's no point in hiding respective code behind conditionals. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/arch/x86/hvm/emulate.c | 3 +- xen/arch/x86/i387.c | 41 ++++++------------------------------- xen/arch/x86/setup.c | 5 +--- xen/include/asm-x86/cpufeature.h | 3 -- xen/include/asm-x86/i387.h | 25 ++++++++-------------- xen/include/asm-x86/page.h | 9 ++----- 6 files changed, 21 insertions(+), 65 deletions(-) diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index 39774b7..eeb5963 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -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; diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c index 14f2a79..66b51cb 100644 --- a/xen/arch/x86/i387.c +++ b/xen/arch/x86/i387.c @@ -19,15 +19,12 @@ 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; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 972fbef..9975cd2 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -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); diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h index 3934934..9f0368e 100644 --- a/xen/include/asm-x86/cpufeature.h +++ b/xen/include/asm-x86/cpufeature.h @@ -184,9 +184,6 @@ #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 diff --git a/xen/include/asm-x86/i387.h b/xen/include/asm-x86/i387.h index 150a09e..7cfa215 100644 --- a/xen/include/asm-x86/i387.h +++ b/xen/include/asm-x86/i387.h @@ -17,22 +17,15 @@ /* 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); diff --git a/xen/include/asm-x86/page.h b/xen/include/asm-x86/page.h index 87b3341..a095a93 100644 --- a/xen/include/asm-x86/page.h +++ b/xen/include/asm-x86/page.h @@ -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)) -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |