From b20c83a00eb7205be44c0c97d06ccab29f1a6114 Mon Sep 17 00:00:00 2001 From: Philip Guenther Date: Sat, 30 Jun 2018 19:24:08 +0000 Subject: 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@ --- sys/arch/amd64/amd64/vmm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/arch/amd64') 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 * @@ -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)) { -- cgit v1.2.3