VirtualBox

source: vbox/trunk/src/VBox/VMM/CPUMInternal.mac@ 13100

Last change on this file since 13100 was 12657, checked in by vboxsync, 16 years ago

#1865: CPUM. Also added missing aliasing for DR4&5 to the guest DRx setter and getter.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 12.5 KB
Line 
1; $Id: CPUMInternal.mac 12657 2008-09-22 18:29:06Z vboxsync $
2;; @file
3; CPUM - Internal header file (asm).
4;
5
6;
7; Copyright (C) 2006-2007 Sun Microsystems, Inc.
8;
9; This file is part of VirtualBox Open Source Edition (OSE), as
10; available from http://www.virtualbox.org. This file is free software;
11; you can redistribute it and/or modify it under the terms of the GNU
12; General Public License (GPL) as published by the Free Software
13; Foundation, in version 2 as it comes in the "COPYING" file of the
14; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16;
17; Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18; Clara, CA 95054 USA or visit http://www.sun.com if you need
19; additional information or have any questions.
20;
21
22%include "VBox/asmdefs.mac"
23
24%define CPUM_USED_FPU RT_BIT(0)
25%define CPUM_USED_FPU_SINCE_REM RT_BIT(1)
26%define CPUM_USE_SYSENTER RT_BIT(2)
27%define CPUM_USE_SYSCALL RT_BIT(3)
28%define CPUM_USE_DEBUG_REGS_HOST RT_BIT(4)
29%define CPUM_USE_DEBUG_REGS RT_BIT(5)
30
31%define CPUM_HANDLER_DS 1
32%define CPUM_HANDLER_ES 2
33%define CPUM_HANDLER_FS 3
34%define CPUM_HANDLER_GS 4
35%define CPUM_HANDLER_IRET 5
36%define CPUM_HANDLER_TYPEMASK 0ffh
37%define CPUM_HANDLER_CTXCORE_IN_EBP RT_BIT(31)
38
39%define VMMGCRET_USED_FPU 040000000h
40
41%define FPUSTATE_SIZE 512
42
43;; if anyone figures how to do %if HC_ARCH_BITS == 64 || defined(VBOX_WITH_HYBIRD_32BIT_KERNEL) in
44; nasm please tell / fix this hack.
45%ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL
46 %define fVBOX_WITH_HYBIRD_32BIT_KERNEL 1
47%else
48 %define fVBOX_WITH_HYBIRD_32BIT_KERNEL 0
49%endif
50
51struc CPUM
52 ;
53 ; Host context state
54 ;
55 .Host.fpu resb FPUSTATE_SIZE
56
57%if HC_ARCH_BITS == 64 || fVBOX_WITH_HYBIRD_32BIT_KERNEL
58 ;.Host.rax resq 1 - scratch
59 .Host.rbx resq 1
60 ;.Host.rcx resq 1 - scratch
61 ;.Host.rdx resq 1 - scratch
62 .Host.rdi resq 1
63 .Host.rsi resq 1
64 .Host.rbp resq 1
65 .Host.rsp resq 1
66 ;.Host.r8 resq 1 - scratch
67 ;.Host.r9 resq 1 - scratch
68 .Host.r10 resq 1
69 .Host.r11 resq 1
70 .Host.r12 resq 1
71 .Host.r13 resq 1
72 .Host.r14 resq 1
73 .Host.r15 resq 1
74 ;.Host.rip resd 1 - scratch
75 .Host.rflags resq 1
76%endif
77%if HC_ARCH_BITS == 32
78 ;.Host.eax resd 1 - scratch
79 .Host.ebx resd 1
80 ;.Host.edx resd 1 - scratch
81 ;.Host.ecx resd 1 - scratch
82 .Host.edi resd 1
83 .Host.esi resd 1
84 .Host.ebp resd 1
85 .Host.eflags resd 1
86 ;.Host.eip resd 1 - scratch
87 ; lss pair!
88 .Host.esp resd 1
89%endif
90 .Host.ss resw 1
91 .Host.ssPadding resw 1
92 .Host.gs resw 1
93 .Host.gsPadding resw 1
94 .Host.fs resw 1
95 .Host.fsPadding resw 1
96 .Host.es resw 1
97 .Host.esPadding resw 1
98 .Host.ds resw 1
99 .Host.dsPadding resw 1
100 .Host.cs resw 1
101 .Host.csPadding resw 1
102
103%if HC_ARCH_BITS == 32 && fVBOX_WITH_HYBIRD_32BIT_KERNEL == 0
104 .Host.cr0 resd 1
105 ;.Host.cr2 resd 1 - scratch
106 .Host.cr3 resd 1
107 .Host.cr4 resd 1
108
109 .Host.dr0 resd 1
110 .Host.dr1 resd 1
111 .Host.dr2 resd 1
112 .Host.dr3 resd 1
113 .Host.dr6 resd 1
114 .Host.dr7 resd 1
115
116 .Host.gdtr resb 6 ; GDT limit + linear address
117 .Host.gdtrPadding resw 1
118 .Host.idtr resb 6 ; IDT limit + linear address
119 .Host.idtrPadding resw 1
120 .Host.ldtr resw 1
121 .Host.ldtrPadding resw 1
122 .Host.tr resw 1
123 .Host.trPadding resw 1
124
125 .Host.SysEnterPadding resd 1
126 .Host.SysEnter.cs resq 1
127 .Host.SysEnter.eip resq 1
128 .Host.SysEnter.esp resq 1
129
130%else ; 64-bit
131
132 .Host.cr0 resq 1
133 ;.Host.cr2 resq 1 - scratch
134 .Host.cr3 resq 1
135 .Host.cr4 resq 1
136 .Host.cr8 resq 1
137
138 .Host.dr0 resq 1
139 .Host.dr1 resq 1
140 .Host.dr2 resq 1
141 .Host.dr3 resq 1
142 .Host.dr6 resq 1
143 .Host.dr7 resq 1
144
145 .Host.gdtr resb 10 ; GDT limit + linear address
146 .Host.gdtrPadding resw 1
147 .Host.idtr resb 10 ; IDT limit + linear address
148 .Host.idtrPadding resw 1
149 .Host.ldtr resw 1
150 .Host.ldtrPadding resw 1
151 .Host.tr resw 1
152 .Host.trPadding resw 1
153
154 .Host.SysEnter.cs resq 1
155 .Host.SysEnter.eip resq 1
156 .Host.SysEnter.esp resq 1
157 .Host.FSbase resq 1
158 .Host.GSbase resq 1
159 .Host.efer resq 1
160%endif ; 64-bit
161
162
163 ;
164 ; Hypervisor Context.
165 ;
166 alignb 64 ; the padding
167 .Hyper.fpu resb FPUSTATE_SIZE
168
169 .Hyper.edi resq 1
170 .Hyper.esi resq 1
171 .Hyper.ebp resq 1
172 .Hyper.eax resq 1
173 .Hyper.ebx resq 1
174 .Hyper.edx resq 1
175 .Hyper.ecx resq 1
176 .Hyper.esp resq 1
177 .Hyper.lss_esp resd 1
178 .Hyper.ss resw 1
179 .Hyper.ssPadding resw 1
180 .Hyper.gs resw 1
181 .Hyper.gsPadding resw 1
182 .Hyper.fs resw 1
183 .Hyper.fsPadding resw 1
184 .Hyper.es resw 1
185 .Hyper.esPadding resw 1
186 .Hyper.ds resw 1
187 .Hyper.dsPadding resw 1
188 .Hyper.cs resw 1
189 .Hyper.csPadding resw 3
190 .Hyper.eflags resq 1
191 .Hyper.eip resq 1
192 .Hyper.r8 resq 1
193 .Hyper.r9 resq 1
194 .Hyper.r10 resq 1
195 .Hyper.r11 resq 1
196 .Hyper.r12 resq 1
197 .Hyper.r13 resq 1
198 .Hyper.r14 resq 1
199 .Hyper.r15 resq 1
200
201 .Hyper.esHid.u64Base resq 1
202 .Hyper.esHid.u32Limit resd 1
203 .Hyper.esHid.Attr resd 1
204
205 .Hyper.csHid.u64Base resq 1
206 .Hyper.csHid.u32Limit resd 1
207 .Hyper.csHid.Attr resd 1
208
209 .Hyper.ssHid.u64Base resq 1
210 .Hyper.ssHid.u32Limit resd 1
211 .Hyper.ssHid.Attr resd 1
212
213 .Hyper.dsHid.u64Base resq 1
214 .Hyper.dsHid.u32Limit resd 1
215 .Hyper.dsHid.Attr resd 1
216
217 .Hyper.fsHid.u64Base resq 1
218 .Hyper.fsHid.u32Limit resd 1
219 .Hyper.fsHid.Attr resd 1
220
221 .Hyper.gsHid.u64Base resq 1
222 .Hyper.gsHid.u32Limit resd 1
223 .Hyper.gsHid.Attr resd 1
224
225 .Hyper.cr0 resq 1
226 .Hyper.cr2 resq 1
227 .Hyper.cr3 resq 1
228 .Hyper.cr4 resq 1
229
230 .Hyper.dr resq 8
231
232 .Hyper.gdtr resb 10 ; GDT limit + linear address
233 .Hyper.gdtrPadding resw 1
234 .Hyper.idtr resb 10 ; IDT limit + linear address
235 .Hyper.idtrPadding resw 1
236 .Hyper.ldtr resw 1
237 .Hyper.ldtrPadding resw 1
238 .Hyper.tr resw 1
239 .Hyper.trPadding resw 1
240
241 .Hyper.SysEnter.cs resb 8
242 .Hyper.SysEnter.eip resb 8
243 .Hyper.SysEnter.esp resb 8
244
245 .Hyper.msrEFER resb 8
246 .Hyper.msrSTAR resb 8
247 .Hyper.msrPAT resb 8
248 .Hyper.msrLSTAR resb 8
249 .Hyper.msrCSTAR resb 8
250 .Hyper.msrSFMASK resb 8
251 .Hyper.msrKERNELGSBASE resb 8
252
253 .Hyper.ldtrHid.u64Base resq 1
254 .Hyper.ldtrHid.u32Limit resd 1
255 .Hyper.ldtrHid.Attr resd 1
256
257 .Hyper.trHid.u64Base resq 1
258 .Hyper.trHid.u32Limit resd 1
259 .Hyper.trHid.Attr resd 1
260
261
262 ;
263 ; Guest context state
264 ; (Identical to the .Hyper chunk above.)
265 ;
266 alignb 64
267 .Guest.fpu resb FPUSTATE_SIZE
268
269 .Guest.edi resq 1
270 .Guest.esi resq 1
271 .Guest.ebp resq 1
272 .Guest.eax resq 1
273 .Guest.ebx resq 1
274 .Guest.edx resq 1
275 .Guest.ecx resq 1
276 .Guest.esp resq 1
277 .Guest.lss_esp resd 1
278 .Guest.ss resw 1
279 .Guest.ssPadding resw 1
280 .Guest.gs resw 1
281 .Guest.gsPadding resw 1
282 .Guest.fs resw 1
283 .Guest.fsPadding resw 1
284 .Guest.es resw 1
285 .Guest.esPadding resw 1
286 .Guest.ds resw 1
287 .Guest.dsPadding resw 1
288 .Guest.cs resw 1
289 .Guest.csPadding resw 3
290 .Guest.eflags resq 1
291 .Guest.eip resq 1
292 .Guest.r8 resq 1
293 .Guest.r9 resq 1
294 .Guest.r10 resq 1
295 .Guest.r11 resq 1
296 .Guest.r12 resq 1
297 .Guest.r13 resq 1
298 .Guest.r14 resq 1
299 .Guest.r15 resq 1
300
301 .Guest.esHid.u64Base resq 1
302 .Guest.esHid.u32Limit resd 1
303 .Guest.esHid.Attr resd 1
304
305 .Guest.csHid.u64Base resq 1
306 .Guest.csHid.u32Limit resd 1
307 .Guest.csHid.Attr resd 1
308
309 .Guest.ssHid.u64Base resq 1
310 .Guest.ssHid.u32Limit resd 1
311 .Guest.ssHid.Attr resd 1
312
313 .Guest.dsHid.u64Base resq 1
314 .Guest.dsHid.u32Limit resd 1
315 .Guest.dsHid.Attr resd 1
316
317 .Guest.fsHid.u64Base resq 1
318 .Guest.fsHid.u32Limit resd 1
319 .Guest.fsHid.Attr resd 1
320
321 .Guest.gsHid.u64Base resq 1
322 .Guest.gsHid.u32Limit resd 1
323 .Guest.gsHid.Attr resd 1
324
325 .Guest.cr0 resq 1
326 .Guest.cr2 resq 1
327 .Guest.cr3 resq 1
328 .Guest.cr4 resq 1
329
330 .Guest.dr resq 8
331
332 .Guest.gdtr resb 10 ; GDT limit + linear address
333 .Guest.gdtrPadding resw 1
334 .Guest.idtr resb 10 ; IDT limit + linear address
335 .Guest.idtrPadding resw 1
336 .Guest.ldtr resw 1
337 .Guest.ldtrPadding resw 1
338 .Guest.tr resw 1
339 .Guest.trPadding resw 1
340
341 .Guest.SysEnter.cs resb 8
342 .Guest.SysEnter.eip resb 8
343 .Guest.SysEnter.esp resb 8
344
345 .Guest.msrEFER resb 8
346 .Guest.msrSTAR resb 8
347 .Guest.msrPAT resb 8
348 .Guest.msrLSTAR resb 8
349 .Guest.msrCSTAR resb 8
350 .Guest.msrSFMASK resb 8
351 .Guest.msrKERNELGSBASE resb 8
352
353 .Guest.ldtrHid.u64Base resq 1
354 .Guest.ldtrHid.u32Limit resd 1
355 .Guest.ldtrHid.Attr resd 1
356
357 .Guest.trHid.u64Base resq 1
358 .Guest.trHid.u32Limit resd 1
359 .Guest.trHid.Attr resd 1
360
361
362 ;
363 ; Other stuff.
364 ;
365 alignb 64
366 ; hypervisor core context.
367 .pHyperCoreR3 RTR3PTR_RES 1
368 .pHyperCoreR0 RTR0PTR_RES 1
369 .pHyperCoreRC RTRCPTR_RES 1
370 ;...
371 .fUseFlags resd 1
372 .fChanged resd 1
373 .fValidHiddenSelRegs resd 1
374
375 ; CPUID eax=1
376 .CPUFeatures.edx resd 1
377 .CPUFeatures.ecx resd 1
378
379 ; CPUID eax=0x80000001
380 .CPUFeaturesExt.edx resd 1
381 .CPUFeaturesExt.ecx resd 1
382
383 .enmCPUVendor resd 1
384
385 ; CR4 masks
386 .CR4.AndMask resd 1
387 .CR4.OrMask resd 1
388 ; entered rawmode?
389 .fRawEntered resb 1
390%if RTHCPTR_CB == 8
391 .abPadding resb 7
392%else
393 .abPadding resb 3
394%endif
395
396 ; CPUID leafs
397 .aGuestCpuIdStd resb 16*6
398 .aGuestCpuIdExt resb 16*10
399 .aGuestCpuIdCentaur resb 16*4
400 .GuestCpuIdDef resb 16
401
402 alignb 64
403 ; CPUMCTX debug stuff...
404 .GuestEntry resb 1024
405endstruc
406
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette