mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
bitkeeper revision 1.7.1.6 (3df08cc8US1aforRcF-D7KIyM9F8Bw)
traps.c, setup.c, i387.c: Fix floating-point ctxt-switch code
This commit is contained in:
1 parent
8aa0427477
commit
898bb9837e
4 files changed
+22
-11
No files matched your search
@@ -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
|
||||
+16
-10
@@ -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 )
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) )
|
||||
{
|
||||
|
||||