Skip to contentSkip to conversation

SVM: fix lazy FPU switching

PATCH New Joerg Roedel 1 participant 1 message Jan 17, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SVM: fix lazy FPU switching

If the guest writes to cr0 and leaves the TS flag at 0 while vcpu->fpu_active is also 0, the TS flag in the guests cr0 gets lost. This leads to corrupt FPU state an causes Windows Vista 64bit to crash very soon after boot. This patch fixes this bug.

---
 arch/x86/kvm/svm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/x86/kvm/svm.c +2 -0
index 2da9e11..7bdbe16 100644
@@ -792,6 +792,8 @@ static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
 	vcpu->arch.cr0 = cr0;
 	cr0 |= X86_CR0_PG | X86_CR0_WP;
 	cr0 &= ~(X86_CR0_CD | X86_CR0_NW);
+	if (!vcpu->fpu_active)
+		cr0 |= X86_CR0_TS;
 	svm->vmcb->save.cr0 = cr0;
 }
 
Signature · 9 lines
1.5.3.7




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/