1 | /* $Id: VMMInternal.h 17546 2009-03-09 02:29:49Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VMM - Internal header file.
|
---|
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 | #ifndef ___VMMInternal_h
|
---|
23 | #define ___VMMInternal_h
|
---|
24 |
|
---|
25 | #include <VBox/cdefs.h>
|
---|
26 | #include <VBox/stam.h>
|
---|
27 | #include <VBox/log.h>
|
---|
28 | #include <iprt/critsect.h>
|
---|
29 |
|
---|
30 |
|
---|
31 | #if !defined(IN_VMM_R3) && !defined(IN_VMM_R0) && !defined(IN_VMM_RC)
|
---|
32 | # error "Not in VMM! This is an internal header!"
|
---|
33 | #endif
|
---|
34 |
|
---|
35 |
|
---|
36 | /** @defgroup grp_vmm_int Internals
|
---|
37 | * @ingroup grp_vmm
|
---|
38 | * @internal
|
---|
39 | * @{
|
---|
40 | */
|
---|
41 |
|
---|
42 | /** @def VBOX_WITH_RC_RELEASE_LOGGING
|
---|
43 | * Enables RC release logging. */
|
---|
44 | #define VBOX_WITH_RC_RELEASE_LOGGING
|
---|
45 |
|
---|
46 | /** @def VBOX_WITH_R0_LOGGING
|
---|
47 | * Enables Ring-0 logging (non-release).
|
---|
48 | *
|
---|
49 | * Ring-0 logging isn't 100% safe yet (thread id reuse / process exit cleanup),
|
---|
50 | * so you have to sign up here by adding your defined(DEBUG_<userid>) to the
|
---|
51 | * #if, or by adding VBOX_WITH_R0_LOGGING to your LocalConfig.kmk.
|
---|
52 | *
|
---|
53 | * You might also wish to enable the AssertMsg1/2 overrides in VMMR0.cpp when
|
---|
54 | * enabling this.
|
---|
55 | */
|
---|
56 | #if defined(DEBUG_sandervl) || defined(DEBUG_frank) || defined(DOXYGEN_RUNNING)
|
---|
57 | # define VBOX_WITH_R0_LOGGING
|
---|
58 | #endif
|
---|
59 |
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Converts a VMM pointer into a VM pointer.
|
---|
63 | * @returns Pointer to the VM structure the VMM is part of.
|
---|
64 | * @param pVMM Pointer to VMM instance data.
|
---|
65 | */
|
---|
66 | #define VMM2VM(pVMM) ( (PVM)((char*)pVMM - pVMM->offVM) )
|
---|
67 |
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * Switcher function, HC to RC.
|
---|
71 | *
|
---|
72 | * @param pVM The VM handle.
|
---|
73 | * @returns Return code indicating the action to take.
|
---|
74 | */
|
---|
75 | typedef DECLASMTYPE(int) FNVMMSWITCHERHC(PVM pVM);
|
---|
76 | /** Pointer to switcher function. */
|
---|
77 | typedef FNVMMSWITCHERHC *PFNVMMSWITCHERHC;
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * Switcher function, RC to HC.
|
---|
81 | *
|
---|
82 | * @param rc VBox status code.
|
---|
83 | */
|
---|
84 | typedef DECLASMTYPE(void) FNVMMSWITCHERRC(int rc);
|
---|
85 | /** Pointer to switcher function. */
|
---|
86 | typedef FNVMMSWITCHERRC *PFNVMMSWITCHERRC;
|
---|
87 |
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * The ring-0 logger instance wrapper.
|
---|
91 | *
|
---|
92 | * We need to be able to find the VM handle from the logger instance, so we wrap
|
---|
93 | * it in this structure.
|
---|
94 | */
|
---|
95 | typedef struct VMMR0LOGGER
|
---|
96 | {
|
---|
97 | /** Pointer to the VM handle. */
|
---|
98 | R0PTRTYPE(PVM) pVM;
|
---|
99 | /** Size of the allocated logger instance (Logger). */
|
---|
100 | uint32_t cbLogger;
|
---|
101 | /** Flag indicating whether we've create the logger Ring-0 instance yet. */
|
---|
102 | bool fCreated;
|
---|
103 | /** Flag indicating whether we've disabled flushing (world switch) or not. */
|
---|
104 | bool fFlushingDisabled;
|
---|
105 | #if HC_ARCH_BITS == 32
|
---|
106 | uint32_t u32Alignment;
|
---|
107 | #endif
|
---|
108 | /** The ring-0 logger instance. This extends beyond the size. */
|
---|
109 | RTLOGGER Logger;
|
---|
110 | } VMMR0LOGGER;
|
---|
111 | /** Pointer to a ring-0 logger instance wrapper. */
|
---|
112 | typedef VMMR0LOGGER *PVMMR0LOGGER;
|
---|
113 |
|
---|
114 |
|
---|
115 | /**
|
---|
116 | * Jump buffer for the setjmp/longjmp like constructs used to
|
---|
117 | * quickly 'call' back into Ring-3.
|
---|
118 | */
|
---|
119 | typedef struct VMMR0JMPBUF
|
---|
120 | {
|
---|
121 | /** Traditional jmp_buf stuff
|
---|
122 | * @{ */
|
---|
123 | #if HC_ARCH_BITS == 32
|
---|
124 | uint32_t ebx;
|
---|
125 | uint32_t esi;
|
---|
126 | uint32_t edi;
|
---|
127 | uint32_t ebp;
|
---|
128 | uint32_t esp;
|
---|
129 | uint32_t eip;
|
---|
130 | uint32_t u32Padding;
|
---|
131 | #endif
|
---|
132 | #if HC_ARCH_BITS == 64
|
---|
133 | uint64_t rbx;
|
---|
134 | # ifdef RT_OS_WINDOWS
|
---|
135 | uint64_t rsi;
|
---|
136 | uint64_t rdi;
|
---|
137 | # endif
|
---|
138 | uint64_t rbp;
|
---|
139 | uint64_t r12;
|
---|
140 | uint64_t r13;
|
---|
141 | uint64_t r14;
|
---|
142 | uint64_t r15;
|
---|
143 | uint64_t rsp;
|
---|
144 | uint64_t rip;
|
---|
145 | #endif
|
---|
146 | /** @} */
|
---|
147 |
|
---|
148 | /** Flag that indicates that we've done a ring-3 call. */
|
---|
149 | bool fInRing3Call;
|
---|
150 | /** The number of bytes we've saved. */
|
---|
151 | uint32_t cbSavedStack;
|
---|
152 | /** Pointer to the buffer used to save the stack.
|
---|
153 | * This is assumed to be 8KB. */
|
---|
154 | RTR0PTR pvSavedStack;
|
---|
155 | /** Esp we we match against esp on resume to make sure the stack wasn't relocated. */
|
---|
156 | RTHCUINTREG SpCheck;
|
---|
157 | /** The esp we should resume execution with after the restore. */
|
---|
158 | RTHCUINTREG SpResume;
|
---|
159 | } VMMR0JMPBUF;
|
---|
160 | /** Pointer to a ring-0 jump buffer. */
|
---|
161 | typedef VMMR0JMPBUF *PVMMR0JMPBUF;
|
---|
162 |
|
---|
163 |
|
---|
164 | /**
|
---|
165 | * VMM Data (part of VM)
|
---|
166 | */
|
---|
167 | typedef struct VMM
|
---|
168 | {
|
---|
169 | /** Offset to the VM structure.
|
---|
170 | * See VMM2VM(). */
|
---|
171 | RTINT offVM;
|
---|
172 |
|
---|
173 | /** @name World Switcher and Related
|
---|
174 | * @{
|
---|
175 | */
|
---|
176 | /** Size of the core code. */
|
---|
177 | RTUINT cbCoreCode;
|
---|
178 | /** Physical address of core code. */
|
---|
179 | RTHCPHYS HCPhysCoreCode;
|
---|
180 | /** Pointer to core code ring-3 mapping - contiguous memory.
|
---|
181 | * At present this only means the context switcher code. */
|
---|
182 | RTR3PTR pvCoreCodeR3;
|
---|
183 | /** Pointer to core code ring-0 mapping - contiguous memory.
|
---|
184 | * At present this only means the context switcher code. */
|
---|
185 | RTR0PTR pvCoreCodeR0;
|
---|
186 | /** Pointer to core code guest context mapping. */
|
---|
187 | RTRCPTR pvCoreCodeRC;
|
---|
188 | RTRCPTR pRCPadding0; /**< Alignment padding */
|
---|
189 | #ifdef VBOX_WITH_NMI
|
---|
190 | /** The guest context address of the APIC (host) mapping. */
|
---|
191 | RTRCPTR GCPtrApicBase;
|
---|
192 | RTRCPTR pRCPadding1; /**< Alignment padding */
|
---|
193 | #endif
|
---|
194 | /** The current switcher.
|
---|
195 | * This will be set before the VMM is fully initialized. */
|
---|
196 | VMMSWITCHER enmSwitcher;
|
---|
197 | /** Flag to disable the switcher permanently (VMX) (boolean) */
|
---|
198 | bool fSwitcherDisabled;
|
---|
199 | /** Array of offsets to the different switchers within the core code. */
|
---|
200 | RTUINT aoffSwitchers[VMMSWITCHER_MAX];
|
---|
201 | uint32_t u32Padding0; /**< Alignment padding. */
|
---|
202 |
|
---|
203 | /** The last RC/R0 return code. */
|
---|
204 | RTINT iLastGZRc;
|
---|
205 | /** Resume Guest Execution. See CPUMGCResumeGuest(). */
|
---|
206 | RTRCPTR pfnCPUMRCResumeGuest;
|
---|
207 | /** Resume Guest Execution in V86 mode. See CPUMGCResumeGuestV86(). */
|
---|
208 | RTRCPTR pfnCPUMRCResumeGuestV86;
|
---|
209 | /** Call Trampoline. See vmmGCCallTrampoline(). */
|
---|
210 | RTRCPTR pfnCallTrampolineRC;
|
---|
211 | /** Guest to host switcher entry point. */
|
---|
212 | RCPTRTYPE(PFNVMMSWITCHERRC) pfnGuestToHostRC;
|
---|
213 | /** Host to guest switcher entry point. */
|
---|
214 | R0PTRTYPE(PFNVMMSWITCHERHC) pfnHostToGuestR0;
|
---|
215 | /** @} */
|
---|
216 |
|
---|
217 | /** VMM stack, pointer to the top of the stack in R3.
|
---|
218 | * Stack is allocated from the hypervisor heap and is page aligned
|
---|
219 | * and always writable in RC. */
|
---|
220 | R3PTRTYPE(uint8_t *) pbEMTStackR3;
|
---|
221 | /** Pointer to the bottom of the stack - needed for doing relocations. */
|
---|
222 | RCPTRTYPE(uint8_t *) pbEMTStackRC;
|
---|
223 | /** Pointer to the bottom of the stack - needed for doing relocations. */
|
---|
224 | RCPTRTYPE(uint8_t *) pbEMTStackBottomRC;
|
---|
225 |
|
---|
226 | /** @name Logging
|
---|
227 | * @{
|
---|
228 | */
|
---|
229 | /** Size of the allocated logger instance (pRCLoggerRC/pRCLoggerR3). */
|
---|
230 | uint32_t cbRCLogger;
|
---|
231 | /** Pointer to the RC logger instance - RC Ptr.
|
---|
232 | * This is NULL if logging is disabled. */
|
---|
233 | RCPTRTYPE(PRTLOGGERRC) pRCLoggerRC;
|
---|
234 | /** Pointer to the GC logger instance - R3 Ptr.
|
---|
235 | * This is NULL if logging is disabled. */
|
---|
236 | R3PTRTYPE(PRTLOGGERRC) pRCLoggerR3;
|
---|
237 | /** Pointer to the R0 logger instance - R3 Ptr.
|
---|
238 | * This is NULL if logging is disabled. */
|
---|
239 | R3PTRTYPE(PVMMR0LOGGER) pR0LoggerR3;
|
---|
240 | /** Pointer to the R0 logger instance - R0 Ptr.
|
---|
241 | * This is NULL if logging is disabled. */
|
---|
242 | R0PTRTYPE(PVMMR0LOGGER) pR0LoggerR0;
|
---|
243 | /** Pointer to the GC release logger instance - R3 Ptr. */
|
---|
244 | R3PTRTYPE(PRTLOGGERRC) pRCRelLoggerR3;
|
---|
245 | /** Pointer to the GC release logger instance - RC Ptr. */
|
---|
246 | RCPTRTYPE(PRTLOGGERRC) pRCRelLoggerRC;
|
---|
247 | /** Size of the allocated release logger instance (pRCRelLoggerRC/pRCRelLoggerR3).
|
---|
248 | * This may differ from cbRCLogger. */
|
---|
249 | uint32_t cbRCRelLogger;
|
---|
250 | /** @} */
|
---|
251 |
|
---|
252 |
|
---|
253 | /** Global VM critical section. */
|
---|
254 | RTCRITSECT CritSectVMLock;
|
---|
255 |
|
---|
256 | /** The EMT yield timer. */
|
---|
257 | PTMTIMERR3 pYieldTimer;
|
---|
258 | /** The period to the next timeout when suspended or stopped.
|
---|
259 | * This is 0 when running. */
|
---|
260 | uint32_t cYieldResumeMillies;
|
---|
261 | /** The EMT yield timer interval (milliseconds). */
|
---|
262 | uint32_t cYieldEveryMillies;
|
---|
263 | #if HC_ARCH_BITS == 32
|
---|
264 | RTR3PTR pR3Padding1; /**< Alignment padding. */
|
---|
265 | #endif
|
---|
266 | /** The timestamp of the previous yield. (nano) */
|
---|
267 | uint64_t u64LastYield;
|
---|
268 |
|
---|
269 | /** @name CallHost
|
---|
270 | * @todo SMP: per vCPU
|
---|
271 | * @{ */
|
---|
272 | /** The pending operation. */
|
---|
273 | VMMCALLHOST enmCallHostOperation;
|
---|
274 | /** The result of the last operation. */
|
---|
275 | int32_t rcCallHost;
|
---|
276 | /** The argument to the operation. */
|
---|
277 | uint64_t u64CallHostArg;
|
---|
278 | /** The Ring-0 jmp buffer. */
|
---|
279 | VMMR0JMPBUF CallHostR0JmpBuf;
|
---|
280 | /** @} */
|
---|
281 |
|
---|
282 | /** Buffer for storing the standard assertion message for a ring-0 assertion.
|
---|
283 | * Used for saving the assertion message text for the release log and guru
|
---|
284 | * meditation dump. */
|
---|
285 | char szRing0AssertMsg1[512];
|
---|
286 | /** Buffer for storing the custom message for a ring-0 assertion. */
|
---|
287 | char szRing0AssertMsg2[256];
|
---|
288 |
|
---|
289 | /** Number of VMMR0_DO_RUN_GC calls. */
|
---|
290 | STAMCOUNTER StatRunRC;
|
---|
291 |
|
---|
292 | /** Statistics for each of the RC/R0 return codes.
|
---|
293 | * @{ */
|
---|
294 | STAMCOUNTER StatRZRetNormal;
|
---|
295 | STAMCOUNTER StatRZRetInterrupt;
|
---|
296 | STAMCOUNTER StatRZRetInterruptHyper;
|
---|
297 | STAMCOUNTER StatRZRetGuestTrap;
|
---|
298 | STAMCOUNTER StatRZRetRingSwitch;
|
---|
299 | STAMCOUNTER StatRZRetRingSwitchInt;
|
---|
300 | STAMCOUNTER StatRZRetExceptionPrivilege;
|
---|
301 | STAMCOUNTER StatRZRetStaleSelector;
|
---|
302 | STAMCOUNTER StatRZRetIRETTrap;
|
---|
303 | STAMCOUNTER StatRZRetEmulate;
|
---|
304 | STAMCOUNTER StatRZRetIOBlockEmulate;
|
---|
305 | STAMCOUNTER StatRZRetPatchEmulate;
|
---|
306 | STAMCOUNTER StatRZRetIORead;
|
---|
307 | STAMCOUNTER StatRZRetIOWrite;
|
---|
308 | STAMCOUNTER StatRZRetMMIORead;
|
---|
309 | STAMCOUNTER StatRZRetMMIOWrite;
|
---|
310 | STAMCOUNTER StatRZRetMMIOPatchRead;
|
---|
311 | STAMCOUNTER StatRZRetMMIOPatchWrite;
|
---|
312 | STAMCOUNTER StatRZRetMMIOReadWrite;
|
---|
313 | STAMCOUNTER StatRZRetLDTFault;
|
---|
314 | STAMCOUNTER StatRZRetGDTFault;
|
---|
315 | STAMCOUNTER StatRZRetIDTFault;
|
---|
316 | STAMCOUNTER StatRZRetTSSFault;
|
---|
317 | STAMCOUNTER StatRZRetPDFault;
|
---|
318 | STAMCOUNTER StatRZRetCSAMTask;
|
---|
319 | STAMCOUNTER StatRZRetSyncCR3;
|
---|
320 | STAMCOUNTER StatRZRetMisc;
|
---|
321 | STAMCOUNTER StatRZRetPatchInt3;
|
---|
322 | STAMCOUNTER StatRZRetPatchPF;
|
---|
323 | STAMCOUNTER StatRZRetPatchGP;
|
---|
324 | STAMCOUNTER StatRZRetPatchIretIRQ;
|
---|
325 | STAMCOUNTER StatRZRetPageOverflow;
|
---|
326 | STAMCOUNTER StatRZRetRescheduleREM;
|
---|
327 | STAMCOUNTER StatRZRetToR3;
|
---|
328 | STAMCOUNTER StatRZRetTimerPending;
|
---|
329 | STAMCOUNTER StatRZRetInterruptPending;
|
---|
330 | STAMCOUNTER StatRZRetCallHost;
|
---|
331 | STAMCOUNTER StatRZRetPATMDuplicateFn;
|
---|
332 | STAMCOUNTER StatRZRetPGMChangeMode;
|
---|
333 | STAMCOUNTER StatRZRetEmulHlt;
|
---|
334 | STAMCOUNTER StatRZRetPendingRequest;
|
---|
335 | #ifndef VBOX_WITH_NEW_PHYS_CODE
|
---|
336 | STAMCOUNTER StatRZCallPGMGrowRAM;
|
---|
337 | #endif
|
---|
338 | STAMCOUNTER StatRZCallPDMLock;
|
---|
339 | STAMCOUNTER StatRZCallLogFlush;
|
---|
340 | STAMCOUNTER StatRZCallPDMQueueFlush;
|
---|
341 | STAMCOUNTER StatRZCallPGMPoolGrow;
|
---|
342 | STAMCOUNTER StatRZCallPGMMapChunk;
|
---|
343 | STAMCOUNTER StatRZCallPGMAllocHandy;
|
---|
344 | STAMCOUNTER StatRZCallRemReplay;
|
---|
345 | STAMCOUNTER StatRZCallVMSetError;
|
---|
346 | STAMCOUNTER StatRZCallVMSetRuntimeError;
|
---|
347 | STAMCOUNTER StatRZCallPGMLock;
|
---|
348 | /** @} */
|
---|
349 | } VMM;
|
---|
350 | /** Pointer to VMM. */
|
---|
351 | typedef VMM *PVMM;
|
---|
352 |
|
---|
353 |
|
---|
354 | /**
|
---|
355 | * VMMCPU Data (part of VMCPU)
|
---|
356 | */
|
---|
357 | typedef struct VMMCPU
|
---|
358 | {
|
---|
359 | /** Offset to the VMCPU structure.
|
---|
360 | * See VMM2VMCPU(). */
|
---|
361 | RTINT offVMCPU;
|
---|
362 | } VMMCPU;
|
---|
363 | /** Pointer to VMMCPU. */
|
---|
364 | typedef VMMCPU *PVMMCPU;
|
---|
365 |
|
---|
366 |
|
---|
367 | /**
|
---|
368 | * The VMMGCEntry() codes.
|
---|
369 | */
|
---|
370 | typedef enum VMMGCOPERATION
|
---|
371 | {
|
---|
372 | /** Do GC module init. */
|
---|
373 | VMMGC_DO_VMMGC_INIT = 1,
|
---|
374 |
|
---|
375 | /** The first Trap testcase. */
|
---|
376 | VMMGC_DO_TESTCASE_TRAP_FIRST = 0x0dead000,
|
---|
377 | /** Trap 0 testcases, uArg selects the variation. */
|
---|
378 | VMMGC_DO_TESTCASE_TRAP_0 = VMMGC_DO_TESTCASE_TRAP_FIRST,
|
---|
379 | /** Trap 1 testcases, uArg selects the variation. */
|
---|
380 | VMMGC_DO_TESTCASE_TRAP_1,
|
---|
381 | /** Trap 2 testcases, uArg selects the variation. */
|
---|
382 | VMMGC_DO_TESTCASE_TRAP_2,
|
---|
383 | /** Trap 3 testcases, uArg selects the variation. */
|
---|
384 | VMMGC_DO_TESTCASE_TRAP_3,
|
---|
385 | /** Trap 4 testcases, uArg selects the variation. */
|
---|
386 | VMMGC_DO_TESTCASE_TRAP_4,
|
---|
387 | /** Trap 5 testcases, uArg selects the variation. */
|
---|
388 | VMMGC_DO_TESTCASE_TRAP_5,
|
---|
389 | /** Trap 6 testcases, uArg selects the variation. */
|
---|
390 | VMMGC_DO_TESTCASE_TRAP_6,
|
---|
391 | /** Trap 7 testcases, uArg selects the variation. */
|
---|
392 | VMMGC_DO_TESTCASE_TRAP_7,
|
---|
393 | /** Trap 8 testcases, uArg selects the variation. */
|
---|
394 | VMMGC_DO_TESTCASE_TRAP_8,
|
---|
395 | /** Trap 9 testcases, uArg selects the variation. */
|
---|
396 | VMMGC_DO_TESTCASE_TRAP_9,
|
---|
397 | /** Trap 0a testcases, uArg selects the variation. */
|
---|
398 | VMMGC_DO_TESTCASE_TRAP_0A,
|
---|
399 | /** Trap 0b testcases, uArg selects the variation. */
|
---|
400 | VMMGC_DO_TESTCASE_TRAP_0B,
|
---|
401 | /** Trap 0c testcases, uArg selects the variation. */
|
---|
402 | VMMGC_DO_TESTCASE_TRAP_0C,
|
---|
403 | /** Trap 0d testcases, uArg selects the variation. */
|
---|
404 | VMMGC_DO_TESTCASE_TRAP_0D,
|
---|
405 | /** Trap 0e testcases, uArg selects the variation. */
|
---|
406 | VMMGC_DO_TESTCASE_TRAP_0E,
|
---|
407 | /** The last trap testcase (exclusive). */
|
---|
408 | VMMGC_DO_TESTCASE_TRAP_LAST,
|
---|
409 | /** Testcase for checking interrupt forwarding. */
|
---|
410 | VMMGC_DO_TESTCASE_HYPER_INTERRUPT,
|
---|
411 | /** Switching testing and profiling stub. */
|
---|
412 | VMMGC_DO_TESTCASE_NOP,
|
---|
413 | /** Testcase for checking interrupt masking.. */
|
---|
414 | VMMGC_DO_TESTCASE_INTERRUPT_MASKING,
|
---|
415 | /** Switching testing and profiling stub. */
|
---|
416 | VMMGC_DO_TESTCASE_HWACCM_NOP,
|
---|
417 |
|
---|
418 | /** The usual 32-bit hack. */
|
---|
419 | VMMGC_DO_32_BIT_HACK = 0x7fffffff
|
---|
420 | } VMMGCOPERATION;
|
---|
421 |
|
---|
422 |
|
---|
423 | __BEGIN_DECLS
|
---|
424 |
|
---|
425 | #ifdef IN_RING3
|
---|
426 | int vmmR3SwitcherInit(PVM pVM);
|
---|
427 | void vmmR3SwitcherRelocate(PVM pVM, RTGCINTPTR offDelta);
|
---|
428 | #endif /* IN_RING3 */
|
---|
429 |
|
---|
430 | #ifdef IN_RING0
|
---|
431 | /**
|
---|
432 | * World switcher assembly routine.
|
---|
433 | * It will call VMMGCEntry().
|
---|
434 | *
|
---|
435 | * @returns return code from VMMGCEntry().
|
---|
436 | * @param pVM The VM in question.
|
---|
437 | * @param uArg See VMMGCEntry().
|
---|
438 | * @internal
|
---|
439 | */
|
---|
440 | DECLASM(int) vmmR0WorldSwitch(PVM pVM, unsigned uArg);
|
---|
441 |
|
---|
442 | /**
|
---|
443 | * Callback function for vmmR0CallHostSetJmp.
|
---|
444 | *
|
---|
445 | * @returns VBox status code.
|
---|
446 | * @param pVM The VM handle.
|
---|
447 | */
|
---|
448 | typedef DECLCALLBACK(int) FNVMMR0SETJMP(PVM pVM, PVMCPU pVCpu);
|
---|
449 | /** Pointer to FNVMMR0SETJMP(). */
|
---|
450 | typedef FNVMMR0SETJMP *PFNVMMR0SETJMP;
|
---|
451 |
|
---|
452 | /**
|
---|
453 | * The setjmp variant used for calling Ring-3.
|
---|
454 | *
|
---|
455 | * This differs from the normal setjmp in that it will resume VMMR0CallHost if we're
|
---|
456 | * in the middle of a ring-3 call. Another differences is the function pointer and
|
---|
457 | * argument. This has to do with resuming code and the stack frame of the caller.
|
---|
458 | *
|
---|
459 | * @returns VINF_SUCCESS on success or whatever is passed to vmmR0CallHostLongJmp.
|
---|
460 | * @param pJmpBuf The jmp_buf to set.
|
---|
461 | * @param pfn The function to be called when not resuming..
|
---|
462 | * @param pVM The argument of that function.
|
---|
463 | */
|
---|
464 | DECLASM(int) vmmR0CallHostSetJmp(PVMMR0JMPBUF pJmpBuf, PFNVMMR0SETJMP pfn, PVM pVM, PVMCPU pVCpu);
|
---|
465 |
|
---|
466 | /**
|
---|
467 | * Callback function for vmmR0CallHostSetJmpEx.
|
---|
468 | *
|
---|
469 | * @returns VBox status code.
|
---|
470 | * @param pvUser The user argument.
|
---|
471 | */
|
---|
472 | typedef DECLCALLBACK(int) FNVMMR0SETJMPEX(void *pvUser);
|
---|
473 | /** Pointer to FNVMMR0SETJMP(). */
|
---|
474 | typedef FNVMMR0SETJMPEX *PFNVMMR0SETJMPEX;
|
---|
475 |
|
---|
476 | /**
|
---|
477 | * Same as vmmR0CallHostSetJmp except for the function signature.
|
---|
478 | *
|
---|
479 | * @returns VINF_SUCCESS on success or whatever is passed to vmmR0CallHostLongJmp.
|
---|
480 | * @param pJmpBuf The jmp_buf to set.
|
---|
481 | * @param pfn The function to be called when not resuming..
|
---|
482 | * @param pvUser The argument of that function.
|
---|
483 | */
|
---|
484 | DECLASM(int) vmmR0CallHostSetJmpEx(PVMMR0JMPBUF pJmpBuf, PFNVMMR0SETJMPEX pfn, void *pvUser);
|
---|
485 |
|
---|
486 |
|
---|
487 | /**
|
---|
488 | * Worker for VMMR0CallHost.
|
---|
489 | * This will save the stack and registers.
|
---|
490 | *
|
---|
491 | * @returns rc.
|
---|
492 | * @param pJmpBuf Pointer to the jump buffer.
|
---|
493 | * @param rc The return code.
|
---|
494 | */
|
---|
495 | DECLASM(int) vmmR0CallHostLongJmp(PVMMR0JMPBUF pJmpBuf, int rc);
|
---|
496 |
|
---|
497 | /**
|
---|
498 | * Internal R0 logger worker: Logger wrapper.
|
---|
499 | */
|
---|
500 | VMMR0DECL(void) vmmR0LoggerWrapper(const char *pszFormat, ...);
|
---|
501 |
|
---|
502 | /**
|
---|
503 | * Internal R0 logger worker: Flush logger.
|
---|
504 | *
|
---|
505 | * @param pLogger The logger instance to flush.
|
---|
506 | * @remark This function must be exported!
|
---|
507 | */
|
---|
508 | VMMR0DECL(void) vmmR0LoggerFlush(PRTLOGGER pLogger);
|
---|
509 |
|
---|
510 | #endif /* IN_RING0 */
|
---|
511 | #ifdef IN_RC
|
---|
512 |
|
---|
513 | /**
|
---|
514 | * Internal GC logger worker: Logger wrapper.
|
---|
515 | */
|
---|
516 | VMMRCDECL(void) vmmGCLoggerWrapper(const char *pszFormat, ...);
|
---|
517 |
|
---|
518 | /**
|
---|
519 | * Internal GC release logger worker: Logger wrapper.
|
---|
520 | */
|
---|
521 | VMMRCDECL(void) vmmGCRelLoggerWrapper(const char *pszFormat, ...);
|
---|
522 |
|
---|
523 | /**
|
---|
524 | * Internal GC logger worker: Flush logger.
|
---|
525 | *
|
---|
526 | * @returns VINF_SUCCESS.
|
---|
527 | * @param pLogger The logger instance to flush.
|
---|
528 | * @remark This function must be exported!
|
---|
529 | */
|
---|
530 | VMMRCDECL(int) vmmGCLoggerFlush(PRTLOGGERRC pLogger);
|
---|
531 |
|
---|
532 | /** @name Trap testcases and related labels.
|
---|
533 | * @{ */
|
---|
534 | DECLASM(void) vmmGCEnableWP(void);
|
---|
535 | DECLASM(void) vmmGCDisableWP(void);
|
---|
536 | DECLASM(int) vmmGCTestTrap3(void);
|
---|
537 | DECLASM(int) vmmGCTestTrap8(void);
|
---|
538 | DECLASM(int) vmmGCTestTrap0d(void);
|
---|
539 | DECLASM(int) vmmGCTestTrap0e(void);
|
---|
540 | DECLASM(int) vmmGCTestTrap0e_FaultEIP(void); /**< a label */
|
---|
541 | DECLASM(int) vmmGCTestTrap0e_ResumeEIP(void); /**< a label */
|
---|
542 | /** @} */
|
---|
543 |
|
---|
544 | #endif /* IN_RC */
|
---|
545 |
|
---|
546 | __END_DECLS
|
---|
547 |
|
---|
548 | /** @} */
|
---|
549 |
|
---|
550 | #endif
|
---|