diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-02-15 00:37:15 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-02-15 00:37:15 +0100 |
commit | b173c373787f560ebf87507325424a215137fbe8 (patch) | |
tree | a643d0e8e0f05696a76cac35ca8be88ec7888caf /xen/include/asm-x86/i387.h | |
parent | 91e612aea0725c21a814c10f46042bd1707aa4b6 (diff) | |
download | xen-b173c373787f560ebf87507325424a215137fbe8.tar.gz xen-b173c373787f560ebf87507325424a215137fbe8.tar.bz2 xen-b173c373787f560ebf87507325424a215137fbe8.zip |
Fix to previous changeset: CLTS must be unconditional in
setup_fpu(), as the flag can be set in CR0 even if the VCPU
has already dirtied the FPU (this happens if a paravirtualised
guest has set CR0.TS).
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/include/asm-x86/i387.h')
-rw-r--r-- | xen/include/asm-x86/i387.h | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/xen/include/asm-x86/i387.h b/xen/include/asm-x86/i387.h index fa9ba43e90..a324af013f 100644 --- a/xen/include/asm-x86/i387.h +++ b/xen/include/asm-x86/i387.h @@ -15,25 +15,26 @@ #include <asm/processor.h> extern void init_fpu(void); -extern void save_init_fpu(struct vcpu *tsk); -extern void restore_fpu(struct vcpu *tsk); +extern void save_init_fpu(struct vcpu *v); +extern void restore_fpu(struct vcpu *v); -#define unlazy_fpu(_tsk) do { \ - if ( test_bit(_VCPUF_fpu_dirtied, &(_tsk)->vcpu_flags) ) \ - save_init_fpu(_tsk); \ +#define unlazy_fpu(v) do { \ + if ( test_bit(_VCPUF_fpu_dirtied, &(v)->vcpu_flags) ) \ + save_init_fpu(v); \ } while ( 0 ) -#define load_mxcsr( val ) do { \ - unsigned long __mxcsr = ((unsigned long)(val) & 0xffbf); \ - __asm__ __volatile__ ( "ldmxcsr %0" : : "m" (__mxcsr) ); \ +#define load_mxcsr(val) do { \ + unsigned long __mxcsr = ((unsigned long)(val) & 0xffbf); \ + __asm__ __volatile__ ( "ldmxcsr %0" : : "m" (__mxcsr) ); \ } while ( 0 ) -/* Make domain the FPU owner */ static inline void setup_fpu(struct vcpu *v) { + /* Avoid recursion. */ + clts(); + if ( !test_and_set_bit(_VCPUF_fpu_dirtied, &v->vcpu_flags) ) { - clts(); if ( test_bit(_VCPUF_fpu_initialised, &v->vcpu_flags) ) restore_fpu(v); else |