summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/amd64/amd64/vmm.c4
-rw-r--r--sys/arch/amd64/include/vmmvar.h5
2 files changed, 6 insertions, 3 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c
index 2c9142d51ea..2e0d9d9296c 100644
--- a/sys/arch/amd64/amd64/vmm.c
+++ b/sys/arch/amd64/amd64/vmm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmm.c,v 1.138 2017/05/02 02:57:46 mlarkin Exp $ */
+/* $OpenBSD: vmm.c,v 1.139 2017/05/05 07:46:59 mlarkin Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@@ -1396,6 +1396,7 @@ vcpu_readregs_vmx(struct vcpu *vcpu, uint64_t regmask,
}
if (regmask & VM_RWREGS_CRS) {
crs[VCPU_REGS_CR2] = vcpu->vc_gueststate.vg_cr2;
+ crs[VCPU_REGS_XCR0] = vcpu->vc_gueststate.vg_xcr0;
if (vmread(VMCS_GUEST_IA32_CR0, &crs[VCPU_REGS_CR0]))
goto errout;
if (vmread(VMCS_GUEST_IA32_CR3, &crs[VCPU_REGS_CR3]))
@@ -1522,6 +1523,7 @@ vcpu_writeregs_vmx(struct vcpu *vcpu, uint64_t regmask, int loadvmcs,
goto errout;
}
if (regmask & VM_RWREGS_CRS) {
+ vcpu->vc_gueststate.vg_xcr0 = crs[VCPU_REGS_XCR0];
if (vmwrite(VMCS_GUEST_IA32_CR0, crs[VCPU_REGS_CR0]))
goto errout;
if (vmwrite(VMCS_GUEST_IA32_CR3, crs[VCPU_REGS_CR3]))
diff --git a/sys/arch/amd64/include/vmmvar.h b/sys/arch/amd64/include/vmmvar.h
index 27ecd66ce2e..6c4f0b45b47 100644
--- a/sys/arch/amd64/include/vmmvar.h
+++ b/sys/arch/amd64/include/vmmvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmmvar.h,v 1.36 2017/05/02 02:57:46 mlarkin Exp $ */
+/* $OpenBSD: vmmvar.h,v 1.37 2017/05/05 07:46:59 mlarkin Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@@ -328,7 +328,8 @@ struct vcpu_segment_info {
#define VCPU_REGS_CR3 2
#define VCPU_REGS_CR4 3
#define VCPU_REGS_CR8 4
-#define VCPU_REGS_NCRS (VCPU_REGS_CR8 + 1)
+#define VCPU_REGS_XCR0 5
+#define VCPU_REGS_NCRS (VCPU_REGS_XCR0 + 1)
#define VCPU_REGS_CS 0
#define VCPU_REGS_DS 1