1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
;; @file
; HM - VMX Structures and Definitions.
;
;
; Copyright (C) 2006-2019 Oracle Corporation
;
; This file is part of VirtualBox Open Source Edition (OSE), as
; available from http://www.virtualbox.org. This file is free software;
; you can redistribute it and/or modify it under the terms of the GNU
; General Public License (GPL) as published by the Free Software
; Foundation, in version 2 as it comes in the "COPYING" file of the
; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
;
; The contents of this file may alternatively be used under the terms
; of the Common Development and Distribution License Version 1.0
; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
; VirtualBox OSE distribution, in which case the provisions of the
; CDDL are applicable instead of those of the GPL.
;
; You may elect to license modified versions of this file under the
; terms and conditions of either the GPL or the CDDL or both.
;
%define VMX_VMCS_GUEST_FIELD_ES 0800h
%define VMX_VMCS_GUEST_FIELD_CS 0802h
%define VMX_VMCS_GUEST_FIELD_SS 0804h
%define VMX_VMCS_GUEST_FIELD_DS 0806h
%define VMX_VMCS_GUEST_FIELD_FS 0808h
%define VMX_VMCS_GUEST_FIELD_GS 080Ah
%define VMX_VMCS_GUEST_FIELD_LDTR 080Ch
%define VMX_VMCS_GUEST_FIELD_TR 080Eh
%define VMX_VMCS_HOST_FIELD_ES 0C00h
%define VMX_VMCS_HOST_FIELD_CS 0C02h
%define VMX_VMCS_HOST_FIELD_SS 0C04h
%define VMX_VMCS_HOST_FIELD_DS 0C06h
%define VMX_VMCS_HOST_FIELD_FS 0C08h
%define VMX_VMCS_HOST_FIELD_GS 0C0Ah
%define VMX_VMCS_HOST_FIELD_TR 0C0Ch
%define VMX_VMCS_CTRL_IO_BITMAP_A_FULL 02000h
%define VMX_VMCS_CTRL_IO_BITMAP_A_HIGH 02001h
%define VMX_VMCS_CTRL_IO_BITMAP_B_FULL 02002h
%define VMX_VMCS_CTRL_IO_BITMAP_B_HIGH 02003h
%define VMX_VMCS_CTRL_MSR_BITMAP_FULL 02004h
%define VMX_VMCS_CTRL_MSR_BITMAP_HIGH 02005h
%define VMX_VMCS_CTRL_VMEXIT_MSR_STORE_FULL 02006h
%define VMX_VMCS_CTRL_VMEXIT_MSR_STORE_HIGH 02007h
%define VMX_VMCS_CTRL_VMEXIT_MSR_LOAD_FULL 02008h
%define VMX_VMCS_CTRL_VMEXIT_MSR_LOAD_HIGH 02009h
%define VMX_VMCS_CTRL_VMENTRY_MSR_LOAD_FULL 0200Ah
%define VMX_VMCS_CTRL_VMENTRY_MSR_LOAD_HIGH 0200Bh
%define VMX_VMCS_CTRL_EXEC_VMCS_PTR_FULL 0200Ch
%define VMX_VMCS_CTRL_EXEC_VMCS_PTR_HIGH 0200Dh
%define VMX_VMCS_CTRL_TSC_OFFSET_FULL 02010h
%define VMX_VMCS_CTRL_TSC_OFFSET_HIGH 02011h
%define VMX_VMCS_CTRL_VAPIC_PAGEADDR_FULL 02012h
%define VMX_VMCS_CTRL_VAPIC_PAGEADDR_HIGH 02013h
%define VMX_VMCS_GUEST_LINK_PTR_FULL 02800h
%define VMX_VMCS_GUEST_LINK_PTR_HIGH 02801h
%define VMX_VMCS_GUEST_DEBUGCTL_FULL 02802h
%define VMX_VMCS_GUEST_DEBUGCTL_HIGH 02803h
%define VMX_VMCS_CTRL_PIN_EXEC 04000h
%define VMX_VMCS_CTRL_PROC_EXEC 04002h
%define VMX_VMCS_CTRL_EXCEPTION_BITMAP 04004h
%define VMX_VMCS_CTRL_PAGEFAULT_ERROR_MASK 04006h
%define VMX_VMCS_CTRL_PAGEFAULT_ERROR_MATCH 04008h
%define VMX_VMCS_CTRL_CR3_TARGET_COUNT 0400Ah
%define VMX_VMCS_CTRL_EXIT 0400Ch
%define VMX_VMCS_CTRL_EXIT_MSR_STORE_COUNT 0400Eh
%define VMX_VMCS_CTRL_EXIT_MSR_LOAD_COUNT 04010h
%define VMX_VMCS_CTRL_ENTRY 04012h
%define VMX_VMCS_CTRL_ENTRY_MSR_LOAD_COUNT 04014h
%define VMX_VMCS_CTRL_ENTRY_IRQ_INFO 04016h
%define VMX_VMCS_CTRL_ENTRY_EXCEPTION_ERRCODE 04018h
%define VMX_VMCS_CTRL_ENTRY_INSTR_LENGTH 0401Ah
%define VMX_VMCS_CTRL_TRP_TRESHOLD 0401Ch
%define VMX_VMCS_RO_VM_INSTR_ERROR 04400h
%define VMX_VMCS_RO_EXIT_REASON 04402h
%define VMX_VMCS_RO_EXIT_INTERRUPTION_INFO 04404h
%define VMX_VMCS_RO_EXIT_INTERRUPTION_ERRCODE 04406h
%define VMX_VMCS_RO_IDT_INFO 04408h
%define VMX_VMCS_RO_IDT_ERRCODE 0440Ah
%define VMX_VMCS_RO_EXIT_INSTR_LENGTH 0440Ch
%define VMX_VMCS_RO_EXIT_INSTR_INFO 0440Eh
%define VMX_VMCS_GUEST_ES_LIMIT 04800h
%define VMX_VMCS_GUEST_CS_LIMIT 04802h
%define VMX_VMCS_GUEST_SS_LIMIT 04804h
%define VMX_VMCS_GUEST_DS_LIMIT 04806h
%define VMX_VMCS_GUEST_FS_LIMIT 04808h
%define VMX_VMCS_GUEST_GS_LIMIT 0480Ah
%define VMX_VMCS_GUEST_LDTR_LIMIT 0480Ch
%define VMX_VMCS_GUEST_TR_LIMIT 0480Eh
%define VMX_VMCS_GUEST_GDTR_LIMIT 04810h
%define VMX_VMCS_GUEST_IDTR_LIMIT 04812h
%define VMX_VMCS_GUEST_ES_ACCESS_RIGHTS 04814h
%define VMX_VMCS_GUEST_CS_ACCESS_RIGHTS 04816h
%define VMX_VMCS_GUEST_SS_ACCESS_RIGHTS 04818h
%define VMX_VMCS_GUEST_DS_ACCESS_RIGHTS 0481Ah
%define VMX_VMCS_GUEST_FS_ACCESS_RIGHTS 0481Ch
%define VMX_VMCS_GUEST_GS_ACCESS_RIGHTS 0481Eh
%define VMX_VMCS_GUEST_LDTR_ACCESS_RIGHTS 04820h
%define VMX_VMCS_GUEST_TR_ACCESS_RIGHTS 04822h
%define VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE 04824h
%define VMX_VMCS_GUEST_ACTIVITY_STATE 04826h
%define VMX_VMCS_GUEST_SYSENTER_CS 0482Ah
%define VMX_VMCS_CTRL_CR0_MASK 06000h
%define VMX_VMCS_CTRL_CR4_MASK 06002h
%define VMX_VMCS_CTRL_CR0_READ_SHADOW 06004h
%define VMX_VMCS_CTRL_CR4_READ_SHADOW 06006h
%define VMX_VMCS_CTRL_CR3_TARGET_VAL0 06008h
%define VMX_VMCS_CTRL_CR3_TARGET_VAL1 0600Ah
%define VMX_VMCS_CTRL_CR3_TARGET_VAL2 0600Ch
%define VMX_VMCS_CTRL_CR3_TARGET_VAL31 0600Eh
%define VMX_VMCS_RO_EXIT_QUALIFICATION 06400h
%define VMX_VMCS_RO_IO_RCX 06402h
%define VMX_VMCS_RO_IO_RSX 06404h
%define VMX_VMCS_RO_IO_RDI 06406h
%define VMX_VMCS_RO_IO_RIP 06408h
%define VMX_VMCS_GUEST_LINEAR_ADDR 0640Ah
%define VMX_VMCS64_GUEST_CR0 06800h
%define VMX_VMCS64_GUEST_CR3 06802h
%define VMX_VMCS64_GUEST_CR4 06804h
%define VMX_VMCS64_GUEST_ES_BASE 06806h
%define VMX_VMCS64_GUEST_CS_BASE 06808h
%define VMX_VMCS64_GUEST_SS_BASE 0680Ah
%define VMX_VMCS64_GUEST_DS_BASE 0680Ch
%define VMX_VMCS64_GUEST_FS_BASE 0680Eh
%define VMX_VMCS64_GUEST_GS_BASE 06810h
%define VMX_VMCS64_GUEST_LDTR_BASE 06812h
%define VMX_VMCS64_GUEST_TR_BASE 06814h
%define VMX_VMCS64_GUEST_GDTR_BASE 06816h
%define VMX_VMCS64_GUEST_IDTR_BASE 06818h
%define VMX_VMCS64_GUEST_DR7 0681Ah
%define VMX_VMCS64_GUEST_RSP 0681Ch
%define VMX_VMCS64_GUEST_RIP 0681Eh
%define VMX_VMCS64_GUEST_RFLAGS 06820h
%define VMX_VMCS_GUEST_DEBUG_EXCEPTIONS 06822h
%define VMX_VMCS64_GUEST_SYSENTER_ESP 06824h
%define VMX_VMCS64_GUEST_SYSENTER_EIP 06826h
%define VMX_VMCS_HOST_CR0 06C00h
%define VMX_VMCS_HOST_CR3 06C02h
%define VMX_VMCS_HOST_CR4 06C04h
%define VMX_VMCS_HOST_FS_BASE 06C06h
%define VMX_VMCS_HOST_GS_BASE 06C08h
%define VMX_VMCS_HOST_TR_BASE 06C0Ah
%define VMX_VMCS_HOST_GDTR_BASE 06C0Ch
%define VMX_VMCS_HOST_IDTR_BASE 06C0Eh
%define VMX_VMCS_HOST_SYSENTER_ESP 06C10h
%define VMX_VMCS_HOST_SYSENTER_EIP 06C12h
%define VMX_VMCS_HOST_RSP 06C14h
%define VMX_VMCS_HOST_RIP 06C16h
%define VMX_RESTORE_HOST_SEL_DS 1h ;RT_BIT(0)
%define VMX_RESTORE_HOST_SEL_ES 2h ;RT_BIT(1)
%define VMX_RESTORE_HOST_SEL_FS 4h ;RT_BIT(2)
%define VMX_RESTORE_HOST_SEL_GS 8h ;RT_BIT(3)
%define VMX_RESTORE_HOST_SEL_TR 10h ;RT_BIT(4)
%define VMX_RESTORE_HOST_GDTR 20h ;RT_BIT(5)
%define VMX_RESTORE_HOST_IDTR 40h ;RT_BIT(6)
%define VMX_RESTORE_HOST_GDT_READ_ONLY 80h ;RT_BIT(7)
%define VMX_RESTORE_HOST_REQUIRED 100h ;RT_BIT(8)
%define VMX_RESTORE_HOST_GDT_NEED_WRITABLE 200h ;RT_BIT(9)
;; C version hm_vmx.h.
struc VMXRESTOREHOST
.uHostSelDS resw 1
.uHostSelES resw 1
.uHostSelFS resw 1
.uHostSelGS resw 1
.uHostSelTR resw 1
.abPadding0 resb 4
.HostGdtr resb 10
.abPadding1 resb 6
.HostGdtrRw resb 10
.abPadding2 resb 6
.HostIdtr resb 10
.uHostFSBase resq 1
.uHostGSBase resq 1
endstruc
AssertCompileMemberOffset(VMXRESTOREHOST, HostGdtr, 16-2)
AssertCompileMemberOffset(VMXRESTOREHOST, HostGdtrRw, 32-2)
AssertCompileMemberOffset(VMXRESTOREHOST, HostIdtr, 48-2)
AssertCompileMemberOffset(VMXRESTOREHOST, uHostFSBase, 56)
AssertCompileSize(VMXRESTOREHOST, 72)
|