summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2019-02-20 07:00:26 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2019-02-20 07:00:26 +0000
commit1387d0fd8059fdd57500a23ee0b3d588eae6d3f8 (patch)
tree0f92972b73aeca0317395afcb00d51ce38219901
parentbc63c19e092d0f4d7a49de3c0c8686b96a634e25 (diff)
vmd(8): initialize guest %drX registers to power-on defaults on launch
Initializes the %drX registers to power on defaults, and bump the VM send/recieve header to reflect same discussed with deraadt@
-rw-r--r--usr.sbin/vmd/vm.c14
-rw-r--r--usr.sbin/vmd/vmd.h4
2 files changed, 15 insertions, 3 deletions
diff --git a/usr.sbin/vmd/vm.c b/usr.sbin/vmd/vm.c
index d76edf0aab7..223ad283854 100644
--- a/usr.sbin/vmd/vm.c
+++ b/usr.sbin/vmd/vm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm.c,v 1.43 2018/12/10 21:30:33 claudio Exp $ */
+/* $OpenBSD: vm.c,v 1.44 2019/02/20 07:00:25 mlarkin Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -154,6 +154,12 @@ static const struct vcpu_reg_state vcpu_init_flat64 = {
.vrs_sregs[VCPU_REGS_LDTR] = { 0x0, 0xFFFF, 0x0082, 0x0},
.vrs_sregs[VCPU_REGS_TR] = { 0x0, 0xFFFF, 0x008B, 0x0},
.vrs_msrs[VCPU_REGS_EFER] = EFER_LME | EFER_LMA,
+ .vrs_drs[VCPU_REGS_DR0] = 0x0,
+ .vrs_drs[VCPU_REGS_DR1] = 0x0,
+ .vrs_drs[VCPU_REGS_DR2] = 0x0,
+ .vrs_drs[VCPU_REGS_DR3] = 0x0,
+ .vrs_drs[VCPU_REGS_DR6] = 0xFFFF0FF0,
+ .vrs_drs[VCPU_REGS_DR7] = 0x400,
#ifndef __i386__
.vrs_msrs[VCPU_REGS_STAR] = 0ULL,
.vrs_msrs[VCPU_REGS_LSTAR] = 0ULL,
@@ -192,6 +198,12 @@ static const struct vcpu_reg_state vcpu_init_flat16 = {
.vrs_sregs[VCPU_REGS_LDTR] = { 0x0, 0xFFFF, 0x0082, 0x0},
.vrs_sregs[VCPU_REGS_TR] = { 0x0, 0xFFFF, 0x008B, 0x0},
.vrs_msrs[VCPU_REGS_EFER] = 0ULL,
+ .vrs_drs[VCPU_REGS_DR0] = 0x0,
+ .vrs_drs[VCPU_REGS_DR1] = 0x0,
+ .vrs_drs[VCPU_REGS_DR2] = 0x0,
+ .vrs_drs[VCPU_REGS_DR3] = 0x0,
+ .vrs_drs[VCPU_REGS_DR6] = 0xFFFF0FF0,
+ .vrs_drs[VCPU_REGS_DR7] = 0x400,
#ifndef __i386__
.vrs_msrs[VCPU_REGS_STAR] = 0ULL,
.vrs_msrs[VCPU_REGS_LSTAR] = 0ULL,
diff --git a/usr.sbin/vmd/vmd.h b/usr.sbin/vmd/vmd.h
index 7eab80c7f6f..bf1fb58ea7a 100644
--- a/usr.sbin/vmd/vmd.h
+++ b/usr.sbin/vmd/vmd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmd.h,v 1.89 2018/12/10 21:30:33 claudio Exp $ */
+/* $OpenBSD: vmd.h,v 1.90 2019/02/20 07:00:25 mlarkin Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -214,7 +214,7 @@ struct vm_dump_header {
#define VM_DUMP_SIGNATURE VMM_HV_SIGNATURE
uint8_t vmh_pad[3];
uint8_t vmh_version;
-#define VM_DUMP_VERSION 5
+#define VM_DUMP_VERSION 6
struct vm_dump_header_cpuid
vmh_cpuids[VM_DUMP_HEADER_CPUID_COUNT];
} __packed;