Skip to content

Commit

Permalink
[PATCH] KVM: AMD SVM: Save and restore the floating point unit state
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Avi Kivity authored and Linus Torvalds committed Dec 22, 2006
1 parent 0e859ca commit 36241b8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/kvm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -1387,6 +1389,10 @@ static int svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
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;"
Expand Down Expand Up @@ -1496,6 +1502,9 @@ static int svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
#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);

Expand Down

0 comments on commit 36241b8

Please sign in to comment.