ia64/xen-unstable

view xen/include/asm-x86/i387.h @ 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 b7ae31726aa6
line source
1 /*
2 * include/asm-i386/i387.h
3 *
4 * Copyright (C) 1994 Linus Torvalds
5 *
6 * Pentium III FXSR, SSE support
7 * General FPU state handling cleanups
8 * Gareth Hughes <gareth@valinux.com>, May 2000
9 */
11 #ifndef __ASM_I386_I387_H
12 #define __ASM_I386_I387_H
14 #include <xen/sched.h>
15 #include <asm/processor.h>
17 extern void init_fpu(void);
18 extern void save_init_fpu(struct vcpu *v);
19 extern void restore_fpu(struct vcpu *v);
21 #define unlazy_fpu(v) do { \
22 if ( test_bit(_VCPUF_fpu_dirtied, &(v)->vcpu_flags) ) \
23 save_init_fpu(v); \
24 } while ( 0 )
26 #define load_mxcsr(val) do { \
27 unsigned long __mxcsr = ((unsigned long)(val) & 0xffbf); \
28 __asm__ __volatile__ ( "ldmxcsr %0" : : "m" (__mxcsr) ); \
29 } while ( 0 )
31 static inline void setup_fpu(struct vcpu *v)
32 {
33 /* Avoid recursion. */
34 clts();
36 if ( !test_and_set_bit(_VCPUF_fpu_dirtied, &v->vcpu_flags) )
37 {
38 if ( test_bit(_VCPUF_fpu_initialised, &v->vcpu_flags) )
39 restore_fpu(v);
40 else
41 init_fpu();
42 }
43 }
45 #endif /* __ASM_I386_I387_H */