aboutsummaryrefslogtreecommitdiffstats
path: root/xen-2.4.16/arch/i386/i387.c
diff options
context:
space:
mode:
Diffstat (limited to 'xen-2.4.16/arch/i386/i387.c')
-rw-r--r--xen-2.4.16/arch/i386/i387.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/xen-2.4.16/arch/i386/i387.c b/xen-2.4.16/arch/i386/i387.c
index dc94cc1dad..fe34ff16f5 100644
--- a/xen-2.4.16/arch/i386/i387.c
+++ b/xen-2.4.16/arch/i386/i387.c
@@ -22,20 +22,26 @@ void init_fpu(void)
static inline void __save_init_fpu( struct task_struct *tsk )
{
- if ( cpu_has_fxsr ) {
- asm volatile( "fxsave %0 ; fnclex"
- : "=m" (tsk->thread.i387.fxsave) );
- } else {
- asm volatile( "fnsave %0 ; fwait"
- : "=m" (tsk->thread.i387.fsave) );
- }
- tsk->flags &= ~PF_USEDFPU;
+ if ( cpu_has_fxsr ) {
+ asm volatile( "fxsave %0 ; fnclex"
+ : "=m" (tsk->thread.i387.fxsave) );
+ } else {
+ asm volatile( "fnsave %0 ; fwait"
+ : "=m" (tsk->thread.i387.fsave) );
+ }
+ tsk->flags &= ~PF_USEDFPU;
}
void save_init_fpu( struct task_struct *tsk )
{
- __save_init_fpu(tsk);
- stts();
+ /*
+ * The guest OS may have set the 'virtual STTS' flag.
+ * This causes us to set the real flag, so we'll need
+ * to temporarily clear it while saving f-p state.
+ */
+ if ( tsk->flags & PF_GUEST_STTS ) clts();
+ __save_init_fpu(tsk);
+ stts();
}
void restore_fpu( struct task_struct *tsk )