[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-4.1-testing] x86/xsave: provide guests with finit-like environment
# HG changeset patch # User Jan Beulich <jbeulich@xxxxxxxx> # Date 1331109808 0 # Node ID b0bf2fc4eff937bf82f0fc16e9e0079990e0c27e # Parent e03aa3794cff3c5f6a5d87d9a282daf7baa1ddc7 x86/xsave: provide guests with finit-like environment Without the use of xsave, guests get their initial floating point environment set up with finit. At least NetWare actually depends on this (in particular on all exceptions being masked), so to be consistent set the same environment also when using xsave. This is also in line with all SSE exceptions getting masked initially. To avoid further fragile casts in xstate_alloc_save_area() the patch also changes xsave_struct's fpu_see member to have actually usable fields. The patch was tested in its technically identical, but modified-file- wise different 4.1.2 version. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Tested-by: Charles Arnold <carnold@xxxxxxxx> Acked-by: Keir Fraser <keir@xxxxxxx> xen-unstable changeset: 24157:7b5e1cb94bfa xen-unstable date: Fri Nov 18 09:22:45 2011 +0100 --- diff -r e03aa3794cff -r b0bf2fc4eff9 xen/arch/x86/i387.c --- a/xen/arch/x86/i387.c Wed Mar 07 08:39:21 2012 +0000 +++ b/xen/arch/x86/i387.c Wed Mar 07 08:43:28 2012 +0000 @@ -287,7 +287,7 @@ int xsave_alloc_save_area(struct vcpu *v) { - void *save_area; + struct xsave_struct *save_area; if ( !cpu_has_xsave || is_idle_vcpu(v) ) return 0; @@ -300,8 +300,9 @@ return -ENOMEM; memset(save_area, 0, xsave_cntxt_size); - ((u32 *)save_area)[6] = 0x1f80; /* MXCSR */ - *(uint64_t *)(save_area + 512) = XSTATE_FP_SSE; /* XSETBV */ + save_area->fpu_sse.fcw = FCW_DEFAULT; + save_area->fpu_sse.mxcsr = MXCSR_DEFAULT; + save_area->xsave_hdr.xstate_bv = XSTATE_FP_SSE; v->arch.xsave_area = save_area; v->arch.xcr0 = XSTATE_FP_SSE; diff -r e03aa3794cff -r b0bf2fc4eff9 xen/include/asm-x86/i387.h --- a/xen/include/asm-x86/i387.h Wed Mar 07 08:39:21 2012 +0000 +++ b/xen/include/asm-x86/i387.h Wed Mar 07 08:43:28 2012 +0000 @@ -35,9 +35,34 @@ #define XSTATE_YMM_SIZE 256 #define XSAVEOPT (1 << 0) +#define FCW_DEFAULT 0x037f +#define MXCSR_DEFAULT 0x1f80 + struct xsave_struct { - struct { char x[512]; } fpu_sse; /* FPU/MMX, SSE */ + union { /* FPU/MMX, SSE */ + char x[512]; + struct { + uint16_t fcw; + uint16_t fsw; + uint8_t ftw; + uint8_t rsvd1; + uint16_t fop; + union { +#ifdef __x86_64__ + uint64_t addr; +#endif + struct { + uint32_t offs; + uint16_t sel; + uint16_t rsvd; + }; + } fip, fdp; + uint32_t mxcsr; + uint32_t mxcsr_mask; + /* data registers follow here */ + }; + } fpu_sse; struct { u64 xstate_bv; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |