diff options
Diffstat (limited to 'sys/amd64/vmm/intel/vmx.h')
-rw-r--r-- | sys/amd64/vmm/intel/vmx.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/amd64/vmm/intel/vmx.h b/sys/amd64/vmm/intel/vmx.h index c7cd567..8e57764 100644 --- a/sys/amd64/vmm/intel/vmx.h +++ b/sys/amd64/vmm/intel/vmx.h @@ -31,6 +31,8 @@ #include "vmcs.h" +struct pmap; + #define GUEST_MSR_MAX_ENTRIES 64 /* arbitrary */ struct vmxctx { @@ -68,6 +70,15 @@ struct vmxctx { int launched; /* vmcs launch state */ int launch_error; + + long eptgen[MAXCPU]; /* cached pmap->pm_eptgen */ + + /* + * The 'eptp' and the 'pmap' do not change during the lifetime of + * the VM so it is safe to keep a copy in each vcpu's vmxctx. + */ + vm_paddr_t eptp; + struct pmap *pmap; }; struct vmxcap { @@ -82,16 +93,15 @@ struct vmxstate { /* virtual machine softc */ struct vmx { - pml4_entry_t pml4ept[NPML4EPG]; struct vmcs vmcs[VM_MAXCPU]; /* one vmcs per virtual cpu */ char msr_bitmap[PAGE_SIZE]; struct msr_entry guest_msrs[VM_MAXCPU][GUEST_MSR_MAX_ENTRIES]; struct vmxctx ctx[VM_MAXCPU]; struct vmxcap cap[VM_MAXCPU]; struct vmxstate state[VM_MAXCPU]; + uint64_t eptp; struct vm *vm; }; -CTASSERT((offsetof(struct vmx, pml4ept) & PAGE_MASK) == 0); CTASSERT((offsetof(struct vmx, vmcs) & PAGE_MASK) == 0); CTASSERT((offsetof(struct vmx, msr_bitmap) & PAGE_MASK) == 0); CTASSERT((offsetof(struct vmx, guest_msrs) & 15) == 0); @@ -101,6 +111,7 @@ CTASSERT((offsetof(struct vmx, guest_msrs) & 15) == 0); #define VMX_RETURN_VMRESUME 2 #define VMX_RETURN_VMLAUNCH 3 #define VMX_RETURN_AST 4 +#define VMX_RETURN_INVEPT 5 /* * vmx_setjmp() returns: * - 0 when it returns directly @@ -108,6 +119,7 @@ CTASSERT((offsetof(struct vmx, guest_msrs) & 15) == 0); * - 2 when it returns from vmx_resume (which would only be in the error case) * - 3 when it returns from vmx_launch (which would only be in the error case) * - 4 when it returns from vmx_resume or vmx_launch because of AST pending + * - 5 when it returns from vmx_launch/vmx_resume because of invept error */ int vmx_setjmp(struct vmxctx *ctx); void vmx_longjmp(void); /* returns via vmx_setjmp */ |