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