summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2018-06-30 19:24:08 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2018-06-30 19:24:08 +0000
commitb20c83a00eb7205be44c0c97d06ccab29f1a6114 (patch)
tree89948867428bf4514f921f87ae5d312836f3f990 /sys/arch/amd64
parentb16e8e9f6adc43c75697e23f5ed6937bbac64c2c (diff)
Don't try to set XCR0_X87 when XSAVE isn't supported at all. Fixes
vmm on CPUs without XSAVE. Problem reported by Ax0n (ax0n (at) h-i-r.net) ok mlarkin@ deraadt@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/vmm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c
index c1e34233543..cee2d1955f7 100644
--- a/sys/arch/amd64/amd64/vmm.c
+++ b/sys/arch/amd64/amd64/vmm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmm.c,v 1.203 2018/06/29 04:50:47 mlarkin Exp $ */
+/* $OpenBSD: vmm.c,v 1.204 2018/06/30 19:24:07 guenther Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@@ -1971,7 +1971,7 @@ vcpu_reset_regs_svm(struct vcpu *vcpu, struct vcpu_reg_state *vrs)
ret = vcpu_writeregs_svm(vcpu, VM_RWREGS_ALL, vrs);
/* xcr0 power on default sets bit 0 (x87 state) */
- vcpu->vc_gueststate.vg_xcr0 = XCR0_X87;
+ vcpu->vc_gueststate.vg_xcr0 = XCR0_X87 & xsave_mask;
exit:
return ret;
@@ -2764,7 +2764,7 @@ vcpu_reset_regs_vmx(struct vcpu *vcpu, struct vcpu_reg_state *vrs)
/* XXX CR4 shadow */
/* xcr0 power on default sets bit 0 (x87 state) */
- vcpu->vc_gueststate.vg_xcr0 = XCR0_X87;
+ vcpu->vc_gueststate.vg_xcr0 = XCR0_X87 & xsave_mask;
/* Flush the VMCS */
if (vmclear(&vcpu->vc_control_pa)) {