|
|
|
|
|
|
|
|
|
|
xen-changelog
[Xen-changelog] Clean up save_init_fpu().
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID ee6f025fb264214047b152e5583d4d5da03a1c22
# Parent 646edff074752a5c943a361efda800ff521be9d5
Clean up save_init_fpu().
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
diff -r 646edff07475 -r ee6f025fb264 xen/arch/x86/i387.c
--- a/xen/arch/x86/i387.c Tue Feb 14 21:36:22 2006
+++ b/xen/arch/x86/i387.c Tue Feb 14 22:30:59 2006
@@ -23,30 +23,28 @@
set_bit(_VCPUF_fpu_initialised, ¤t->vcpu_flags);
}
-void save_init_fpu(struct vcpu *tsk)
+void save_init_fpu(struct vcpu *v)
{
- /*
- * 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 ( HVM_DOMAIN(tsk) || (tsk->arch.guest_context.ctrlreg[0] & X86_CR0_TS) )
+ unsigned long cr0 = read_cr0();
+
+ /* This can happen, if a paravirtualised guest OS has set its CR0.TS. */
+ if ( cr0 & X86_CR0_TS )
clts();
if ( cpu_has_fxsr )
__asm__ __volatile__ (
"fxsave %0 ; fnclex"
- : "=m" (tsk->arch.guest_context.fpu_ctxt) );
+ : "=m" (v->arch.guest_context.fpu_ctxt) );
else
__asm__ __volatile__ (
"fnsave %0 ; fwait"
- : "=m" (tsk->arch.guest_context.fpu_ctxt) );
+ : "=m" (v->arch.guest_context.fpu_ctxt) );
- clear_bit(_VCPUF_fpu_dirtied, &tsk->vcpu_flags);
- stts();
+ clear_bit(_VCPUF_fpu_dirtied, &v->vcpu_flags);
+ write_cr0(cr0|X86_CR0_TS);
}
-void restore_fpu(struct vcpu *tsk)
+void restore_fpu(struct vcpu *v)
{
/*
* FXRSTOR can fault if passed a corrupted data block. We handle this
@@ -74,12 +72,12 @@
" "__FIXUP_WORD" 1b,2b \n"
".previous \n"
:
- : "m" (tsk->arch.guest_context.fpu_ctxt),
- "i" (sizeof(tsk->arch.guest_context.fpu_ctxt)/4) );
+ : "m" (v->arch.guest_context.fpu_ctxt),
+ "i" (sizeof(v->arch.guest_context.fpu_ctxt)/4) );
else
__asm__ __volatile__ (
"frstor %0"
- : : "m" (tsk->arch.guest_context.fpu_ctxt) );
+ : : "m" (v->arch.guest_context.fpu_ctxt) );
}
/*
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-changelog] Clean up save_init_fpu().,
Xen patchbot -unstable <=
|
|
|
|
|