ia64/xen-unstable

changeset 8853:166322cd55df

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>
author kaf24@firebug.cl.cam.ac.uk
date Wed Feb 15 00:37:15 2006 +0100 (2006-02-15)
parents 7d89f672aa49
children de0408f095f8
files xen/include/asm-x86/i387.h
line diff
     1.1 --- a/xen/include/asm-x86/i387.h	Wed Feb 15 00:15:11 2006 +0100
     1.2 +++ b/xen/include/asm-x86/i387.h	Wed Feb 15 00:37:15 2006 +0100
     1.3 @@ -15,25 +15,26 @@
     1.4  #include <asm/processor.h>
     1.5  
     1.6  extern void init_fpu(void);
     1.7 -extern void save_init_fpu(struct vcpu *tsk);
     1.8 -extern void restore_fpu(struct vcpu *tsk);
     1.9 +extern void save_init_fpu(struct vcpu *v);
    1.10 +extern void restore_fpu(struct vcpu *v);
    1.11  
    1.12 -#define unlazy_fpu(_tsk) do { \
    1.13 -    if ( test_bit(_VCPUF_fpu_dirtied, &(_tsk)->vcpu_flags) ) \
    1.14 -        save_init_fpu(_tsk); \
    1.15 +#define unlazy_fpu(v) do {                                      \
    1.16 +    if ( test_bit(_VCPUF_fpu_dirtied, &(v)->vcpu_flags) )       \
    1.17 +        save_init_fpu(v);                                       \
    1.18  } while ( 0 )
    1.19  
    1.20 -#define load_mxcsr( val ) do { \
    1.21 -    unsigned long __mxcsr = ((unsigned long)(val) & 0xffbf); \
    1.22 -    __asm__ __volatile__ ( "ldmxcsr %0" : : "m" (__mxcsr) ); \
    1.23 +#define load_mxcsr(val) do {                                    \
    1.24 +    unsigned long __mxcsr = ((unsigned long)(val) & 0xffbf);    \
    1.25 +    __asm__ __volatile__ ( "ldmxcsr %0" : : "m" (__mxcsr) );    \
    1.26  } while ( 0 )
    1.27  
    1.28 -/* Make domain the FPU owner */
    1.29  static inline void setup_fpu(struct vcpu *v)
    1.30  {
    1.31 +    /* Avoid recursion. */
    1.32 +    clts();
    1.33 +
    1.34      if ( !test_and_set_bit(_VCPUF_fpu_dirtied, &v->vcpu_flags) )
    1.35      {
    1.36 -        clts();
    1.37          if ( test_bit(_VCPUF_fpu_initialised, &v->vcpu_flags) )
    1.38              restore_fpu(v);
    1.39          else