Commit 36241b8c authored by Avi Kivity's avatar Avi Kivity Committed by Linus Torvalds

[PATCH] KVM: AMD SVM: Save and restore the floating point unit state

Fixes sf bug 1614113 (segfaults in nbench).
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0e859cac
...@@ -575,6 +575,8 @@ static int svm_create_vcpu(struct kvm_vcpu *vcpu) ...@@ -575,6 +575,8 @@ static int svm_create_vcpu(struct kvm_vcpu *vcpu)
memset(vcpu->svm->db_regs, 0, sizeof(vcpu->svm->db_regs)); memset(vcpu->svm->db_regs, 0, sizeof(vcpu->svm->db_regs));
init_vmcb(vcpu->svm->vmcb); init_vmcb(vcpu->svm->vmcb);
fx_init(vcpu);
return 0; return 0;
out2: out2:
...@@ -1387,6 +1389,10 @@ again: ...@@ -1387,6 +1389,10 @@ again:
save_db_regs(vcpu->svm->host_db_regs); save_db_regs(vcpu->svm->host_db_regs);
load_db_regs(vcpu->svm->db_regs); load_db_regs(vcpu->svm->db_regs);
} }
fx_save(vcpu->host_fx_image);
fx_restore(vcpu->guest_fx_image);
asm volatile ( asm volatile (
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
"push %%rbx; push %%rcx; push %%rdx;" "push %%rbx; push %%rcx; push %%rdx;"
...@@ -1496,6 +1502,9 @@ again: ...@@ -1496,6 +1502,9 @@ again:
#endif #endif
: "cc", "memory" ); : "cc", "memory" );
fx_save(vcpu->guest_fx_image);
fx_restore(vcpu->host_fx_image);
if ((vcpu->svm->vmcb->save.dr7 & 0xff)) if ((vcpu->svm->vmcb->save.dr7 & 0xff))
load_db_regs(vcpu->svm->host_db_regs); load_db_regs(vcpu->svm->host_db_regs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment