aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/svm.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2006-12-22 04:05:20 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-22 11:55:46 -0500
commit36241b8c7cbcc83e7fd534d25e1df8339db8244e (patch)
tree7e62afdbe018c826599b83871d33b3c1cdd5a5d9 /drivers/kvm/svm.c
parent0e859cacb0b01bdbe34b5200dd2457d4818248fa (diff)
[PATCH] KVM: AMD SVM: Save and restore the floating point unit state
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>
Diffstat (limited to 'drivers/kvm/svm.c')
-rw-r--r--drivers/kvm/svm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index 3bf25795b3ef..59c930f276e2 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -575,6 +575,8 @@ static int svm_create_vcpu(struct kvm_vcpu *vcpu)
575 memset(vcpu->svm->db_regs, 0, sizeof(vcpu->svm->db_regs)); 575 memset(vcpu->svm->db_regs, 0, sizeof(vcpu->svm->db_regs));
576 init_vmcb(vcpu->svm->vmcb); 576 init_vmcb(vcpu->svm->vmcb);
577 577
578 fx_init(vcpu);
579
578 return 0; 580 return 0;
579 581
580out2: 582out2:
@@ -1387,6 +1389,10 @@ again:
1387 save_db_regs(vcpu->svm->host_db_regs); 1389 save_db_regs(vcpu->svm->host_db_regs);
1388 load_db_regs(vcpu->svm->db_regs); 1390 load_db_regs(vcpu->svm->db_regs);
1389 } 1391 }
1392
1393 fx_save(vcpu->host_fx_image);
1394 fx_restore(vcpu->guest_fx_image);
1395
1390 asm volatile ( 1396 asm volatile (
1391#ifdef CONFIG_X86_64 1397#ifdef CONFIG_X86_64
1392 "push %%rbx; push %%rcx; push %%rdx;" 1398 "push %%rbx; push %%rcx; push %%rdx;"
@@ -1496,6 +1502,9 @@ again:
1496#endif 1502#endif
1497 : "cc", "memory" ); 1503 : "cc", "memory" );
1498 1504
1505 fx_save(vcpu->guest_fx_image);
1506 fx_restore(vcpu->host_fx_image);
1507
1499 if ((vcpu->svm->vmcb->save.dr7 & 0xff)) 1508 if ((vcpu->svm->vmcb->save.dr7 & 0xff))
1500 load_db_regs(vcpu->svm->host_db_regs); 1509 load_db_regs(vcpu->svm->host_db_regs);
1501 1510