]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] KVM: AMD SVM: Save and restore the floating point unit state
authorAvi Kivity <avi@qumranet.com>
Fri, 22 Dec 2006 09:05:20 +0000 (01:05 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Fri, 22 Dec 2006 16:55:46 +0000 (08:55 -0800)
Fixes sf bug 1614113 (segfaults in nbench).

Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/kvm/svm.c

index 3bf25795b3ef070204064989af3fd605c43d727b..59c930f276e2d8e47ced6e761ecfba191c2c9604 100644 (file)
@@ -575,6 +575,8 @@ static int svm_create_vcpu(struct kvm_vcpu *vcpu)
        memset(vcpu->svm->db_regs, 0, sizeof(vcpu->svm->db_regs));
        init_vmcb(vcpu->svm->vmcb);
 
+       fx_init(vcpu);
+
        return 0;
 
 out2:
@@ -1387,6 +1389,10 @@ again:
                save_db_regs(vcpu->svm->host_db_regs);
                load_db_regs(vcpu->svm->db_regs);
        }
+
+       fx_save(vcpu->host_fx_image);
+       fx_restore(vcpu->guest_fx_image);
+
        asm volatile (
 #ifdef CONFIG_X86_64
                "push %%rbx; push %%rcx; push %%rdx;"
@@ -1496,6 +1502,9 @@ again:
 #endif
                : "cc", "memory" );
 
+       fx_save(vcpu->guest_fx_image);
+       fx_restore(vcpu->host_fx_image);
+
        if ((vcpu->svm->vmcb->save.dr7 & 0xff))
                load_db_regs(vcpu->svm->host_db_regs);