VirtualBox

source: vbox/trunk/include/VBox/vm.h@ 13469

Last change on this file since 13469 was 13463, checked in by vboxsync, 16 years ago

REM state size refinements

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 23.5 KB
Line 
1/** @file
2 * VM - The Virtual Machine, data.
3 */
4
5/*
6 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 *
25 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26 * Clara, CA 95054 USA or visit http://www.sun.com if you need
27 * additional information or have any questions.
28 */
29
30#ifndef ___VBox_vm_h
31#define ___VBox_vm_h
32
33#include <VBox/cdefs.h>
34#include <VBox/types.h>
35#include <VBox/cpum.h>
36#include <VBox/stam.h>
37#include <VBox/vmapi.h>
38#include <VBox/sup.h>
39
40
41/** @defgroup grp_vm The Virtual Machine
42 * @{
43 */
44
45
46/**
47 * The state of a virtual CPU.
48 *
49 * The VM running states are a sub-states of the VMSTATE_RUNNING state. While
50 * VMCPUSTATE_NOT_RUNNING is a place holder for the other VM states.
51 */
52typedef enum VMCPUSTATE
53{
54 /** The customary invalid zero. */
55 VMCPUSTATE_INVALID = 0,
56
57 /** Running guest code (VM running). */
58 VMCPUSTATE_RUN_EXEC,
59 /** Running guest code in the recompiler (VM running). */
60 VMCPUSTATE_RUN_EXEC_REM,
61 /** Halted (VM running). */
62 VMCPUSTATE_RUN_HALTED,
63 /** All the other bits we do while running a VM (VM running). */
64 VMCPUSTATE_RUN_MISC,
65 /** VM not running, we're servicing requests or whatever. */
66 VMCPUSTATE_NOT_RUNNING,
67 /** The end of valid virtual CPU states. */
68 VMCPUSTATE_END,
69
70 /** Ensure 32-bit type. */
71 VMCPUSTATE_32BIT_HACK = 0x7fffffff
72} VMCPUSTATE;
73
74
75/**
76 * Per virtual CPU data.
77 */
78typedef struct VMCPU
79{
80 /** Per CPU forced action.
81 * See the VMCPU_FF_* \#defines. Updated atomically. */
82 uint32_t volatile fForcedActions;
83 /** The CPU state. */
84 VMCPUSTATE volatile enmState;
85
86 /** Ring-3 Host Context VM Pointer. */
87 PVMR3 pVMR3;
88 /** Ring-0 Host Context VM Pointer. */
89 PVMR0 pVMR0;
90 /** Raw-mode Context VM Pointer. */
91 PVMRC pVMRC;
92 /** The CPU ID.
93 * This is the index into the VM::aCpus array. */
94 VMCPUID idCpu;
95 /** The ring-3 thread handle of the emulation thread for this CPU.
96 * @todo Use the VM_IS_EMT() macro to check if executing in EMT? */
97 RTTHREAD hThreadR3;
98 /** The native ring-3 handle. */
99 RTNATIVETHREAD hNativeThreadR3;
100 /** The native ring-0 handle. */
101 RTNATIVETHREAD hNativeThreadR0;
102
103 /** Align the next bit on a 64-byte boundrary. */
104 uint32_t au32Alignment[HC_ARCH_BITS == 32 ? 7 : 2];
105
106 /** CPUM part. */
107 union
108 {
109#if 0 /*def ___CPUMInternal_h */
110 struct VMCPUCPUM s;
111#endif
112 char padding[64];
113 } cpum;
114} VMCPU;
115
116
117/** The name of the Guest Context VMM Core module. */
118#define VMMGC_MAIN_MODULE_NAME "VMMGC.gc"
119/** The name of the Ring 0 Context VMM Core module. */
120#define VMMR0_MAIN_MODULE_NAME "VMMR0.r0"
121
122/** VM Forced Action Flags.
123 *
124 * Use the VM_FF_SET() and VM_FF_CLEAR() macros to change the force
125 * action mask of a VM.
126 *
127 * @{
128 */
129/** This action forces the VM to service check and pending interrups on the APIC. */
130#define VM_FF_INTERRUPT_APIC RT_BIT_32(0)
131/** This action forces the VM to service check and pending interrups on the PIC. */
132#define VM_FF_INTERRUPT_PIC RT_BIT_32(1)
133/** This action forces the VM to schedule and run pending timer (TM). */
134#define VM_FF_TIMER RT_BIT_32(2)
135/** PDM Queues are pending. */
136#define VM_FF_PDM_QUEUES RT_BIT_32(3)
137/** PDM DMA transfers are pending. */
138#define VM_FF_PDM_DMA RT_BIT_32(4)
139/** PDM critical section unlocking is pending, process promptly upon return to R3. */
140#define VM_FF_PDM_CRITSECT RT_BIT_32(5)
141
142/** This action forces the VM to call DBGF so DBGF can service debugger
143 * requests in the emulation thread.
144 * This action flag stays asserted till DBGF clears it.*/
145#define VM_FF_DBGF RT_BIT_32(8)
146/** This action forces the VM to service pending requests from other
147 * thread or requests which must be executed in another context. */
148#define VM_FF_REQUEST RT_BIT_32(9)
149/** Terminate the VM immediately. */
150#define VM_FF_TERMINATE RT_BIT_32(10)
151/** Reset the VM. (postponed) */
152#define VM_FF_RESET RT_BIT_32(11)
153
154/** This action forces the VM to resync the page tables before going
155 * back to execute guest code. (GLOBAL FLUSH) */
156#define VM_FF_PGM_SYNC_CR3 RT_BIT_32(16)
157/** Same as VM_FF_PGM_SYNC_CR3 except that global pages can be skipped.
158 * (NON-GLOBAL FLUSH) */
159#define VM_FF_PGM_SYNC_CR3_NON_GLOBAL RT_BIT_32(17)
160/** PGM needs to allocate handy pages. */
161#define VM_FF_PGM_NEED_HANDY_PAGES RT_BIT_32(18)
162/** Check the interupt and trap gates */
163#define VM_FF_TRPM_SYNC_IDT RT_BIT_32(19)
164/** Check Guest's TSS ring 0 stack */
165#define VM_FF_SELM_SYNC_TSS RT_BIT_32(20)
166/** Check Guest's GDT table */
167#define VM_FF_SELM_SYNC_GDT RT_BIT_32(21)
168/** Check Guest's LDT table */
169#define VM_FF_SELM_SYNC_LDT RT_BIT_32(22)
170/** Inhibit interrupts pending. See EMGetInhibitInterruptsPC(). */
171#define VM_FF_INHIBIT_INTERRUPTS RT_BIT_32(23)
172
173/** CSAM needs to scan the page that's being executed */
174#define VM_FF_CSAM_SCAN_PAGE RT_BIT_32(24)
175/** CSAM needs to do some homework. */
176#define VM_FF_CSAM_PENDING_ACTION RT_BIT_32(25)
177
178/** Force return to Ring-3. */
179#define VM_FF_TO_R3 RT_BIT_32(28)
180
181/** REM needs to be informed about handler changes. */
182#define VM_FF_REM_HANDLER_NOTIFY RT_BIT_32(29)
183
184/** Suspend the VM - debug only. */
185#define VM_FF_DEBUG_SUSPEND RT_BIT_32(31)
186
187/** Externally forced actions. Used to quit the idle/wait loop. */
188#define VM_FF_EXTERNAL_SUSPENDED_MASK (VM_FF_TERMINATE | VM_FF_DBGF | VM_FF_REQUEST)
189/** Externally forced actions. Used to quit the idle/wait loop. */
190#define VM_FF_EXTERNAL_HALTED_MASK (VM_FF_TERMINATE | VM_FF_DBGF | VM_FF_TIMER | VM_FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_REQUEST | VM_FF_PDM_QUEUES | VM_FF_PDM_DMA)
191/** High priority pre-execution actions. */
192#define VM_FF_HIGH_PRIORITY_PRE_MASK (VM_FF_TERMINATE | VM_FF_DBGF | VM_FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_DEBUG_SUSPEND \
193 | VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL | VM_FF_SELM_SYNC_TSS | VM_FF_TRPM_SYNC_IDT | VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT | VM_FF_PGM_NEED_HANDY_PAGES)
194/** High priority pre raw-mode execution mask. */
195#define VM_FF_HIGH_PRIORITY_PRE_RAW_MASK (VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL | VM_FF_SELM_SYNC_TSS | VM_FF_TRPM_SYNC_IDT | VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT | VM_FF_PGM_NEED_HANDY_PAGES \
196 | VM_FF_INHIBIT_INTERRUPTS)
197/** High priority post-execution actions. */
198#define VM_FF_HIGH_PRIORITY_POST_MASK (VM_FF_PDM_CRITSECT | VM_FF_CSAM_PENDING_ACTION)
199/** Normal priority post-execution actions. */
200#define VM_FF_NORMAL_PRIORITY_POST_MASK (VM_FF_TERMINATE | VM_FF_DBGF | VM_FF_RESET | VM_FF_CSAM_SCAN_PAGE)
201/** Normal priority actions. */
202#define VM_FF_NORMAL_PRIORITY_MASK (VM_FF_REQUEST | VM_FF_PDM_QUEUES | VM_FF_PDM_DMA | VM_FF_REM_HANDLER_NOTIFY)
203/** Flags to check before resuming guest execution. */
204#define VM_FF_RESUME_GUEST_MASK (VM_FF_TO_R3)
205/** All the forced flags. */
206#define VM_FF_ALL_MASK (~0U)
207/** All the forced flags. */
208#define VM_FF_ALL_BUT_RAW_MASK (~(VM_FF_HIGH_PRIORITY_PRE_RAW_MASK | VM_FF_CSAM_PENDING_ACTION | VM_FF_PDM_CRITSECT))
209
210/** @} */
211
212/** @def VM_FF_SET
213 * Sets a force action flag.
214 *
215 * @param pVM VM Handle.
216 * @param fFlag The flag to set.
217 */
218#if 1
219# define VM_FF_SET(pVM, fFlag) ASMAtomicOrU32(&(pVM)->fForcedActions, (fFlag))
220#else
221# define VM_FF_SET(pVM, fFlag) \
222 do { ASMAtomicOrU32(&(pVM)->fForcedActions, (fFlag)); \
223 RTLogPrintf("VM_FF_SET : %08x %s - %s(%d) %s\n", (pVM)->fForcedActions, #fFlag, __FILE__, __LINE__, __FUNCTION__); \
224 } while (0)
225#endif
226
227/** @def VMCPU_FF_SET
228 * Sets a force action flag for given VCPU.
229 *
230 * @param pVM VM Handle.
231 * @param idCpu Virtual CPU ID.
232 * @param fFlag The flag to set.
233 */
234#ifdef VBOX_WITH_SMP_GUESTS
235# define VMCPU_FF_SET(pVM, idCpu, fFlag) ASMAtomicOrU32(&(pVM)->aCpus[idCpu].fForcedActions, (fFlag))
236#else
237# define VMCPU_FF_SET(pVM, idCpu, fFlag) VM_FF_SET(pVM, fFlag)
238#endif
239
240/** @def VM_FF_CLEAR
241 * Clears a force action flag.
242 *
243 * @param pVM VM Handle.
244 * @param fFlag The flag to clear.
245 */
246#if 1
247# define VM_FF_CLEAR(pVM, fFlag) ASMAtomicAndU32(&(pVM)->fForcedActions, ~(fFlag))
248#else
249# define VM_FF_CLEAR(pVM, fFlag) \
250 do { ASMAtomicAndU32(&(pVM)->fForcedActions, ~(fFlag)); \
251 RTLogPrintf("VM_FF_CLEAR: %08x %s - %s(%d) %s\n", (pVM)->fForcedActions, #fFlag, __FILE__, __LINE__, __FUNCTION__); \
252 } while (0)
253#endif
254
255/** @def VMCPU_FF_CLEAR
256 * Clears a force action flag for given VCPU.
257 *
258 * @param pVM VM Handle.
259 * @param idCpu Virtual CPU ID.
260 * @param fFlag The flag to clear.
261 */
262#ifdef VBOX_WITH_SMP_GUESTS
263# define VMCPU_FF_CLEAR(pVM, idCpu, fFlag) ASMAtomicAndU32(&(pVM)->aCpus[idCpu].fForcedActions, ~(fFlag))
264#else
265# define VMCPU_FF_CLEAR(pVM, idCpu, fFlag) VM_FF_CLEAR(pVM, fFlag)
266#endif
267
268/** @def VM_FF_ISSET
269 * Checks if a force action flag is set.
270 *
271 * @param pVM VM Handle.
272 * @param fFlag The flag to check.
273 */
274#define VM_FF_ISSET(pVM, fFlag) (((pVM)->fForcedActions & (fFlag)) == (fFlag))
275
276/** @def VMCPU_FF_ISSET
277 * Checks if a force action flag is set for given VCPU.
278 *
279 * @param pVM VM Handle.
280 * @param idCpu Virtual CPU ID.
281 * @param fFlag The flag to check.
282 */
283#ifdef VBOX_WITH_SMP_GUESTS
284# define VMCPU_FF_ISSET(pVM, idCpu, fFlag) (((pVM)->aCpus[idCpu].fForcedActions & (fFlag)) == (fFlag))
285#else
286# define VMCPU_FF_ISSET(pVM, idCpu, fFlag) VM_FF_ISSET(pVM, fFlag)
287#endif
288
289/** @def VM_FF_ISPENDING
290 * Checks if one or more force action in the specified set is pending.
291 *
292 * @param pVM VM Handle.
293 * @param fFlags The flags to check for.
294 */
295#define VM_FF_ISPENDING(pVM, fFlags) ((pVM)->fForcedActions & (fFlags))
296
297/** @def VMCPU_FF_ISPENDING
298 * Checks if one or more force action in the specified set is pending for given VCPU.
299 *
300 * @param pVM VM Handle.
301 * @param idCpu Virtual CPU ID.
302 * @param fFlags The flags to check for.
303 */
304#ifdef VBOX_WITH_SMP_GUESTS
305# define VMCPU_FF_ISPENDING(pVM, idCpu, fFlags) ((pVM)->aCpus[idCpu].fForcedActions & (fFlags))
306#else
307# define VMCPU_FF_ISPENDING(pVM, idCpu, fFlags) VM_FF_ISPENDING(pVM, fFlags)
308#endif
309
310/** @def VM_IS_EMT
311 * Checks if the current thread is the emulation thread (EMT).
312 *
313 * @remark The ring-0 variation will need attention if we expand the ring-0
314 * code to let threads other than EMT mess around with the VM.
315 */
316#ifdef IN_GC
317# define VM_IS_EMT(pVM) true
318#elif defined(IN_RING0)
319# define VM_IS_EMT(pVM) true
320#else
321/** @todo need to rework this macro for the case of multiple emulation threads for SMP */
322# define VM_IS_EMT(pVM) ((pVM)->NativeThreadEMT == RTThreadNativeSelf())
323#endif
324
325/** @def VM_ASSERT_EMT
326 * Asserts that the current thread IS the emulation thread (EMT).
327 */
328#ifdef IN_GC
329# define VM_ASSERT_EMT(pVM) Assert(VM_IS_EMT(pVM))
330#elif defined(IN_RING0)
331# define VM_ASSERT_EMT(pVM) Assert(VM_IS_EMT(pVM))
332#else
333# define VM_ASSERT_EMT(pVM) \
334 AssertMsg(VM_IS_EMT(pVM), \
335 ("Not emulation thread! Thread=%RTnthrd ThreadEMT=%RTnthrd\n", RTThreadNativeSelf(), pVM->NativeThreadEMT))
336#endif
337
338/** @def VM_ASSERT_EMT_RETURN
339 * Asserts that the current thread IS the emulation thread (EMT) and returns if it isn't.
340 */
341#ifdef IN_GC
342# define VM_ASSERT_EMT_RETURN(pVM, rc) AssertReturn(VM_IS_EMT(pVM), (rc))
343#elif defined(IN_RING0)
344# define VM_ASSERT_EMT_RETURN(pVM, rc) AssertReturn(VM_IS_EMT(pVM), (rc))
345#else
346# define VM_ASSERT_EMT_RETURN(pVM, rc) \
347 AssertMsgReturn(VM_IS_EMT(pVM), \
348 ("Not emulation thread! Thread=%RTnthrd ThreadEMT=%RTnthrd\n", RTThreadNativeSelf(), pVM->NativeThreadEMT), \
349 (rc))
350#endif
351
352/**
353 * Asserts that the current thread is NOT the emulation thread.
354 */
355#define VM_ASSERT_OTHER_THREAD(pVM) \
356 AssertMsg(!VM_IS_EMT(pVM), ("Not other thread!!\n"))
357
358
359/** @def VM_ASSERT_STATE_RETURN
360 * Asserts a certain VM state.
361 */
362#define VM_ASSERT_STATE(pVM, _enmState) \
363 AssertMsg((pVM)->enmVMState == (_enmState), \
364 ("state %s, expected %s\n", VMGetStateName(pVM->enmVMState), VMGetStateName(_enmState)))
365
366/** @def VM_ASSERT_STATE_RETURN
367 * Asserts a certain VM state and returns if it doesn't match.
368 */
369#define VM_ASSERT_STATE_RETURN(pVM, _enmState, rc) \
370 AssertMsgReturn((pVM)->enmVMState == (_enmState), \
371 ("state %s, expected %s\n", VMGetStateName(pVM->enmVMState), VMGetStateName(_enmState)), \
372 (rc))
373
374
375
376
377/** This is the VM structure.
378 *
379 * It contains (nearly?) all the VM data which have to be available in all
380 * contexts. Even if it contains all the data the idea is to use APIs not
381 * to modify all the members all around the place. Therefore we make use of
382 * unions to hide everything which isn't local to the current source module.
383 * This means we'll have to pay a little bit of attention when adding new
384 * members to structures in the unions and make sure to keep the padding sizes
385 * up to date.
386 *
387 * Run tstVMStructSize after update!
388 */
389typedef struct VM
390{
391 /** The state of the VM.
392 * This field is read only to everyone except the VM and EM. */
393 VMSTATE enmVMState;
394 /** Forced action flags.
395 * See the VM_FF_* \#defines. Updated atomically.
396 */
397 volatile uint32_t fForcedActions;
398 /** Pointer to the array of page descriptors for the VM structure allocation. */
399 R3PTRTYPE(PSUPPAGE) paVMPagesR3;
400 /** Session handle. For use when calling SUPR0 APIs. */
401 PSUPDRVSESSION pSession;
402 /** Pointer to the ring-3 VM structure. */
403 PUVM pUVM;
404 /** Ring-3 Host Context VM Pointer. */
405 R3PTRTYPE(struct VM *) pVMR3;
406 /** Ring-0 Host Context VM Pointer. */
407 R0PTRTYPE(struct VM *) pVMR0;
408 /** Raw-mode Context VM Pointer.
409 * @deprecated Use VM::pVMRC. */
410 RCPTRTYPE(struct VM *) pVMGC;
411 /** Raw-mode Context VM Pointer. */
412 RCPTRTYPE(struct VM *) pVMRC;
413
414 /** The GVM VM handle. Only the GVM should modify this field. */
415 uint32_t hSelf;
416 /** Number of virtual CPUs. */
417 uint32_t cCPUs;
418 /** Reserved; alignment. */
419 uint32_t u32Reserved[7];
420
421 /** @name Public VMM Switcher APIs
422 * @{ */
423 /**
424 * Assembly switch entry point for returning to host context.
425 * This function will clean up the stack frame.
426 *
427 * @param eax The return code, register.
428 * @param Ctx The guest core context.
429 * @remark Assume interrupts disabled.
430 */
431 RTGCPTR32 pfnVMMGCGuestToHostAsmGuestCtx/*(int32_t eax, CPUMCTXCORE Ctx)*/;
432
433 /**
434 * Assembly switch entry point for returning to host context.
435 *
436 * This is an alternative entry point which we'll be using when the we have the
437 * hypervisor context and need to save that before going to the host.
438 *
439 * This is typically useful when abandoning the hypervisor because of a trap
440 * and want the trap state to be saved.
441 *
442 * @param eax The return code, register.
443 * @param ecx Pointer to the hypervisor core context, register.
444 * @remark Assume interrupts disabled.
445 */
446 RTGCPTR32 pfnVMMGCGuestToHostAsmHyperCtx/*(int32_t eax, PCPUMCTXCORE ecx)*/;
447
448 /**
449 * Assembly switch entry point for returning to host context.
450 *
451 * This is an alternative to the two *Ctx APIs and implies that the context has already
452 * been saved, or that it's just a brief return to HC and that the caller intends to resume
453 * whatever it is doing upon 'return' from this call.
454 *
455 * @param eax The return code, register.
456 * @remark Assume interrupts disabled.
457 */
458 RTGCPTR32 pfnVMMGCGuestToHostAsm/*(int32_t eax)*/;
459 /** @} */
460
461
462 /** @name Various VM data owned by VM.
463 * @{ */
464 /** The thread handle of the emulation thread.
465 * Use the VM_IS_EMT() macro to check if executing in EMT. */
466 RTTHREAD ThreadEMT;
467 /** The native handle of ThreadEMT. Getting the native handle
468 * is generally faster than getting the IPRT one (except on OS/2 :-). */
469 RTNATIVETHREAD NativeThreadEMT;
470 /** @} */
471
472
473 /** @name Various items that are frequently accessed.
474 * @{ */
475 /** Raw ring-3 indicator. */
476 bool fRawR3Enabled;
477 /** Raw ring-0 indicator. */
478 bool fRawR0Enabled;
479 /** PATM enabled flag.
480 * This is placed here for performance reasons. */
481 bool fPATMEnabled;
482 /** CSAM enabled flag.
483 * This is placed here for performance reasons. */
484 bool fCSAMEnabled;
485
486 /** Hardware VM support is available and enabled.
487 * This is placed here for performance reasons. */
488 bool fHWACCMEnabled;
489
490 /** PARAV enabled flag. */
491 bool fPARAVEnabled;
492 /** @} */
493
494
495 /* padding to make gnuc put the StatQemuToGC where msc does. */
496#if HC_ARCH_BITS == 32
497 uint32_t padding0;
498#endif
499
500 /** Profiling the total time from Qemu to GC. */
501 STAMPROFILEADV StatTotalQemuToGC;
502 /** Profiling the total time from GC to Qemu. */
503 STAMPROFILEADV StatTotalGCToQemu;
504 /** Profiling the total time spent in GC. */
505 STAMPROFILEADV StatTotalInGC;
506 /** Profiling the total time spent not in Qemu. */
507 STAMPROFILEADV StatTotalInQemu;
508 /** Profiling the VMMSwitcher code for going to GC. */
509 STAMPROFILEADV StatSwitcherToGC;
510 /** Profiling the VMMSwitcher code for going to HC. */
511 STAMPROFILEADV StatSwitcherToHC;
512 STAMPROFILEADV StatSwitcherSaveRegs;
513 STAMPROFILEADV StatSwitcherSysEnter;
514 STAMPROFILEADV StatSwitcherDebug;
515 STAMPROFILEADV StatSwitcherCR0;
516 STAMPROFILEADV StatSwitcherCR4;
517 STAMPROFILEADV StatSwitcherJmpCR3;
518 STAMPROFILEADV StatSwitcherRstrRegs;
519 STAMPROFILEADV StatSwitcherLgdt;
520 STAMPROFILEADV StatSwitcherLidt;
521 STAMPROFILEADV StatSwitcherLldt;
522 STAMPROFILEADV StatSwitcherTSS;
523
524/** @todo Realign everything on 64 byte boundraries to better match the
525 * cache-line size. */
526 /* padding - the unions must be aligned on 32 bytes boundraries. */
527 uint32_t padding[HC_ARCH_BITS == 32 ? 4+8 : 6];
528
529 /** CPUM part. */
530 union
531 {
532#ifdef ___CPUMInternal_h
533 struct CPUM s;
534#endif
535 char padding[4416]; /* multiple of 32 */
536 } cpum;
537
538 /** VMM part. */
539 union
540 {
541#ifdef ___VMMInternal_h
542 struct VMM s;
543#endif
544 char padding[1536]; /* multiple of 32 */
545 } vmm;
546
547 /** PGM part. */
548 union
549 {
550#ifdef ___PGMInternal_h
551 struct PGM s;
552#endif
553 char padding[50*1024]; /* multiple of 32 */
554 } pgm;
555
556 /** HWACCM part. */
557 union
558 {
559#ifdef ___HWACCMInternal_h
560 struct HWACCM s;
561#endif
562 char padding[1536]; /* multiple of 32 */
563 } hwaccm;
564
565 /** TRPM part. */
566 union
567 {
568#ifdef ___TRPMInternal_h
569 struct TRPM s;
570#endif
571 char padding[5344]; /* multiple of 32 */
572 } trpm;
573
574 /** SELM part. */
575 union
576 {
577#ifdef ___SELMInternal_h
578 struct SELM s;
579#endif
580 char padding[544]; /* multiple of 32 */
581 } selm;
582
583 /** MM part. */
584 union
585 {
586#ifdef ___MMInternal_h
587 struct MM s;
588#endif
589 char padding[192]; /* multiple of 32 */
590 } mm;
591
592 /** CFGM part. */
593 union
594 {
595#ifdef ___CFGMInternal_h
596 struct CFGM s;
597#endif
598 char padding[32]; /* multiple of 32 */
599 } cfgm;
600
601 /** PDM part. */
602 union
603 {
604#ifdef ___PDMInternal_h
605 struct PDM s;
606#endif
607 char padding[1824]; /* multiple of 32 */
608 } pdm;
609
610 /** IOM part. */
611 union
612 {
613#ifdef ___IOMInternal_h
614 struct IOM s;
615#endif
616 char padding[4544]; /* multiple of 32 */
617 } iom;
618
619 /** PATM part. */
620 union
621 {
622#ifdef ___PATMInternal_h
623 struct PATM s;
624#endif
625 char padding[768]; /* multiple of 32 */
626 } patm;
627
628 /** CSAM part. */
629 union
630 {
631#ifdef ___CSAMInternal_h
632 struct CSAM s;
633#endif
634 char padding[3328]; /* multiple of 32 */
635 } csam;
636
637 /** PARAV part. */
638 union
639 {
640#ifdef ___PARAVInternal_h
641 struct PARAV s;
642#endif
643 char padding[128];
644 } parav;
645
646 /** EM part. */
647 union
648 {
649#ifdef ___EMInternal_h
650 struct EM s;
651#endif
652 char padding[1344]; /* multiple of 32 */
653 } em;
654
655 /** TM part. */
656 union
657 {
658#ifdef ___TMInternal_h
659 struct TM s;
660#endif
661 char padding[1344]; /* multiple of 32 */
662 } tm;
663
664 /** DBGF part. */
665 union
666 {
667#ifdef ___DBGFInternal_h
668 struct DBGF s;
669#endif
670 char padding[2368]; /* multiple of 32 */
671 } dbgf;
672
673 /** SSM part. */
674 union
675 {
676#ifdef ___SSMInternal_h
677 struct SSM s;
678#endif
679 char padding[32]; /* multiple of 32 */
680 } ssm;
681
682 /** VM part. */
683 union
684 {
685#ifdef ___VMInternal_h
686 struct VMINT s;
687#endif
688 char padding[768]; /* multiple of 32 */
689 } vm;
690
691 /** REM part. */
692 union
693 {
694#ifdef ___REMInternal_h
695 struct REM s;
696#endif
697
698#ifdef VBOX_WITH_NEW_RECOMPILER
699/** @def VM_REM_SIZE
700 * Must be multiple of 32 and coherent with REM_ENV_SIZE from REMInternal.h. */
701#if GC_ARCH_BITS == 32
702# define VM_REM_SIZE (HC_ARCH_BITS == 32 ? 0xff00 : 0xff00)
703#else
704# define VM_REM_SIZE (HC_ARCH_BITS == 32 ? 0x10900 : 0x10900)
705#endif
706#else /* !VBOX_WITH_NEW_RECOMILER */
707#if GC_ARCH_BITS == 32
708# define VM_REM_SIZE (HC_ARCH_BITS == 32 ? 0x6f00 : 0xbf00)
709#else
710# define VM_REM_SIZE (HC_ARCH_BITS == 32 ? 0x9f00 : 0xdf00)
711#endif
712#endif /* !VBOX_WITH_NEW_RECOMILER */
713 char padding[VM_REM_SIZE]; /* multiple of 32 */
714 } rem;
715
716 /** Padding for aligning the cpu array on a 64 byte boundrary. */
717 uint32_t u32Reserved2[8];
718
719 /**
720 * Per virtual CPU state.
721 */
722 VMCPU aCpus[1];
723} VM;
724
725/** Pointer to a VM. */
726#ifndef ___VBox_types_h
727typedef struct VM *PVM;
728#endif
729
730
731#ifdef IN_GC
732__BEGIN_DECLS
733
734/** The VM structure.
735 * This is imported from the VMMGCBuiltin module, i.e. it's a one
736 * of those magic globals which we should avoid using.
737 */
738extern DECLIMPORT(VM) g_VM;
739
740__END_DECLS
741#endif
742
743/** @} */
744
745#endif
746
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