xref: /freebsd/sys/amd64/vmm/intel/vmx_genassym.c (revision f05cddf9)
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/malloc.h>
35 #include <sys/proc.h>
36 #include <sys/assym.h>
37 
38 #include <vm/vm.h>
39 #include <vm/pmap.h>
40 
41 #include <machine/pmap.h>
42 
43 #include <machine/vmm.h>
44 #include "vmx.h"
45 #include "vmx_cpufunc.h"
46 
47 ASSYM(VMXCTX_TMPSTKTOP, offsetof(struct vmxctx, tmpstktop));
48 ASSYM(VMXCTX_GUEST_RDI, offsetof(struct vmxctx, guest_rdi));
49 ASSYM(VMXCTX_GUEST_RSI, offsetof(struct vmxctx, guest_rsi));
50 ASSYM(VMXCTX_GUEST_RDX, offsetof(struct vmxctx, guest_rdx));
51 ASSYM(VMXCTX_GUEST_RCX, offsetof(struct vmxctx, guest_rcx));
52 ASSYM(VMXCTX_GUEST_R8, offsetof(struct vmxctx, guest_r8));
53 ASSYM(VMXCTX_GUEST_R9, offsetof(struct vmxctx, guest_r9));
54 ASSYM(VMXCTX_GUEST_RAX, offsetof(struct vmxctx, guest_rax));
55 ASSYM(VMXCTX_GUEST_RBX, offsetof(struct vmxctx, guest_rbx));
56 ASSYM(VMXCTX_GUEST_RBP, offsetof(struct vmxctx, guest_rbp));
57 ASSYM(VMXCTX_GUEST_R10, offsetof(struct vmxctx, guest_r10));
58 ASSYM(VMXCTX_GUEST_R11, offsetof(struct vmxctx, guest_r11));
59 ASSYM(VMXCTX_GUEST_R12, offsetof(struct vmxctx, guest_r12));
60 ASSYM(VMXCTX_GUEST_R13, offsetof(struct vmxctx, guest_r13));
61 ASSYM(VMXCTX_GUEST_R14, offsetof(struct vmxctx, guest_r14));
62 ASSYM(VMXCTX_GUEST_R15, offsetof(struct vmxctx, guest_r15));
63 ASSYM(VMXCTX_GUEST_CR2, offsetof(struct vmxctx, guest_cr2));
64 
65 ASSYM(VMXCTX_HOST_R15, offsetof(struct vmxctx, host_r15));
66 ASSYM(VMXCTX_HOST_R14, offsetof(struct vmxctx, host_r14));
67 ASSYM(VMXCTX_HOST_R13, offsetof(struct vmxctx, host_r13));
68 ASSYM(VMXCTX_HOST_R12, offsetof(struct vmxctx, host_r12));
69 ASSYM(VMXCTX_HOST_RBP, offsetof(struct vmxctx, host_rbp));
70 ASSYM(VMXCTX_HOST_RSP, offsetof(struct vmxctx, host_rsp));
71 ASSYM(VMXCTX_HOST_RBX, offsetof(struct vmxctx, host_rbx));
72 ASSYM(VMXCTX_HOST_RIP, offsetof(struct vmxctx, host_rip));
73 
74 ASSYM(VMXCTX_LAUNCH_ERROR, offsetof(struct vmxctx, launch_error));
75 
76 ASSYM(VM_SUCCESS,	VM_SUCCESS);
77 ASSYM(VM_FAIL_INVALID,	VM_FAIL_INVALID);
78 ASSYM(VM_FAIL_VALID,	VM_FAIL_VALID);
79 
80 ASSYM(VMX_RETURN_DIRECT,	VMX_RETURN_DIRECT);
81 ASSYM(VMX_RETURN_LONGJMP,	VMX_RETURN_LONGJMP);
82 ASSYM(VMX_RETURN_VMRESUME,	VMX_RETURN_VMRESUME);
83 ASSYM(VMX_RETURN_VMLAUNCH,	VMX_RETURN_VMLAUNCH);
84 ASSYM(VMX_RETURN_AST,		VMX_RETURN_AST);
85 
86 ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
87 ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
88 ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
89 ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread));
90