1 /*- 2 * Copyright (c) 2011 NetApp, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD$ 27 */ 28 29 #include <sys/cdefs.h> 30 __FBSDID("$FreeBSD$"); 31 32 #include <sys/param.h> 33 #include <sys/systm.h> 34 #include <sys/proc.h> 35 #include <sys/assym.h> 36 37 #include <vm/vm.h> 38 #include <vm/pmap.h> 39 40 #include <machine/vmm.h> 41 #include "vmx_cpufunc.h" 42 #include "vmx.h" 43 44 ASSYM(VMXCTX_GUEST_RDI, offsetof(struct vmxctx, guest_rdi)); 45 ASSYM(VMXCTX_GUEST_RSI, offsetof(struct vmxctx, guest_rsi)); 46 ASSYM(VMXCTX_GUEST_RDX, offsetof(struct vmxctx, guest_rdx)); 47 ASSYM(VMXCTX_GUEST_RCX, offsetof(struct vmxctx, guest_rcx)); 48 ASSYM(VMXCTX_GUEST_R8, offsetof(struct vmxctx, guest_r8)); 49 ASSYM(VMXCTX_GUEST_R9, offsetof(struct vmxctx, guest_r9)); 50 ASSYM(VMXCTX_GUEST_RAX, offsetof(struct vmxctx, guest_rax)); 51 ASSYM(VMXCTX_GUEST_RBX, offsetof(struct vmxctx, guest_rbx)); 52 ASSYM(VMXCTX_GUEST_RBP, offsetof(struct vmxctx, guest_rbp)); 53 ASSYM(VMXCTX_GUEST_R10, offsetof(struct vmxctx, guest_r10)); 54 ASSYM(VMXCTX_GUEST_R11, offsetof(struct vmxctx, guest_r11)); 55 ASSYM(VMXCTX_GUEST_R12, offsetof(struct vmxctx, guest_r12)); 56 ASSYM(VMXCTX_GUEST_R13, offsetof(struct vmxctx, guest_r13)); 57 ASSYM(VMXCTX_GUEST_R14, offsetof(struct vmxctx, guest_r14)); 58 ASSYM(VMXCTX_GUEST_R15, offsetof(struct vmxctx, guest_r15)); 59 ASSYM(VMXCTX_GUEST_CR2, offsetof(struct vmxctx, guest_cr2)); 60 61 ASSYM(VMXCTX_HOST_R15, offsetof(struct vmxctx, host_r15)); 62 ASSYM(VMXCTX_HOST_R14, offsetof(struct vmxctx, host_r14)); 63 ASSYM(VMXCTX_HOST_R13, offsetof(struct vmxctx, host_r13)); 64 ASSYM(VMXCTX_HOST_R12, offsetof(struct vmxctx, host_r12)); 65 ASSYM(VMXCTX_HOST_RBP, offsetof(struct vmxctx, host_rbp)); 66 ASSYM(VMXCTX_HOST_RSP, offsetof(struct vmxctx, host_rsp)); 67 ASSYM(VMXCTX_HOST_RBX, offsetof(struct vmxctx, host_rbx)); 68 ASSYM(VMXCTX_HOST_RIP, offsetof(struct vmxctx, host_rip)); 69 70 ASSYM(VMXCTX_INST_FAIL_STATUS, offsetof(struct vmxctx, inst_fail_status)); 71 ASSYM(VMXCTX_PMAP, offsetof(struct vmxctx, pmap)); 72 73 ASSYM(VMX_EPTGEN, offsetof(struct vmx, eptgen)); 74 ASSYM(VMX_EPTP, offsetof(struct vmx, eptp)); 75 76 ASSYM(VM_FAIL_INVALID, VM_FAIL_INVALID); 77 ASSYM(VM_FAIL_VALID, VM_FAIL_VALID); 78 ASSYM(VMX_GUEST_VMEXIT, VMX_GUEST_VMEXIT); 79 ASSYM(VMX_VMRESUME_ERROR, VMX_VMRESUME_ERROR); 80 ASSYM(VMX_VMLAUNCH_ERROR, VMX_VMLAUNCH_ERROR); 81 ASSYM(VMX_INVEPT_ERROR, VMX_INVEPT_ERROR); 82 83 ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); 84 85 ASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active)); 86 ASSYM(PM_EPTGEN, offsetof(struct pmap, pm_eptgen)); 87 88 ASSYM(KERNEL_SS, GSEL(GDATA_SEL, SEL_KPL)); 89 ASSYM(KERNEL_CS, GSEL(GCODE_SEL, SEL_KPL)); 90