1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
23 * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26/*
27 * Copyright 2011 Joyent, Inc.  All rights reserved.
28 */
29
30inline int R_GS = @GS@;
31#pragma D binding "1.0" R_GS
32inline int R_FS = @FS@;
33#pragma D binding "1.0" R_FS
34inline int R_ES = @ES@;
35#pragma D binding "1.0" R_ES
36inline int R_DS = @DS@;
37#pragma D binding "1.0" R_DS
38
39inline int R_EDI = @EDI@;
40#pragma D binding "1.0" R_EDI
41inline int R_ESI = @ESI@;
42#pragma D binding "1.0" R_ESI
43inline int R_EBP = @EBP@;
44#pragma D binding "1.0" R_EBP
45inline int R_ESP = @ESP@;
46#pragma D binding "1.0" R_ESP
47inline int R_EBX = @EBX@;
48#pragma D binding "1.0" R_EBX
49inline int R_EDX = @EDX@;
50#pragma D binding "1.0" R_EDX
51inline int R_ECX = @ECX@;
52#pragma D binding "1.0" R_ECX
53inline int R_EAX = @EAX@;
54#pragma D binding "1.0" R_EAX
55
56inline int R_TRAPNO = @TRAPNO@;
57#pragma D binding "1.0" R_TRAPNO
58inline int R_ERR = @ERR@;
59#pragma D binding "1.0" R_ERR
60inline int R_EIP = @EIP@;
61#pragma D binding "1.0" R_EIP
62inline int R_CS = @CS@;
63#pragma D binding "1.0" R_CS
64inline int R_EFL = @EFL@;
65#pragma D binding "1.0" R_EFL
66inline int R_UESP = @UESP@;
67#pragma D binding "1.0" R_UESP
68inline int R_SS = @SS@;
69#pragma D binding "1.0" R_SS
70
71inline int R_PC = R_EIP;
72#pragma D binding "1.0" R_PC
73inline int R_SP = R_UESP;
74#pragma D binding "1.0" R_SP
75inline int R_PS = R_EFL;
76#pragma D binding "1.0" R_PS
77inline int R_R0 = R_EAX;
78#pragma D binding "1.0" R_R0
79inline int R_R1 = R_EBX;
80#pragma D binding "1.0" R_R1
81
82inline int R_RSP = @REG_RSP@;
83#pragma D binding "1.0" R_RSP
84inline int R_RFL = @REG_RFL@;
85#pragma D binding "1.0" R_RFL
86inline int R_RIP = @REG_RIP@;
87#pragma D binding "1.0" R_RIP
88inline int R_RAX = @REG_RAX@;
89#pragma D binding "1.0" R_RAX
90inline int R_RCX = @REG_RCX@;
91#pragma D binding "1.0" R_RCX
92inline int R_RDX = @REG_RDX@;
93#pragma D binding "1.0" R_RDX
94inline int R_RBX = @REG_RBX@;
95#pragma D binding "1.0" R_RBX
96inline int R_RBP = @REG_RBP@;
97#pragma D binding "1.0" R_RBP
98inline int R_RSI = @REG_RSI@;
99#pragma D binding "1.0" R_RSI
100inline int R_RDI = @REG_RDI@;
101#pragma D binding "1.0" R_RDI
102inline int R_R8 = @REG_R8@;
103#pragma D binding "1.0" R_R8
104inline int R_R9 = @REG_R9@;
105#pragma D binding "1.0" R_R9
106inline int R_R10 = @REG_R10@;
107#pragma D binding "1.0" R_R10
108inline int R_R11 = @REG_R11@;
109#pragma D binding "1.0" R_R11
110inline int R_R12 = @REG_R12@;
111#pragma D binding "1.0" R_R12
112inline int R_R13 = @REG_R13@;
113#pragma D binding "1.0" R_R13
114inline int R_R14 = @REG_R14@;
115#pragma D binding "1.0" R_R14
116inline int R_R15 = @REG_R15@;
117#pragma D binding "1.0" R_R15
118
119enum vmregs_vmx {
120	VMX_VIRTUAL_PROCESSOR_ID			= 0x00000000,
121	VMX_GUEST_ES_SELECTOR				= 0x00000800,
122	VMX_GUEST_CS_SELECTOR				= 0x00000802,
123	VMX_GUEST_SS_SELECTOR				= 0x00000804,
124	VMX_GUEST_DS_SELECTOR				= 0x00000806,
125	VMX_GUEST_FS_SELECTOR				= 0x00000808,
126	VMX_GUEST_GS_SELECTOR				= 0x0000080a,
127	VMX_GUEST_LDTR_SELECTOR				= 0x0000080c,
128	VMX_GUEST_TR_SELECTOR				= 0x0000080e,
129	VMX_HOST_ES_SELECTOR				= 0x00000c00,
130	VMX_HOST_CS_SELECTOR				= 0x00000c02,
131	VMX_HOST_SS_SELECTOR				= 0x00000c04,
132	VMX_HOST_DS_SELECTOR				= 0x00000c06,
133	VMX_HOST_FS_SELECTOR				= 0x00000c08,
134	VMX_HOST_GS_SELECTOR				= 0x00000c0a,
135	VMX_HOST_TR_SELECTOR				= 0x00000c0c,
136	VMX_IO_BITMAP_A					= 0x00002000,
137	VMX_IO_BITMAP_A_HIGH				= 0x00002001,
138	VMX_IO_BITMAP_B					= 0x00002002,
139	VMX_IO_BITMAP_B_HIGH				= 0x00002003,
140	VMX_MSR_BITMAP					= 0x00002004,
141	VMX_MSR_BITMAP_HIGH				= 0x00002005,
142	VMX_VM_EXIT_MSR_STORE_ADDR			= 0x00002006,
143	VMX_VM_EXIT_MSR_STORE_ADDR_HIGH			= 0x00002007,
144	VMX_VM_EXIT_MSR_LOAD_ADDR			= 0x00002008,
145	VMX_VM_EXIT_MSR_LOAD_ADDR_HIGH			= 0x00002009,
146	VMX_VM_ENTRY_MSR_LOAD_ADDR			= 0x0000200a,
147	VMX_VM_ENTRY_MSR_LOAD_ADDR_HIGH			= 0x0000200b,
148	VMX_TSC_OFFSET					= 0x00002010,
149	VMX_TSC_OFFSET_HIGH				= 0x00002011,
150	VMX_VIRTUAL_APIC_PAGE_ADDR			= 0x00002012,
151	VMX_VIRTUAL_APIC_PAGE_ADDR_HIGH			= 0x00002013,
152	VMX_APIC_ACCESS_ADDR				= 0x00002014,
153	VMX_APIC_ACCESS_ADDR_HIGH			= 0x00002015,
154	VMX_EPT_POINTER					= 0x0000201a,
155	VMX_EPT_POINTER_HIGH				= 0x0000201b,
156	VMX_GUEST_PHYSICAL_ADDRESS			= 0x00002400,
157	VMX_GUEST_PHYSICAL_ADDRESS_HIGH			= 0x00002401,
158	VMX_VMCS_LINK_POINTER				= 0x00002800,
159	VMX_VMCS_LINK_POINTER_HIGH			= 0x00002801,
160	VMX_GUEST_IA32_DEBUGCTL				= 0x00002802,
161	VMX_GUEST_IA32_DEBUGCTL_HIGH			= 0x00002803,
162	VMX_GUEST_IA32_PAT				= 0x00002804,
163	VMX_GUEST_IA32_PAT_HIGH				= 0x00002805,
164	VMX_GUEST_PDPTR0				= 0x0000280a,
165	VMX_GUEST_PDPTR0_HIGH				= 0x0000280b,
166	VMX_GUEST_PDPTR1				= 0x0000280c,
167	VMX_GUEST_PDPTR1_HIGH				= 0x0000280d,
168	VMX_GUEST_PDPTR2				= 0x0000280e,
169	VMX_GUEST_PDPTR2_HIGH				= 0x0000280f,
170	VMX_GUEST_PDPTR3				= 0x00002810,
171	VMX_GUEST_PDPTR3_HIGH				= 0x00002811,
172	VMX_HOST_IA32_PAT				= 0x00002c00,
173	VMX_HOST_IA32_PAT_HIGH				= 0x00002c01,
174	VMX_PIN_BASED_VM_EXEC_CONTROL			= 0x00004000,
175	VMX_CPU_BASED_VM_EXEC_CONTROL			= 0x00004002,
176	VMX_EXCEPTION_BITMAP				= 0x00004004,
177	VMX_PAGE_FAULT_ERROR_CODE_MASK			= 0x00004006,
178	VMX_PAGE_FAULT_ERROR_CODE_MATCH			= 0x00004008,
179	VMX_CR3_TARGET_COUNT				= 0x0000400a,
180	VMX_VM_EXIT_CONTROLS				= 0x0000400c,
181	VMX_VM_EXIT_MSR_STORE_COUNT			= 0x0000400e,
182	VMX_VM_EXIT_MSR_LOAD_COUNT			= 0x00004010,
183	VMX_VM_ENTRY_CONTROLS				= 0x00004012,
184	VMX_VM_ENTRY_MSR_LOAD_COUNT			= 0x00004014,
185	VMX_VM_ENTRY_INTR_INFO_FIELD			= 0x00004016,
186	VMX_VM_ENTRY_EXCEPTION_ERROR_CODE		= 0x00004018,
187	VMX_VM_ENTRY_INSTRUCTION_LEN			= 0x0000401a,
188	VMX_TPR_THRESHOLD				= 0x0000401c,
189	VMX_SECONDARY_VM_EXEC_CONTROL			= 0x0000401e,
190	VMX_PLE_GAP					= 0x00004020,
191	VMX_PLE_WINDOW					= 0x00004022,
192	VMX_VM_INSTRUCTION_ERROR			= 0x00004400,
193	VMX_VM_EXIT_REASON				= 0x00004402,
194	VMX_VM_EXIT_INTR_INFO				= 0x00004404,
195	VMX_VM_EXIT_INTR_ERROR_CODE			= 0x00004406,
196	VMX_IDT_VECTORING_INFO_FIELD			= 0x00004408,
197	VMX_IDT_VECTORING_ERROR_CODE			= 0x0000440a,
198	VMX_VM_EXIT_INSTRUCTION_LEN			= 0x0000440c,
199	VMX_VMX_INSTRUCTION_INFO			= 0x0000440e,
200	VMX_GUEST_ES_LIMIT				= 0x00004800,
201	VMX_GUEST_CS_LIMIT				= 0x00004802,
202	VMX_GUEST_SS_LIMIT				= 0x00004804,
203	VMX_GUEST_DS_LIMIT				= 0x00004806,
204	VMX_GUEST_FS_LIMIT				= 0x00004808,
205	VMX_GUEST_GS_LIMIT				= 0x0000480a,
206	VMX_GUEST_LDTR_LIMIT				= 0x0000480c,
207	VMX_GUEST_TR_LIMIT				= 0x0000480e,
208	VMX_GUEST_GDTR_LIMIT				= 0x00004810,
209	VMX_GUEST_IDTR_LIMIT				= 0x00004812,
210	VMX_GUEST_ES_AR_BYTES				= 0x00004814,
211	VMX_GUEST_CS_AR_BYTES				= 0x00004816,
212	VMX_GUEST_SS_AR_BYTES				= 0x00004818,
213	VMX_GUEST_DS_AR_BYTES				= 0x0000481a,
214	VMX_GUEST_FS_AR_BYTES				= 0x0000481c,
215	VMX_GUEST_GS_AR_BYTES				= 0x0000481e,
216	VMX_GUEST_LDTR_AR_BYTES				= 0x00004820,
217	VMX_GUEST_TR_AR_BYTES				= 0x00004822,
218	VMX_GUEST_INTERRUPTIBILITY_INFO			= 0x00004824,
219	VMX_GUEST_ACTIVITY_STATE			= 0X00004826,
220	VMX_GUEST_SYSENTER_CS				= 0x0000482A,
221	VMX_HOST_IA32_SYSENTER_CS			= 0x00004c00,
222	VMX_CR0_GUEST_HOST_MASK				= 0x00006000,
223	VMX_CR4_GUEST_HOST_MASK				= 0x00006002,
224	VMX_CR0_READ_SHADOW				= 0x00006004,
225	VMX_CR4_READ_SHADOW				= 0x00006006,
226	VMX_CR3_TARGET_VALUE0				= 0x00006008,
227	VMX_CR3_TARGET_VALUE1				= 0x0000600a,
228	VMX_CR3_TARGET_VALUE2				= 0x0000600c,
229	VMX_CR3_TARGET_VALUE3				= 0x0000600e,
230	VMX_EXIT_QUALIFICATION				= 0x00006400,
231	VMX_GUEST_LINEAR_ADDRESS			= 0x0000640a,
232	VMX_GUEST_CR0					= 0x00006800,
233	VMX_GUEST_CR3					= 0x00006802,
234	VMX_GUEST_CR4					= 0x00006804,
235	VMX_GUEST_ES_BASE				= 0x00006806,
236	VMX_GUEST_CS_BASE				= 0x00006808,
237	VMX_GUEST_SS_BASE				= 0x0000680a,
238	VMX_GUEST_DS_BASE				= 0x0000680c,
239	VMX_GUEST_FS_BASE				= 0x0000680e,
240	VMX_GUEST_GS_BASE				= 0x00006810,
241	VMX_GUEST_LDTR_BASE				= 0x00006812,
242	VMX_GUEST_TR_BASE				= 0x00006814,
243	VMX_GUEST_GDTR_BASE				= 0x00006816,
244	VMX_GUEST_IDTR_BASE				= 0x00006818,
245	VMX_GUEST_DR7					= 0x0000681a,
246	VMX_GUEST_RSP					= 0x0000681c,
247	VMX_GUEST_RIP					= 0x0000681e,
248	VMX_GUEST_RFLAGS				= 0x00006820,
249	VMX_GUEST_PENDING_DBG_EXCEPTIONS		= 0x00006822,
250	VMX_GUEST_SYSENTER_ESP				= 0x00006824,
251	VMX_GUEST_SYSENTER_EIP				= 0x00006826,
252	VMX_HOST_CR0					= 0x00006c00,
253	VMX_HOST_CR3					= 0x00006c02,
254	VMX_HOST_CR4					= 0x00006c04,
255	VMX_HOST_FS_BASE				= 0x00006c06,
256	VMX_HOST_GS_BASE				= 0x00006c08,
257	VMX_HOST_TR_BASE				= 0x00006c0a,
258	VMX_HOST_GDTR_BASE				= 0x00006c0c,
259	VMX_HOST_IDTR_BASE				= 0x00006c0e,
260	VMX_HOST_IA32_SYSENTER_ESP			= 0x00006c10,
261	VMX_HOST_IA32_SYSENTER_EIP			= 0x00006c12,
262	VMX_HOST_RSP					= 0x00006c14,
263	VMX_HOST_RIP					= 0x00006c16
264};
265