VirtualBox

source: vbox/trunk/include/VBox/vmm/vm.h@ 41218

Last change on this file since 41218 was 41218, checked in by vboxsync, 13 years ago

Tweaks for DTrace.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 39.7 KB
Line 
1/** @file
2 * VM - The Virtual Machine, data.
3 */
4
5/*
6 * Copyright (C) 2006-2012 Oracle Corporation
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
26#ifndef ___VBox_vmm_vm_h
27#define ___VBox_vmm_vm_h
28
29#include <VBox/types.h>
30#include <VBox/vmm/cpum.h>
31#include <VBox/vmm/stam.h>
32#include <VBox/vmm/vmapi.h>
33#include <VBox/vmm/vmm.h>
34#include <VBox/sup.h>
35
36
37/** @defgroup grp_vm The Virtual Machine
38 * @{
39 */
40
41/**
42 * The state of a Virtual CPU.
43 *
44 * The basic state indicated here is whether the CPU has been started or not. In
45 * addition, there are sub-states when started for assisting scheduling (GVMM
46 * mostly).
47 *
48 * The transision out of the STOPPED state is done by a vmR3PowerOn.
49 * The transision back to the STOPPED state is done by vmR3PowerOff.
50 *
51 * (Alternatively we could let vmR3PowerOn start CPU 0 only and let the SPIP
52 * handling switch on the other CPUs. Then vmR3Reset would stop all but CPU 0.)
53 */
54typedef enum VMCPUSTATE
55{
56 /** The customary invalid zero. */
57 VMCPUSTATE_INVALID = 0,
58
59 /** Virtual CPU has not yet been started. */
60 VMCPUSTATE_STOPPED,
61
62 /** CPU started. */
63 VMCPUSTATE_STARTED,
64 /** Executing guest code and can be poked. */
65 VMCPUSTATE_STARTED_EXEC,
66 /** Executing guest code in the recompiler. */
67 VMCPUSTATE_STARTED_EXEC_REM,
68 /** Halted. */
69 VMCPUSTATE_STARTED_HALTED,
70
71 /** The end of valid virtual CPU states. */
72 VMCPUSTATE_END,
73
74 /** Ensure 32-bit type. */
75 VMCPUSTATE_32BIT_HACK = 0x7fffffff
76} VMCPUSTATE;
77
78
79/**
80 * Per virtual CPU data.
81 */
82typedef struct VMCPU
83{
84 /** Per CPU forced action.
85 * See the VMCPU_FF_* \#defines. Updated atomically. */
86 uint32_t volatile fLocalForcedActions; /* 0 */
87 /** The CPU state. */
88 VMCPUSTATE volatile enmState; /* 4 */
89
90 /** Pointer to the ring-3 UVMCPU structure. */
91 PUVMCPU pUVCpu; /* 8 */
92 /** Ring-3 Host Context VM Pointer. */
93 PVMR3 pVMR3; /* 16 / 12 */
94 /** Ring-0 Host Context VM Pointer. */
95 PVMR0 pVMR0; /* 24 / 16 */
96 /** Raw-mode Context VM Pointer. */
97 PVMRC pVMRC; /* 32 / 20 */
98 /** The CPU ID.
99 * This is the index into the VM::aCpu array. */
100 VMCPUID idCpu; /* 36 / 24 */
101 /** The native thread handle. */
102 RTNATIVETHREAD hNativeThread; /* 40 / 28 */
103 /** The native R0 thread handle. (different from the R3 handle!) */
104 RTNATIVETHREAD hNativeThreadR0; /* 48 / 32 */
105 /** Which host CPU ID is this EMT running on.
106 * Only valid when in RC or HWACCMR0 with scheduling disabled. */
107 RTCPUID volatile idHostCpu; /* 56 / 36 */
108
109 /** Trace groups enable flags. */
110 uint32_t fTraceGroups; /* 60 / 40 */
111 /** Align the structures below bit on a 64-byte boundary and make sure it starts
112 * at the same offset in both 64-bit and 32-bit builds.
113 *
114 * @remarks The alignments of the members that are larger than 48 bytes should be
115 * 64-byte for cache line reasons. structs containing small amounts of
116 * data could be lumped together at the end with a < 64 byte padding
117 * following it (to grow into and align the struct size).
118 * */
119 uint8_t abAlignment1[HC_ARCH_BITS == 64 ? 60 : 16+64];
120 /** State data for use by ad hoc profiling. */
121 uint32_t uAdHoc;
122 /** Profiling samples for use by ad hoc profiling. */
123 STAMPROFILEADV aStatAdHoc[8]; /* size: 40*8 = 320 */
124
125 /** CPUM part. */
126 union
127 {
128#ifdef ___CPUMInternal_h
129 struct CPUMCPU s;
130#endif
131 uint8_t padding[3456]; /* multiple of 64 */
132 } cpum;
133
134 /** HWACCM part. */
135 union
136 {
137#ifdef ___HWACCMInternal_h
138 struct HWACCMCPU s;
139#endif
140 uint8_t padding[5376]; /* multiple of 64 */
141 } hwaccm;
142
143 /** EM part. */
144 union
145 {
146#ifdef ___EMInternal_h
147 struct EMCPU s;
148#endif
149 uint8_t padding[1472]; /* multiple of 64 */
150 } em;
151
152 /** IEM part. */
153 union
154 {
155#ifdef ___IEMInternal_h
156 struct IEMCPU s;
157#endif
158 uint8_t padding[3072]; /* multiple of 64 */
159 } iem;
160
161 /** TRPM part. */
162 union
163 {
164#ifdef ___TRPMInternal_h
165 struct TRPMCPU s;
166#endif
167 uint8_t padding[128]; /* multiple of 64 */
168 } trpm;
169
170 /** TM part. */
171 union
172 {
173#ifdef ___TMInternal_h
174 struct TMCPU s;
175#endif
176 uint8_t padding[384]; /* multiple of 64 */
177 } tm;
178
179 /** VMM part. */
180 union
181 {
182#ifdef ___VMMInternal_h
183 struct VMMCPU s;
184#endif
185 uint8_t padding[640]; /* multiple of 64 */
186 } vmm;
187
188 /** PDM part. */
189 union
190 {
191#ifdef ___PDMInternal_h
192 struct PDMCPU s;
193#endif
194 uint8_t padding[128]; /* multiple of 64 */
195 } pdm;
196
197 /** IOM part. */
198 union
199 {
200#ifdef ___IOMInternal_h
201 struct IOMCPU s;
202#endif
203 uint8_t padding[512]; /* multiple of 64 */
204 } iom;
205
206 /** DBGF part.
207 * @todo Combine this with other tiny structures. */
208 union
209 {
210#ifdef ___DBGFInternal_h
211 struct DBGFCPU s;
212#endif
213 uint8_t padding[64]; /* multiple of 64 */
214 } dbgf;
215
216 /** Align the following members on page boundary. */
217 uint8_t abAlignment2[1024 - 320];
218
219 /** PGM part. */
220 union
221 {
222#ifdef ___PGMInternal_h
223 struct PGMCPU s;
224#endif
225 uint8_t padding[4096]; /* multiple of 4096 */
226 } pgm;
227
228} VMCPU;
229
230
231#ifndef VBOX_FOR_DTRACE_LIB
232
233/** @name Operations on VMCPU::enmState
234 * @{ */
235/** Gets the VMCPU state. */
236#define VMCPU_GET_STATE(pVCpu) ( (pVCpu)->enmState )
237/** Sets the VMCPU state. */
238#define VMCPU_SET_STATE(pVCpu, enmNewState) \
239 ASMAtomicWriteU32((uint32_t volatile *)&(pVCpu)->enmState, (enmNewState))
240/** Cmpares and sets the VMCPU state. */
241#define VMCPU_CMPXCHG_STATE(pVCpu, enmNewState, enmOldState) \
242 ASMAtomicCmpXchgU32((uint32_t volatile *)&(pVCpu)->enmState, (enmNewState), (enmOldState))
243/** Checks the VMCPU state. */
244#ifdef VBOX_STRICT
245# define VMCPU_ASSERT_STATE(pVCpu, enmExpectedState) \
246 do { \
247 VMCPUSTATE enmState = VMCPU_GET_STATE(pVCpu); \
248 AssertMsg(enmState == (enmExpectedState), \
249 ("enmState=%d enmExpectedState=%d idCpu=%u\n", \
250 enmState, enmExpectedState, (pVCpu)->idCpu)); \
251 } while (0)
252#else
253# define VMCPU_ASSERT_STATE(pVCpu, enmExpectedState) do { } while (0)
254#endif
255/** Tests if the state means that the CPU is started. */
256#define VMCPUSTATE_IS_STARTED(enmState) ( (enmState) > VMCPUSTATE_STOPPED )
257/** Tests if the state means that the CPU is stopped. */
258#define VMCPUSTATE_IS_STOPPED(enmState) ( (enmState) == VMCPUSTATE_STOPPED )
259/** @} */
260
261
262/** The name of the Guest Context VMM Core module. */
263#define VMMGC_MAIN_MODULE_NAME "VMMGC.gc"
264/** The name of the Ring 0 Context VMM Core module. */
265#define VMMR0_MAIN_MODULE_NAME "VMMR0.r0"
266
267/** VM Forced Action Flags.
268 *
269 * Use the VM_FF_SET() and VM_FF_CLEAR() macros to change the force
270 * action mask of a VM.
271 *
272 * @{
273 */
274/** The virtual sync clock has been stopped, go to TM until it has been
275 * restarted... */
276#define VM_FF_TM_VIRTUAL_SYNC RT_BIT_32(2)
277/** PDM Queues are pending. */
278#define VM_FF_PDM_QUEUES RT_BIT_32(VM_FF_PDM_QUEUES_BIT)
279/** The bit number for VM_FF_PDM_QUEUES. */
280#define VM_FF_PDM_QUEUES_BIT 3
281/** PDM DMA transfers are pending. */
282#define VM_FF_PDM_DMA RT_BIT_32(VM_FF_PDM_DMA_BIT)
283/** The bit number for VM_FF_PDM_DMA. */
284#define VM_FF_PDM_DMA_BIT 4
285/** This action forces the VM to call DBGF so DBGF can service debugger
286 * requests in the emulation thread.
287 * This action flag stays asserted till DBGF clears it.*/
288#define VM_FF_DBGF RT_BIT_32(VM_FF_DBGF_BIT)
289/** The bit number for VM_FF_DBGF. */
290#define VM_FF_DBGF_BIT 8
291/** This action forces the VM to service pending requests from other
292 * thread or requests which must be executed in another context. */
293#define VM_FF_REQUEST RT_BIT_32(9)
294/** Check for VM state changes and take appropriate action. */
295#define VM_FF_CHECK_VM_STATE RT_BIT_32(VM_FF_CHECK_VM_STATE_BIT)
296/** The bit number for VM_FF_CHECK_VM_STATE. */
297#define VM_FF_CHECK_VM_STATE_BIT 10
298/** Reset the VM. (postponed) */
299#define VM_FF_RESET RT_BIT_32(VM_FF_RESET_BIT)
300/** The bit number for VM_FF_RESET. */
301#define VM_FF_RESET_BIT 11
302/** EMT rendezvous in VMM. */
303#define VM_FF_EMT_RENDEZVOUS RT_BIT_32(VM_FF_EMT_RENDEZVOUS_BIT)
304/** The bit number for VM_FF_EMT_RENDEZVOUS. */
305#define VM_FF_EMT_RENDEZVOUS_BIT 12
306
307/** PGM needs to allocate handy pages. */
308#define VM_FF_PGM_NEED_HANDY_PAGES RT_BIT_32(18)
309/** PGM is out of memory.
310 * Abandon all loops and code paths which can be resumed and get up to the EM
311 * loops. */
312#define VM_FF_PGM_NO_MEMORY RT_BIT_32(19)
313 /** PGM is about to perform a lightweight pool flush
314 * Guest SMP: all EMT threads should return to ring 3
315 */
316#define VM_FF_PGM_POOL_FLUSH_PENDING RT_BIT_32(20)
317/** REM needs to be informed about handler changes. */
318#define VM_FF_REM_HANDLER_NOTIFY RT_BIT_32(VM_FF_REM_HANDLER_NOTIFY_BIT)
319/** The bit number for VM_FF_REM_HANDLER_NOTIFY. */
320#define VM_FF_REM_HANDLER_NOTIFY_BIT 29
321/** Suspend the VM - debug only. */
322#define VM_FF_DEBUG_SUSPEND RT_BIT_32(31)
323
324
325/** This action forces the VM to check any pending interrups on the APIC. */
326#define VMCPU_FF_INTERRUPT_APIC RT_BIT_32(0)
327/** This action forces the VM to check any pending interrups on the PIC. */
328#define VMCPU_FF_INTERRUPT_PIC RT_BIT_32(1)
329/** This action forces the VM to schedule and run pending timer (TM).
330 * @remarks Don't move - PATM compatibility. */
331#define VMCPU_FF_TIMER RT_BIT_32(2)
332/** This action forces the VM to check any pending NMIs. */
333#define VMCPU_FF_INTERRUPT_NMI_BIT 3
334#define VMCPU_FF_INTERRUPT_NMI RT_BIT_32(VMCPU_FF_INTERRUPT_NMI_BIT)
335/** This action forces the VM to check any pending SMIs. */
336#define VMCPU_FF_INTERRUPT_SMI_BIT 4
337#define VMCPU_FF_INTERRUPT_SMI RT_BIT_32(VMCPU_FF_INTERRUPT_SMI_BIT)
338/** PDM critical section unlocking is pending, process promptly upon return to R3. */
339#define VMCPU_FF_PDM_CRITSECT RT_BIT_32(5)
340/** This action forces the VM to service pending requests from other
341 * thread or requests which must be executed in another context. */
342#define VMCPU_FF_REQUEST RT_BIT_32(9)
343/** This action forces the VM to resync the page tables before going
344 * back to execute guest code. (GLOBAL FLUSH) */
345#define VMCPU_FF_PGM_SYNC_CR3 RT_BIT_32(16)
346/** Same as VM_FF_PGM_SYNC_CR3 except that global pages can be skipped.
347 * (NON-GLOBAL FLUSH) */
348#define VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL RT_BIT_32(17)
349/** Check for pending TLB shootdown actions.
350 * Consumer: HWACCM
351 * @todo rename to VMCPU_FF_HWACCM_TLB_SHOOTDOWN */
352#define VMCPU_FF_TLB_SHOOTDOWN RT_BIT_32(18)
353/** Check for pending TLB flush action.
354 * Consumer: HWACCM
355 * @todo rename to VMCPU_FF_HWACCM_TLB_FLUSH */
356#define VMCPU_FF_TLB_FLUSH RT_BIT_32(VMCPU_FF_TLB_FLUSH_BIT)
357/** The bit number for VMCPU_FF_TLB_FLUSH. */
358#define VMCPU_FF_TLB_FLUSH_BIT 19
359/** Check the interrupt and trap gates */
360#define VMCPU_FF_TRPM_SYNC_IDT RT_BIT_32(20)
361/** Check Guest's TSS ring 0 stack */
362#define VMCPU_FF_SELM_SYNC_TSS RT_BIT_32(21)
363/** Check Guest's GDT table */
364#define VMCPU_FF_SELM_SYNC_GDT RT_BIT_32(22)
365/** Check Guest's LDT table */
366#define VMCPU_FF_SELM_SYNC_LDT RT_BIT_32(23)
367/** Inhibit interrupts pending. See EMGetInhibitInterruptsPC(). */
368#define VMCPU_FF_INHIBIT_INTERRUPTS RT_BIT_32(24)
369/** CSAM needs to scan the page that's being executed */
370#define VMCPU_FF_CSAM_SCAN_PAGE RT_BIT_32(26)
371/** CSAM needs to do some homework. */
372#define VMCPU_FF_CSAM_PENDING_ACTION RT_BIT_32(27)
373/** Force return to Ring-3. */
374#define VMCPU_FF_TO_R3 RT_BIT_32(28)
375
376/** Externally VM forced actions. Used to quit the idle/wait loop. */
377#define VM_FF_EXTERNAL_SUSPENDED_MASK (VM_FF_CHECK_VM_STATE | VM_FF_DBGF | VM_FF_REQUEST | VM_FF_EMT_RENDEZVOUS)
378/** Externally VMCPU forced actions. Used to quit the idle/wait loop. */
379#define VMCPU_FF_EXTERNAL_SUSPENDED_MASK (VMCPU_FF_REQUEST)
380
381/** Externally forced VM actions. Used to quit the idle/wait loop. */
382#define VM_FF_EXTERNAL_HALTED_MASK ( VM_FF_CHECK_VM_STATE | VM_FF_DBGF | VM_FF_REQUEST \
383 | VM_FF_PDM_QUEUES | VM_FF_PDM_DMA | VM_FF_EMT_RENDEZVOUS)
384/** Externally forced VMCPU actions. Used to quit the idle/wait loop. */
385#define VMCPU_FF_EXTERNAL_HALTED_MASK (VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_REQUEST | VMCPU_FF_TIMER)
386
387/** High priority VM pre-execution actions. */
388#define VM_FF_HIGH_PRIORITY_PRE_MASK ( VM_FF_CHECK_VM_STATE | VM_FF_DBGF | VM_FF_TM_VIRTUAL_SYNC \
389 | VM_FF_DEBUG_SUSPEND | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY | VM_FF_EMT_RENDEZVOUS)
390/** High priority VMCPU pre-execution actions. */
391#define VMCPU_FF_HIGH_PRIORITY_PRE_MASK ( VMCPU_FF_TIMER | VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_PGM_SYNC_CR3 \
392 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL | VMCPU_FF_SELM_SYNC_TSS | VMCPU_FF_TRPM_SYNC_IDT \
393 | VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_LDT | VMCPU_FF_INHIBIT_INTERRUPTS)
394
395/** High priority VM pre raw-mode execution mask. */
396#define VM_FF_HIGH_PRIORITY_PRE_RAW_MASK (VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY)
397/** High priority VMCPU pre raw-mode execution mask. */
398#define VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK ( VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL | VMCPU_FF_SELM_SYNC_TSS | VMCPU_FF_TRPM_SYNC_IDT \
399 | VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_LDT | VMCPU_FF_INHIBIT_INTERRUPTS)
400
401/** High priority post-execution actions. */
402#define VM_FF_HIGH_PRIORITY_POST_MASK (VM_FF_PGM_NO_MEMORY)
403/** High priority post-execution actions. */
404#define VMCPU_FF_HIGH_PRIORITY_POST_MASK (VMCPU_FF_PDM_CRITSECT|VMCPU_FF_CSAM_PENDING_ACTION)
405
406/** Normal priority VM post-execution actions. */
407#define VM_FF_NORMAL_PRIORITY_POST_MASK ( VM_FF_CHECK_VM_STATE | VM_FF_DBGF | VM_FF_RESET \
408 | VM_FF_PGM_NO_MEMORY | VM_FF_EMT_RENDEZVOUS)
409/** Normal priority VMCPU post-execution actions. */
410#define VMCPU_FF_NORMAL_PRIORITY_POST_MASK (VMCPU_FF_CSAM_SCAN_PAGE)
411
412/** Normal priority VM actions. */
413#define VM_FF_NORMAL_PRIORITY_MASK (VM_FF_REQUEST | VM_FF_PDM_QUEUES | VM_FF_PDM_DMA | VM_FF_REM_HANDLER_NOTIFY | VM_FF_EMT_RENDEZVOUS)
414/** Normal priority VMCPU actions. */
415#define VMCPU_FF_NORMAL_PRIORITY_MASK (VMCPU_FF_REQUEST)
416
417/** Flags to clear before resuming guest execution. */
418#define VMCPU_FF_RESUME_GUEST_MASK (VMCPU_FF_TO_R3)
419
420/** VM Flags that cause the HWACCM loops to go back to ring-3. */
421#define VM_FF_HWACCM_TO_R3_MASK (VM_FF_TM_VIRTUAL_SYNC | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY | VM_FF_PDM_QUEUES | VM_FF_EMT_RENDEZVOUS)
422/** VMCPU Flags that cause the HWACCM loops to go back to ring-3. */
423#define VMCPU_FF_HWACCM_TO_R3_MASK (VMCPU_FF_TO_R3 | VMCPU_FF_TIMER | VMCPU_FF_PDM_CRITSECT)
424
425/** All the forced VM flags. */
426#define VM_FF_ALL_MASK (~0U)
427/** All the forced VMCPU flags. */
428#define VMCPU_FF_ALL_MASK (~0U)
429
430/** All the forced VM flags except those related to raw-mode and hardware
431 * assisted execution. */
432#define VM_FF_ALL_REM_MASK (~(VM_FF_HIGH_PRIORITY_PRE_RAW_MASK) | VM_FF_PGM_NO_MEMORY)
433/** All the forced VMCPU flags except those related to raw-mode and hardware
434 * assisted execution. */
435#define VMCPU_FF_ALL_REM_MASK (~(VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK | VMCPU_FF_CSAM_PENDING_ACTION | VMCPU_FF_PDM_CRITSECT | VMCPU_FF_TLB_FLUSH | VMCPU_FF_TLB_SHOOTDOWN))
436
437/** @} */
438
439/** @def VM_FF_SET
440 * Sets a force action flag.
441 *
442 * @param pVM VM Handle.
443 * @param fFlag The flag to set.
444 */
445#if 1
446# define VM_FF_SET(pVM, fFlag) ASMAtomicOrU32(&(pVM)->fGlobalForcedActions, (fFlag))
447#else
448# define VM_FF_SET(pVM, fFlag) \
449 do { ASMAtomicOrU32(&(pVM)->fGlobalForcedActions, (fFlag)); \
450 RTLogPrintf("VM_FF_SET : %08x %s - %s(%d) %s\n", (pVM)->fGlobalForcedActions, #fFlag, __FILE__, __LINE__, __FUNCTION__); \
451 } while (0)
452#endif
453
454/** @def VMCPU_FF_SET
455 * Sets a force action flag for the given VCPU.
456 *
457 * @param pVCpu VMCPU Handle.
458 * @param fFlag The flag to set.
459 */
460#define VMCPU_FF_SET(pVCpu, fFlag) ASMAtomicOrU32(&(pVCpu)->fLocalForcedActions, (fFlag))
461
462/** @def VM_FF_CLEAR
463 * Clears a force action flag.
464 *
465 * @param pVM VM Handle.
466 * @param fFlag The flag to clear.
467 */
468#if 1
469# define VM_FF_CLEAR(pVM, fFlag) ASMAtomicAndU32(&(pVM)->fGlobalForcedActions, ~(fFlag))
470#else
471# define VM_FF_CLEAR(pVM, fFlag) \
472 do { ASMAtomicAndU32(&(pVM)->fGlobalForcedActions, ~(fFlag)); \
473 RTLogPrintf("VM_FF_CLEAR: %08x %s - %s(%d) %s\n", (pVM)->fGlobalForcedActions, #fFlag, __FILE__, __LINE__, __FUNCTION__); \
474 } while (0)
475#endif
476
477/** @def VMCPU_FF_CLEAR
478 * Clears a force action flag for the given VCPU.
479 *
480 * @param pVCpu VMCPU Handle.
481 * @param fFlag The flag to clear.
482 */
483#define VMCPU_FF_CLEAR(pVCpu, fFlag) ASMAtomicAndU32(&(pVCpu)->fLocalForcedActions, ~(fFlag))
484
485/** @def VM_FF_ISSET
486 * Checks if a force action flag is set.
487 *
488 * @param pVM VM Handle.
489 * @param fFlag The flag to check.
490 */
491#define VM_FF_ISSET(pVM, fFlag) (((pVM)->fGlobalForcedActions & (fFlag)) == (fFlag))
492
493/** @def VMCPU_FF_ISSET
494 * Checks if a force action flag is set for the given VCPU.
495 *
496 * @param pVCpu VMCPU Handle.
497 * @param fFlag The flag to check.
498 */
499#define VMCPU_FF_ISSET(pVCpu, fFlag) (((pVCpu)->fLocalForcedActions & (fFlag)) == (fFlag))
500
501/** @def VM_FF_ISPENDING
502 * Checks if one or more force action in the specified set is pending.
503 *
504 * @param pVM VM Handle.
505 * @param fFlags The flags to check for.
506 */
507#define VM_FF_ISPENDING(pVM, fFlags) ((pVM)->fGlobalForcedActions & (fFlags))
508
509/** @def VM_FF_TESTANDCLEAR
510 * Checks if one (!) force action in the specified set is pending and clears it atomically
511 *
512 * @returns true if the bit was set.
513 * @returns false if the bit was clear.
514 * @param pVM VM Handle.
515 * @param iBit Bit position to check and clear
516 */
517#define VM_FF_TESTANDCLEAR(pVM, iBit) (ASMAtomicBitTestAndClear(&(pVM)->fGlobalForcedActions, iBit##_BIT))
518
519/** @def VMCPU_FF_TESTANDCLEAR
520 * Checks if one (!) force action in the specified set is pending and clears it atomically
521 *
522 * @returns true if the bit was set.
523 * @returns false if the bit was clear.
524 * @param pVCpu VMCPU Handle.
525 * @param iBit Bit position to check and clear
526 */
527#define VMCPU_FF_TESTANDCLEAR(pVCpu, iBit) (ASMAtomicBitTestAndClear(&(pVCpu)->fLocalForcedActions, iBit##_BIT))
528
529/** @def VMCPU_FF_ISPENDING
530 * Checks if one or more force action in the specified set is pending for the given VCPU.
531 *
532 * @param pVCpu VMCPU Handle.
533 * @param fFlags The flags to check for.
534 */
535#define VMCPU_FF_ISPENDING(pVCpu, fFlags) ((pVCpu)->fLocalForcedActions & (fFlags))
536
537/** @def VM_FF_ISPENDING
538 * Checks if one or more force action in the specified set is pending while one
539 * or more other ones are not.
540 *
541 * @param pVM VM Handle.
542 * @param fFlags The flags to check for.
543 * @param fExcpt The flags that should not be set.
544 */
545#define VM_FF_IS_PENDING_EXCEPT(pVM, fFlags, fExcpt) ( ((pVM)->fGlobalForcedActions & (fFlags)) && !((pVM)->fGlobalForcedActions & (fExcpt)) )
546
547/** @def VMCPU_FF_IS_PENDING_EXCEPT
548 * Checks if one or more force action in the specified set is pending for the given
549 * VCPU while one or more other ones are not.
550 *
551 * @param pVCpu VMCPU Handle.
552 * @param fFlags The flags to check for.
553 * @param fExcpt The flags that should not be set.
554 */
555#define VMCPU_FF_IS_PENDING_EXCEPT(pVCpu, fFlags, fExcpt) ( ((pVCpu)->fLocalForcedActions & (fFlags)) && !((pVCpu)->fLocalForcedActions & (fExcpt)) )
556
557/** @def VM_IS_EMT
558 * Checks if the current thread is the emulation thread (EMT).
559 *
560 * @remark The ring-0 variation will need attention if we expand the ring-0
561 * code to let threads other than EMT mess around with the VM.
562 */
563#ifdef IN_RC
564# define VM_IS_EMT(pVM) true
565#else
566# define VM_IS_EMT(pVM) (VMMGetCpu(pVM) != NULL)
567#endif
568
569/** @def VMCPU_IS_EMT
570 * Checks if the current thread is the emulation thread (EMT) for the specified
571 * virtual CPU.
572 */
573#ifdef IN_RC
574# define VMCPU_IS_EMT(pVCpu) true
575#else
576# define VMCPU_IS_EMT(pVCpu) ((pVCpu) && ((pVCpu) == VMMGetCpu((pVCpu)->CTX_SUFF(pVM))))
577#endif
578
579/** @def VM_ASSERT_EMT
580 * Asserts that the current thread IS the emulation thread (EMT).
581 */
582#ifdef IN_RC
583# define VM_ASSERT_EMT(pVM) Assert(VM_IS_EMT(pVM))
584#elif defined(IN_RING0)
585# define VM_ASSERT_EMT(pVM) Assert(VM_IS_EMT(pVM))
586#else
587# define VM_ASSERT_EMT(pVM) \
588 AssertMsg(VM_IS_EMT(pVM), \
589 ("Not emulation thread! Thread=%RTnthrd ThreadEMT=%RTnthrd\n", RTThreadNativeSelf(), VMR3GetVMCPUNativeThread(pVM)))
590#endif
591
592/** @def VMCPU_ASSERT_EMT
593 * Asserts that the current thread IS the emulation thread (EMT) of the
594 * specified virtual CPU.
595 */
596#ifdef IN_RC
597# define VMCPU_ASSERT_EMT(pVCpu) Assert(VMCPU_IS_EMT(pVCpu))
598#elif defined(IN_RING0)
599# define VMCPU_ASSERT_EMT(pVCpu) Assert(VMCPU_IS_EMT(pVCpu))
600#else
601# define VMCPU_ASSERT_EMT(pVCpu) \
602 AssertMsg(VMCPU_IS_EMT(pVCpu), \
603 ("Not emulation thread! Thread=%RTnthrd ThreadEMT=%RTnthrd idCpu=%#x\n", \
604 RTThreadNativeSelf(), (pVCpu)->hNativeThread, (pVCpu)->idCpu))
605#endif
606
607/** @def VM_ASSERT_EMT_RETURN
608 * Asserts that the current thread IS the emulation thread (EMT) and returns if it isn't.
609 */
610#ifdef IN_RC
611# define VM_ASSERT_EMT_RETURN(pVM, rc) AssertReturn(VM_IS_EMT(pVM), (rc))
612#elif defined(IN_RING0)
613# define VM_ASSERT_EMT_RETURN(pVM, rc) AssertReturn(VM_IS_EMT(pVM), (rc))
614#else
615# define VM_ASSERT_EMT_RETURN(pVM, rc) \
616 AssertMsgReturn(VM_IS_EMT(pVM), \
617 ("Not emulation thread! Thread=%RTnthrd ThreadEMT=%RTnthrd\n", RTThreadNativeSelf(), VMR3GetVMCPUNativeThread(pVM)), \
618 (rc))
619#endif
620
621/** @def VMCPU_ASSERT_EMT_RETURN
622 * Asserts that the current thread IS the emulation thread (EMT) and returns if it isn't.
623 */
624#ifdef IN_RC
625# define VMCPU_ASSERT_EMT_RETURN(pVCpu, rc) AssertReturn(VMCPU_IS_EMT(pVCpu), (rc))
626#elif defined(IN_RING0)
627# define VMCPU_ASSERT_EMT_RETURN(pVCpu, rc) AssertReturn(VMCPU_IS_EMT(pVCpu), (rc))
628#else
629# define VMCPU_ASSERT_EMT_RETURN(pVCpu, rc) \
630 AssertMsg(VMCPU_IS_EMT(pVCpu), \
631 ("Not emulation thread! Thread=%RTnthrd ThreadEMT=%RTnthrd idCpu=%#x\n", \
632 RTThreadNativeSelf(), (pVCpu)->hNativeThread, (pVCpu)->idCpu), \
633 (rc))
634#endif
635
636/** @def VMCPU_ASSERT_EMT_OR_GURU
637 * Asserts that the current thread IS the emulation thread (EMT) of the
638 * specified virtual CPU.
639 */
640#if defined(IN_RC) || defined(IN_RING0)
641# define VMCPU_ASSERT_EMT_OR_GURU(pVCpu) Assert( VMCPU_IS_EMT(pVCpu) \
642 || pVCpu->CTX_SUFF(pVM)->enmVMState == VMSTATE_GURU_MEDITATION \
643 || pVCpu->CTX_SUFF(pVM)->enmVMState == VMSTATE_GURU_MEDITATION_LS )
644#else
645# define VMCPU_ASSERT_EMT_OR_GURU(pVCpu) \
646 AssertMsg( VMCPU_IS_EMT(pVCpu) \
647 || pVCpu->CTX_SUFF(pVM)->enmVMState == VMSTATE_GURU_MEDITATION \
648 || pVCpu->CTX_SUFF(pVM)->enmVMState == VMSTATE_GURU_MEDITATION_LS, \
649 ("Not emulation thread! Thread=%RTnthrd ThreadEMT=%RTnthrd idCpu=%#x\n", \
650 RTThreadNativeSelf(), (pVCpu)->hNativeThread, (pVCpu)->idCpu))
651#endif
652
653/** @def VMCPU_ASSERT_EMT_OR_NOT_RUNNING
654 * Asserts that the current thread IS the emulation thread (EMT) of the
655 * specified virtual CPU when the VM is running.
656 */
657#if defined(IN_RC) || defined(IN_RING0)
658# define VMCPU_ASSERT_EMT_OR_NOT_RUNNING(pVCpu) \
659 Assert( VMCPU_IS_EMT(pVCpu) \
660 || pVCpu->CTX_SUFF(pVM)->enmVMState == VMSTATE_RUNNING \
661 || pVCpu->CTX_SUFF(pVM)->enmVMState == VMSTATE_RUNNING_LS \
662 || pVCpu->CTX_SUFF(pVM)->enmVMState == VMSTATE_RUNNING_FT )
663#else
664# define VMCPU_ASSERT_EMT_OR_NOT_RUNNING(pVCpu) \
665 AssertMsg( VMCPU_IS_EMT(pVCpu) \
666 || pVCpu->CTX_SUFF(pVM)->enmVMState == VMSTATE_RUNNING \
667 || pVCpu->CTX_SUFF(pVM)->enmVMState == VMSTATE_RUNNING_LS \
668 || pVCpu->CTX_SUFF(pVM)->enmVMState == VMSTATE_RUNNING_FT, \
669 ("Not emulation thread! Thread=%RTnthrd ThreadEMT=%RTnthrd idCpu=%#x\n", \
670 RTThreadNativeSelf(), (pVCpu)->hNativeThread, (pVCpu)->idCpu))
671#endif
672
673/** @def VM_ASSERT_EMT0
674 * Asserts that the current thread IS emulation thread \#0 (EMT0).
675 */
676#define VM_ASSERT_EMT0(pVM) VMCPU_ASSERT_EMT(&(pVM)->aCpus[0])
677
678/** @def VM_ASSERT_EMT0_RETURN
679 * Asserts that the current thread IS emulation thread \#0 (EMT0) and returns if
680 * it isn't.
681 */
682#define VM_ASSERT_EMT0_RETURN(pVM, rc) VMCPU_ASSERT_EMT_RETURN(&(pVM)->aCpus[0], (rc))
683
684
685/**
686 * Asserts that the current thread is NOT the emulation thread.
687 */
688#define VM_ASSERT_OTHER_THREAD(pVM) \
689 AssertMsg(!VM_IS_EMT(pVM), ("Not other thread!!\n"))
690
691
692/** @def VM_ASSERT_STATE_RETURN
693 * Asserts a certain VM state.
694 */
695#define VM_ASSERT_STATE(pVM, _enmState) \
696 AssertMsg((pVM)->enmVMState == (_enmState), \
697 ("state %s, expected %s\n", VMGetStateName((pVM)->enmVMState), VMGetStateName(_enmState)))
698
699/** @def VM_ASSERT_STATE_RETURN
700 * Asserts a certain VM state and returns if it doesn't match.
701 */
702#define VM_ASSERT_STATE_RETURN(pVM, _enmState, rc) \
703 AssertMsgReturn((pVM)->enmVMState == (_enmState), \
704 ("state %s, expected %s\n", VMGetStateName((pVM)->enmVMState), VMGetStateName(_enmState)), \
705 (rc))
706
707/** @def VM_ASSERT_VALID_EXT_RETURN
708 * Asserts a the VM handle is valid for external access, i.e. not being
709 * destroy or terminated.
710 */
711#define VM_ASSERT_VALID_EXT_RETURN(pVM, rc) \
712 AssertMsgReturn( RT_VALID_ALIGNED_PTR(pVM, PAGE_SIZE) \
713 && ( (unsigned)(pVM)->enmVMState < (unsigned)VMSTATE_DESTROYING \
714 || ( (unsigned)(pVM)->enmVMState == (unsigned)VMSTATE_DESTROYING \
715 && VM_IS_EMT(pVM))), \
716 ("pVM=%p state %s\n", (pVM), RT_VALID_ALIGNED_PTR(pVM, PAGE_SIZE) \
717 ? VMGetStateName(pVM->enmVMState) : ""), \
718 (rc))
719
720/** @def VMCPU_ASSERT_VALID_EXT_RETURN
721 * Asserts a the VMCPU handle is valid for external access, i.e. not being
722 * destroy or terminated.
723 */
724#define VMCPU_ASSERT_VALID_EXT_RETURN(pVCpu, rc) \
725 AssertMsgReturn( RT_VALID_ALIGNED_PTR(pVCpu, 64) \
726 && RT_VALID_ALIGNED_PTR((pVCpu)->CTX_SUFF(pVM), PAGE_SIZE) \
727 && (unsigned)(pVCpu)->CTX_SUFF(pVM)->enmVMState < (unsigned)VMSTATE_DESTROYING, \
728 ("pVCpu=%p pVM=%p state %s\n", (pVCpu), RT_VALID_ALIGNED_PTR(pVCpu, 64) ? (pVCpu)->CTX_SUFF(pVM) : NULL, \
729 RT_VALID_ALIGNED_PTR(pVCpu, 64) && RT_VALID_ALIGNED_PTR((pVCpu)->CTX_SUFF(pVM), PAGE_SIZE) \
730 ? VMGetStateName((pVCpu)->pVMR3->enmVMState) : ""), \
731 (rc))
732
733#endif /* !VBOX_FOR_DTRACE_LIB */
734
735
736
737/** This is the VM structure.
738 *
739 * It contains (nearly?) all the VM data which have to be available in all
740 * contexts. Even if it contains all the data the idea is to use APIs not
741 * to modify all the members all around the place. Therefore we make use of
742 * unions to hide everything which isn't local to the current source module.
743 * This means we'll have to pay a little bit of attention when adding new
744 * members to structures in the unions and make sure to keep the padding sizes
745 * up to date.
746 *
747 * Run tstVMStructSize after update!
748 */
749typedef struct VM
750{
751 /** The state of the VM.
752 * This field is read only to everyone except the VM and EM. */
753 VMSTATE volatile enmVMState;
754 /** Forced action flags.
755 * See the VM_FF_* \#defines. Updated atomically.
756 */
757 volatile uint32_t fGlobalForcedActions;
758 /** Pointer to the array of page descriptors for the VM structure allocation. */
759 R3PTRTYPE(PSUPPAGE) paVMPagesR3;
760 /** Session handle. For use when calling SUPR0 APIs. */
761 PSUPDRVSESSION pSession;
762 /** Pointer to the ring-3 VM structure. */
763 PUVM pUVM;
764 /** Ring-3 Host Context VM Pointer. */
765 R3PTRTYPE(struct VM *) pVMR3;
766 /** Ring-0 Host Context VM Pointer. */
767 R0PTRTYPE(struct VM *) pVMR0;
768 /** Raw-mode Context VM Pointer. */
769 RCPTRTYPE(struct VM *) pVMRC;
770
771 /** The GVM VM handle. Only the GVM should modify this field. */
772 uint32_t hSelf;
773 /** Number of virtual CPUs. */
774 uint32_t cCpus;
775 /** CPU excution cap (1-100) */
776 uint32_t uCpuExecutionCap;
777
778 /** Size of the VM structure including the VMCPU array. */
779 uint32_t cbSelf;
780
781 /** Offset to the VMCPU array starting from beginning of this structure. */
782 uint32_t offVMCPU;
783
784 /** Reserved; alignment. */
785 uint32_t u32Reserved[5];
786
787 /** @name Public VMM Switcher APIs
788 * @{ */
789 /**
790 * Assembly switch entry point for returning to host context.
791 * This function will clean up the stack frame.
792 *
793 * @param eax The return code, register.
794 * @param Ctx The guest core context.
795 * @remark Assume interrupts disabled.
796 */
797 RTRCPTR pfnVMMGCGuestToHostAsmGuestCtx/*(int32_t eax, CPUMCTXCORE Ctx)*/;
798
799 /**
800 * Assembly switch entry point for returning to host context.
801 *
802 * This is an alternative entry point which we'll be using when the we have the
803 * hypervisor context and need to save that before going to the host.
804 *
805 * This is typically useful when abandoning the hypervisor because of a trap
806 * and want the trap state to be saved.
807 *
808 * @param eax The return code, register.
809 * @param ecx Pointer to the hypervisor core context, register.
810 * @remark Assume interrupts disabled.
811 */
812 RTRCPTR pfnVMMGCGuestToHostAsmHyperCtx/*(int32_t eax, PCPUMCTXCORE ecx)*/;
813
814 /**
815 * Assembly switch entry point for returning to host context.
816 *
817 * This is an alternative to the two *Ctx APIs and implies that the context has already
818 * been saved, or that it's just a brief return to HC and that the caller intends to resume
819 * whatever it is doing upon 'return' from this call.
820 *
821 * @param eax The return code, register.
822 * @remark Assume interrupts disabled.
823 */
824 RTRCPTR pfnVMMGCGuestToHostAsm/*(int32_t eax)*/;
825 /** @} */
826
827
828 /** @name Various VM data owned by VM.
829 * @{ */
830 RTTHREAD uPadding1;
831 /** The native handle of ThreadEMT. Getting the native handle
832 * is generally faster than getting the IPRT one (except on OS/2 :-). */
833 RTNATIVETHREAD uPadding2;
834 /** @} */
835
836
837 /** @name Various items that are frequently accessed.
838 * @{ */
839 /** Whether to recompile user mode code or run it raw/hm. */
840 bool fRecompileUser;
841 /** Whether to recompile supervisor mode code or run it raw/hm. */
842 bool fRecompileSupervisor;
843 /** PATM enabled flag.
844 * This is placed here for performance reasons. */
845 bool fPATMEnabled;
846 /** CSAM enabled flag.
847 * This is placed here for performance reasons. */
848 bool fCSAMEnabled;
849 /** Hardware VM support is available and enabled.
850 * This is placed here for performance reasons. */
851 bool fHWACCMEnabled;
852 /** Hardware VM support is required and non-optional.
853 * This is initialized together with the rest of the VM structure. */
854 bool fHwVirtExtForced;
855 /** Set when this VM is the master FT node. */
856 bool fFaultTolerantMaster;
857 /** Large page enabled flag. */
858 bool fUseLargePages;
859 /** @} */
860
861 /** @name Debugging
862 * @{ */
863 /** Raw-mode Context VM Pointer. */
864 RCPTRTYPE(RTTRACEBUF) hTraceBufRC;
865 /** Alignment padding */
866 uint32_t uPadding3;
867 /** Ring-3 Host Context VM Pointer. */
868 R3PTRTYPE(RTTRACEBUF) hTraceBufR3;
869 /** Ring-0 Host Context VM Pointer. */
870 R0PTRTYPE(RTTRACEBUF) hTraceBufR0;
871 /** @} */
872
873#if HC_ARCH_BITS == 32
874 /** Alignment padding.. */
875 uint32_t uPadding4;
876#endif
877
878 /** @name Switcher statistics (remove)
879 * @{ */
880 /** Profiling the total time from Qemu to GC. */
881 STAMPROFILEADV StatTotalQemuToGC;
882 /** Profiling the total time from GC to Qemu. */
883 STAMPROFILEADV StatTotalGCToQemu;
884 /** Profiling the total time spent in GC. */
885 STAMPROFILEADV StatTotalInGC;
886 /** Profiling the total time spent not in Qemu. */
887 STAMPROFILEADV StatTotalInQemu;
888 /** Profiling the VMMSwitcher code for going to GC. */
889 STAMPROFILEADV StatSwitcherToGC;
890 /** Profiling the VMMSwitcher code for going to HC. */
891 STAMPROFILEADV StatSwitcherToHC;
892 STAMPROFILEADV StatSwitcherSaveRegs;
893 STAMPROFILEADV StatSwitcherSysEnter;
894 STAMPROFILEADV StatSwitcherDebug;
895 STAMPROFILEADV StatSwitcherCR0;
896 STAMPROFILEADV StatSwitcherCR4;
897 STAMPROFILEADV StatSwitcherJmpCR3;
898 STAMPROFILEADV StatSwitcherRstrRegs;
899 STAMPROFILEADV StatSwitcherLgdt;
900 STAMPROFILEADV StatSwitcherLidt;
901 STAMPROFILEADV StatSwitcherLldt;
902 STAMPROFILEADV StatSwitcherTSS;
903 /** @} */
904
905#if HC_ARCH_BITS != 64
906 /** Padding - the unions must be aligned on a 64 bytes boundary and the unions
907 * must start at the same offset on both 64-bit and 32-bit hosts. */
908 uint8_t abAlignment1[HC_ARCH_BITS == 32 ? 32 : 0];
909#endif
910
911 /** CPUM part. */
912 union
913 {
914#ifdef ___CPUMInternal_h
915 struct CPUM s;
916#endif
917 uint8_t padding[1536]; /* multiple of 64 */
918 } cpum;
919
920 /** VMM part. */
921 union
922 {
923#ifdef ___VMMInternal_h
924 struct VMM s;
925#endif
926 uint8_t padding[1600]; /* multiple of 64 */
927 } vmm;
928
929 /** PGM part. */
930 union
931 {
932#ifdef ___PGMInternal_h
933 struct PGM s;
934#endif
935 uint8_t padding[4096*2+6080]; /* multiple of 64 */
936 } pgm;
937
938 /** HWACCM part. */
939 union
940 {
941#ifdef ___HWACCMInternal_h
942 struct HWACCM s;
943#endif
944 uint8_t padding[5376]; /* multiple of 64 */
945 } hwaccm;
946
947 /** TRPM part. */
948 union
949 {
950#ifdef ___TRPMInternal_h
951 struct TRPM s;
952#endif
953 uint8_t padding[5248]; /* multiple of 64 */
954 } trpm;
955
956 /** SELM part. */
957 union
958 {
959#ifdef ___SELMInternal_h
960 struct SELM s;
961#endif
962 uint8_t padding[576]; /* multiple of 64 */
963 } selm;
964
965 /** MM part. */
966 union
967 {
968#ifdef ___MMInternal_h
969 struct MM s;
970#endif
971 uint8_t padding[192]; /* multiple of 64 */
972 } mm;
973
974 /** PDM part. */
975 union
976 {
977#ifdef ___PDMInternal_h
978 struct PDM s;
979#endif
980 uint8_t padding[1920]; /* multiple of 64 */
981 } pdm;
982
983 /** IOM part. */
984 union
985 {
986#ifdef ___IOMInternal_h
987 struct IOM s;
988#endif
989 uint8_t padding[832]; /* multiple of 64 */
990 } iom;
991
992 /** PATM part. */
993 union
994 {
995#ifdef ___PATMInternal_h
996 struct PATM s;
997#endif
998 uint8_t padding[768]; /* multiple of 64 */
999 } patm;
1000
1001 /** CSAM part. */
1002 union
1003 {
1004#ifdef ___CSAMInternal_h
1005 struct CSAM s;
1006#endif
1007 uint8_t padding[1088]; /* multiple of 64 */
1008 } csam;
1009
1010 /** EM part. */
1011 union
1012 {
1013#ifdef ___EMInternal_h
1014 struct EM s;
1015#endif
1016 uint8_t padding[256]; /* multiple of 64 */
1017 } em;
1018
1019 /** TM part. */
1020 union
1021 {
1022#ifdef ___TMInternal_h
1023 struct TM s;
1024#endif
1025 uint8_t padding[2432]; /* multiple of 64 */
1026 } tm;
1027
1028 /** DBGF part. */
1029 union
1030 {
1031#ifdef ___DBGFInternal_h
1032 struct DBGF s;
1033#endif
1034 uint8_t padding[2368]; /* multiple of 64 */
1035 } dbgf;
1036
1037 /** SSM part. */
1038 union
1039 {
1040#ifdef ___SSMInternal_h
1041 struct SSM s;
1042#endif
1043 uint8_t padding[128]; /* multiple of 64 */
1044 } ssm;
1045
1046 /** FTM part. */
1047 union
1048 {
1049#ifdef ___FTMInternal_h
1050 struct FTM s;
1051#endif
1052 uint8_t padding[512]; /* multiple of 64 */
1053 } ftm;
1054
1055 /** REM part. */
1056 union
1057 {
1058#ifdef ___REMInternal_h
1059 struct REM s;
1060#endif
1061 uint8_t padding[0x11100]; /* multiple of 64 */
1062 } rem;
1063
1064 /* ---- begin small stuff ---- */
1065
1066 /** VM part. */
1067 union
1068 {
1069#ifdef ___VMInternal_h
1070 struct VMINT s;
1071#endif
1072 uint8_t padding[24]; /* multiple of 8 */
1073 } vm;
1074
1075 /** CFGM part. */
1076 union
1077 {
1078#ifdef ___CFGMInternal_h
1079 struct CFGM s;
1080#endif
1081 uint8_t padding[8]; /* multiple of 8 */
1082 } cfgm;
1083
1084
1085 /** Padding for aligning the cpu array on a page boundary. */
1086 uint8_t abAlignment2[734];
1087
1088 /* ---- end small stuff ---- */
1089
1090 /** VMCPU array for the configured number of virtual CPUs.
1091 * Must be aligned on a page boundary for TLB hit reasons as well as
1092 * alignment of VMCPU members. */
1093 VMCPU aCpus[1];
1094} VM;
1095
1096
1097#ifdef IN_RC
1098RT_C_DECLS_BEGIN
1099
1100/** The VM structure.
1101 * This is imported from the VMMGCBuiltin module, i.e. it's a one
1102 * of those magic globals which we should avoid using.
1103 */
1104extern DECLIMPORT(VM) g_VM;
1105
1106RT_C_DECLS_END
1107#endif
1108
1109/** @} */
1110
1111#endif
1112
Note: See TracBrowser for help on using the repository browser.

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