summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/include
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2024-04-01 05:11:50 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2024-04-01 05:11:50 +0000
commit316f82e722617cebfca14dc4bfa69e0c099b9ab1 (patch)
treeac942bb96844bf986a99aca865276874b223bea6 /sys/arch/amd64/include
parent8eff732c11ec9746371df36422013a51aedc5ee4 (diff)
Delete 108 lines of ASM from vmx_enter_guest() that predated lots
of later enhancements, removing the save/restore of flags, selectors, and MSRs: flags are caller-saved and don't need restoring while selectors and MSRs are auto-restored. The FSBASE, GSBASE, and KERNELGSBASE MSRs just need the correct values set with vmwrite() in the "on new CPU?" block of vcpu_run_vmx(). Also, only rdmsr(MSR_MISC_ENABLE) once in vcpu_reset_regs_vmx(), give symbolic names to the exit-load MSR slots, eliminate VMX_NUM_MSR_STORE, and #if 0 the vc_vmx_msr_entry_load_{va,pa} code and definitions as unused. ok dv@
Diffstat (limited to 'sys/arch/amd64/include')
-rw-r--r--sys/arch/amd64/include/vmmvar.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/arch/amd64/include/vmmvar.h b/sys/arch/amd64/include/vmmvar.h
index e6a35211b0f..82aa105d395 100644
--- a/sys/arch/amd64/include/vmmvar.h
+++ b/sys/arch/amd64/include/vmmvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmmvar.h,v 1.98 2024/01/20 20:11:24 mlarkin Exp $ */
+/* $OpenBSD: vmmvar.h,v 1.99 2024/04/01 05:11:49 guenther Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@@ -435,6 +435,15 @@ struct vcpu_reg_state {
struct vcpu_segment_info vrs_idtr;
};
+#define VCPU_HOST_REGS_EFER 0
+#define VCPU_HOST_REGS_STAR 1
+#define VCPU_HOST_REGS_LSTAR 2
+#define VCPU_HOST_REGS_CSTAR 3
+#define VCPU_HOST_REGS_SFMASK 4
+#define VCPU_HOST_REGS_KGSBASE 5
+#define VCPU_HOST_REGS_MISC_ENABLE 6
+#define VCPU_HOST_REGS_NMSRS (VCPU_HOST_REGS_MISC_ENABLE + 1)
+
/*
* struct vm_exit
*
@@ -617,8 +626,6 @@ struct vm_mprotect_ept_params {
#define VMX_FAIL_LAUNCH_INVALID_VMCS 2
#define VMX_FAIL_LAUNCH_VALID_VMCS 3
-#define VMX_NUM_MSR_STORE 7
-
/* MSR bitmap manipulation macros */
#define VMX_MSRIDX(m) ((m) / 8)
#define VMX_MSRBIT(m) (1 << (m) % 8)
@@ -894,8 +901,10 @@ struct vcpu {
paddr_t vc_vmx_msr_exit_save_pa;
vaddr_t vc_vmx_msr_exit_load_va;
paddr_t vc_vmx_msr_exit_load_pa;
+#if 0 /* XXX currently use msr_exit_save for msr_entry_load too */
vaddr_t vc_vmx_msr_entry_load_va;
paddr_t vc_vmx_msr_entry_load_pa;
+#endif
uint8_t vc_vmx_vpid_enabled;
uint64_t vc_vmx_cr0_fixed1;
uint64_t vc_vmx_cr0_fixed0;