diff options
author | kaf24@labyrinth.cl.cam.ac.uk <kaf24@labyrinth.cl.cam.ac.uk> | 2002-12-06 11:40:56 +0000 |
---|---|---|
committer | kaf24@labyrinth.cl.cam.ac.uk <kaf24@labyrinth.cl.cam.ac.uk> | 2002-12-06 11:40:56 +0000 |
commit | 898bb9837e46faf85ee4ff4f6cd0c18379849824 (patch) | |
tree | 266460171b04c0c01414dab00bee41a3fc65af51 | |
parent | 8aa04274778d7b3a78ed84ca68c62ea07f9983f8 (diff) | |
download | xen-898bb9837e46faf85ee4ff4f6cd0c18379849824.tar.gz xen-898bb9837e46faf85ee4ff4f6cd0c18379849824.tar.bz2 xen-898bb9837e46faf85ee4ff4f6cd0c18379849824.zip |
bitkeeper revision 1.7.1.6 (3df08cc8US1aforRcF-D7KIyM9F8Bw)
traps.c, setup.c, i387.c:
Fix floating-point ctxt-switch code
-rw-r--r-- | BitKeeper/etc/logging_ok | 1 | ||||
-rw-r--r-- | xen-2.4.16/arch/i386/i387.c | 26 | ||||
-rw-r--r-- | xen-2.4.16/arch/i386/setup.c | 3 | ||||
-rw-r--r-- | xen-2.4.16/arch/i386/traps.c | 3 |
4 files changed, 22 insertions, 11 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 825b553426..24128f27c5 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -1,4 +1,5 @@ akw27@boulderdash.cl.cam.ac.uk +kaf24@labyrinth.cl.cam.ac.uk kaf24@plym.cl.cam.ac.uk kaf24@striker.cl.cam.ac.uk smh22@boulderdash.cl.cam.ac.uk 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 ) diff --git a/xen-2.4.16/arch/i386/setup.c b/xen-2.4.16/arch/i386/setup.c index f9163148ed..3cb11f6b05 100644 --- a/xen-2.4.16/arch/i386/setup.c +++ b/xen-2.4.16/arch/i386/setup.c @@ -193,6 +193,9 @@ void __init cpu_init(void) /* No nested task. */ __asm__("pushfl ; andl $0xffffbfff,(%esp) ; popfl"); + /* Ensure FPU gets initialised for each domain. */ + stts(); + /* Set up and load the per-CPU TSS and LDT. */ t->ss0 = __HYPERVISOR_DS; t->esp0 = current->thread.esp0; diff --git a/xen-2.4.16/arch/i386/traps.c b/xen-2.4.16/arch/i386/traps.c index e84690ad1a..6fd88f35f4 100644 --- a/xen-2.4.16/arch/i386/traps.c +++ b/xen-2.4.16/arch/i386/traps.c @@ -362,7 +362,8 @@ asmlinkage void do_nmi(struct pt_regs * regs, long error_code) asmlinkage void math_state_restore(struct pt_regs *regs, long error_code) { - __asm__ __volatile__("clts"); + /* Prevent recursion. */ + clts(); if ( !(current->flags & PF_USEDFPU) ) { |