VirtualBox

source: vbox/trunk/src/VBox/VMM/include/VMMInternal.h@ 90638

Last change on this file since 90638 was 90597, checked in by vboxsync, 3 years ago

VMM: Speed up VMMGetCpu in ring-0 by using hash table (via new GVMMR0GetGVCpuByGVMandEMT call). bugref:6695

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 23.6 KB
Line 
1/* $Id: VMMInternal.h 90597 2021-08-10 13:08:35Z vboxsync $ */
2/** @file
3 * VMM - Internal header file.
4 */
5
6/*
7 * Copyright (C) 2006-2020 Oracle Corporation
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
18#ifndef VMM_INCLUDED_SRC_include_VMMInternal_h
19#define VMM_INCLUDED_SRC_include_VMMInternal_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include <VBox/cdefs.h>
25#include <VBox/sup.h>
26#include <VBox/vmm/stam.h>
27#include <VBox/vmm/vmm.h>
28#include <VBox/log.h>
29#include <iprt/critsect.h>
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#if HC_ARCH_BITS == 32
35# error "32-bit hosts are no longer supported. Go back to 6.0 or earlier!"
36#endif
37
38
39
40/** @defgroup grp_vmm_int Internals
41 * @ingroup grp_vmm
42 * @internal
43 * @{
44 */
45
46/** @def VBOX_WITH_RC_RELEASE_LOGGING
47 * Enables RC release logging. */
48#define VBOX_WITH_RC_RELEASE_LOGGING
49
50/** @def VBOX_WITH_R0_LOGGING
51 * Enables Ring-0 logging (non-release).
52 *
53 * Ring-0 logging isn't 100% safe yet (thread id reuse / process exit cleanup),
54 * so you have to sign up here by adding your defined(DEBUG_<userid>) to the
55 * \#if, or by adding VBOX_WITH_R0_LOGGING to your LocalConfig.kmk.
56 */
57#if defined(DEBUG_sandervl) || defined(DEBUG_frank) || defined(DEBUG_ramshankar) || defined(DOXYGEN_RUNNING)
58# define VBOX_WITH_R0_LOGGING
59#endif
60
61/** @def VBOX_STRICT_VMM_STACK
62 * Enables VMM stack guard pages to catch stack over- and underruns. */
63#if defined(VBOX_STRICT) || defined(DOXYGEN_RUNNING)
64# define VBOX_STRICT_VMM_STACK
65#endif
66
67
68/**
69 * The ring-0 logger instance wrapper.
70 *
71 * We need to be able to find the VM handle from the logger instance, so we wrap
72 * it in this structure.
73 */
74typedef struct VMMR0LOGGER
75{
76 /** Pointer to Pointer to the VM. */
77 R0PTRTYPE(PVMCC) pVM;
78 /** Size of the allocated logger instance (Logger). */
79 uint32_t cbLogger;
80 /** Flag indicating whether we've create the logger Ring-0 instance yet. */
81 bool fCreated;
82 /** Flag indicating whether we've disabled flushing (world switch) or not. */
83 bool fFlushingDisabled;
84 /** Flag indicating whether we've registered the instance already. */
85 bool fRegistered;
86 bool a8Alignment;
87 /** The CPU ID. */
88 VMCPUID idCpu;
89#if HC_ARCH_BITS == 64
90 uint32_t u32Alignment;
91#endif
92 /** The ring-0 logger instance. This extends beyond the size. */
93 RTLOGGER Logger;
94} VMMR0LOGGER;
95/** Pointer to a ring-0 logger instance wrapper. */
96typedef VMMR0LOGGER *PVMMR0LOGGER;
97
98
99/**
100 * Jump buffer for the setjmp/longjmp like constructs used to
101 * quickly 'call' back into Ring-3.
102 */
103typedef struct VMMR0JMPBUF
104{
105 /** Traditional jmp_buf stuff
106 * @{ */
107#if HC_ARCH_BITS == 32
108 uint32_t ebx;
109 uint32_t esi;
110 uint32_t edi;
111 uint32_t ebp;
112 uint32_t esp;
113 uint32_t eip;
114 uint32_t eflags;
115#endif
116#if HC_ARCH_BITS == 64
117 uint64_t rbx;
118# ifdef RT_OS_WINDOWS
119 uint64_t rsi;
120 uint64_t rdi;
121# endif
122 uint64_t rbp;
123 uint64_t r12;
124 uint64_t r13;
125 uint64_t r14;
126 uint64_t r15;
127 uint64_t rsp;
128 uint64_t rip;
129# ifdef RT_OS_WINDOWS
130 uint128_t xmm6;
131 uint128_t xmm7;
132 uint128_t xmm8;
133 uint128_t xmm9;
134 uint128_t xmm10;
135 uint128_t xmm11;
136 uint128_t xmm12;
137 uint128_t xmm13;
138 uint128_t xmm14;
139 uint128_t xmm15;
140# endif
141 uint64_t rflags;
142#endif
143 /** @} */
144
145 /** Flag that indicates that we've done a ring-3 call. */
146 bool fInRing3Call;
147 /** The number of bytes we've saved. */
148 uint32_t cbSavedStack;
149 /** Pointer to the buffer used to save the stack.
150 * This is assumed to be 8KB. */
151 RTR0PTR pvSavedStack;
152 /** Esp we we match against esp on resume to make sure the stack wasn't relocated. */
153 RTHCUINTREG SpCheck;
154 /** The esp we should resume execution with after the restore. */
155 RTHCUINTREG SpResume;
156 /** ESP/RSP at the time of the jump to ring 3. */
157 RTHCUINTREG SavedEsp;
158 /** EBP/RBP at the time of the jump to ring 3. */
159 RTHCUINTREG SavedEbp;
160 /** EIP/RIP within vmmR0CallRing3LongJmp for assisting unwinding. */
161 RTHCUINTREG SavedEipForUnwind;
162 /** Unwind: The vmmR0CallRing3SetJmp return address value. */
163 RTHCUINTREG UnwindRetPcValue;
164 /** Unwind: The vmmR0CallRing3SetJmp return address stack location. */
165 RTHCUINTREG UnwindRetPcLocation;
166
167 /** The function last being executed here. */
168 RTHCUINTREG pfn;
169 /** The first argument to the function. */
170 RTHCUINTREG pvUser1;
171 /** The second argument to the function. */
172 RTHCUINTREG pvUser2;
173
174#if HC_ARCH_BITS == 32
175 /** Alignment padding. */
176 uint32_t uPadding;
177#endif
178
179 /** Stats: Max amount of stack used. */
180 uint32_t cbUsedMax;
181 /** Stats: Average stack usage. (Avg = cbUsedTotal / cUsedTotal) */
182 uint32_t cbUsedAvg;
183 /** Stats: Total amount of stack used. */
184 uint64_t cbUsedTotal;
185 /** Stats: Number of stack usages. */
186 uint64_t cUsedTotal;
187} VMMR0JMPBUF;
188/** Pointer to a ring-0 jump buffer. */
189typedef VMMR0JMPBUF *PVMMR0JMPBUF;
190
191
192/**
193 * VMM Data (part of VM)
194 */
195typedef struct VMM
196{
197 /** Whether we should use the periodic preemption timers. */
198 bool fUsePeriodicPreemptionTimers;
199 /** Alignment padding. */
200 bool afPadding0[7];
201
202#if 0 /* pointless when timers doesn't run on EMT */
203 /** The EMT yield timer. */
204 TMTIMERHANDLE hYieldTimer;
205 /** The period to the next timeout when suspended or stopped.
206 * This is 0 when running. */
207 uint32_t cYieldResumeMillies;
208 /** The EMT yield timer interval (milliseconds). */
209 uint32_t cYieldEveryMillies;
210 /** The timestamp of the previous yield. (nano) */
211 uint64_t u64LastYield;
212#endif
213
214 /** @name EMT Rendezvous
215 * @{ */
216 /** Semaphore to wait on upon entering ordered execution. */
217 R3PTRTYPE(PRTSEMEVENT) pahEvtRendezvousEnterOrdered;
218 /** Semaphore to wait on upon entering for one-by-one execution. */
219 RTSEMEVENT hEvtRendezvousEnterOneByOne;
220 /** Semaphore to wait on upon entering for all-at-once execution. */
221 RTSEMEVENTMULTI hEvtMulRendezvousEnterAllAtOnce;
222 /** Semaphore to wait on when done. */
223 RTSEMEVENTMULTI hEvtMulRendezvousDone;
224 /** Semaphore the VMMR3EmtRendezvous caller waits on at the end. */
225 RTSEMEVENT hEvtRendezvousDoneCaller;
226 /** Semaphore to wait on upon recursing. */
227 RTSEMEVENTMULTI hEvtMulRendezvousRecursionPush;
228 /** Semaphore to wait on after done with recursion (caller restoring state). */
229 RTSEMEVENTMULTI hEvtMulRendezvousRecursionPop;
230 /** Semaphore the initiator waits on while the EMTs are getting into position
231 * on hEvtMulRendezvousRecursionPush. */
232 RTSEMEVENT hEvtRendezvousRecursionPushCaller;
233 /** Semaphore the initiator waits on while the EMTs sitting on
234 * hEvtMulRendezvousRecursionPop wakes up and leave. */
235 RTSEMEVENT hEvtRendezvousRecursionPopCaller;
236 /** Callback. */
237 R3PTRTYPE(PFNVMMEMTRENDEZVOUS) volatile pfnRendezvous;
238 /** The user argument for the callback. */
239 RTR3PTR volatile pvRendezvousUser;
240 /** Flags. */
241 volatile uint32_t fRendezvousFlags;
242 /** The number of EMTs that has entered. */
243 volatile uint32_t cRendezvousEmtsEntered;
244 /** The number of EMTs that has done their job. */
245 volatile uint32_t cRendezvousEmtsDone;
246 /** The number of EMTs that has returned. */
247 volatile uint32_t cRendezvousEmtsReturned;
248 /** The status code. */
249 volatile int32_t i32RendezvousStatus;
250 /** Spin lock. */
251 volatile uint32_t u32RendezvousLock;
252 /** The recursion depth. */
253 volatile uint32_t cRendezvousRecursions;
254 /** The number of EMTs that have entered the recursion routine. */
255 volatile uint32_t cRendezvousEmtsRecursingPush;
256 /** The number of EMTs that have leaft the recursion routine. */
257 volatile uint32_t cRendezvousEmtsRecursingPop;
258 /** Triggers rendezvous recursion in the other threads. */
259 volatile bool fRendezvousRecursion;
260
261 /** @} */
262
263 /** RTThreadPreemptIsPendingTrusty() result, set by vmmR0InitVM() for
264 * release logging purposes. */
265 bool fIsPreemptPendingApiTrusty : 1;
266 /** The RTThreadPreemptIsPossible() result, set by vmmR0InitVM() for
267 * release logging purposes. */
268 bool fIsPreemptPossible : 1;
269 /** Set if ring-0 uses context hooks. */
270 bool fIsUsingContextHooks : 1;
271
272 bool afAlignment2[2]; /**< Alignment padding. */
273
274 /** Buffer for storing the standard assertion message for a ring-0 assertion.
275 * Used for saving the assertion message text for the release log and guru
276 * meditation dump. */
277 char szRing0AssertMsg1[512];
278 /** Buffer for storing the custom message for a ring-0 assertion. */
279 char szRing0AssertMsg2[256];
280
281 /** Number of VMMR0_DO_HM_RUN or VMMR0_DO_NEM_RUN calls. */
282 STAMCOUNTER StatRunGC;
283
284 /** Statistics for each of the RC/R0 return codes.
285 * @{ */
286 STAMCOUNTER StatRZRetNormal;
287 STAMCOUNTER StatRZRetInterrupt;
288 STAMCOUNTER StatRZRetInterruptHyper;
289 STAMCOUNTER StatRZRetGuestTrap;
290 STAMCOUNTER StatRZRetRingSwitch;
291 STAMCOUNTER StatRZRetRingSwitchInt;
292 STAMCOUNTER StatRZRetStaleSelector;
293 STAMCOUNTER StatRZRetIRETTrap;
294 STAMCOUNTER StatRZRetEmulate;
295 STAMCOUNTER StatRZRetPatchEmulate;
296 STAMCOUNTER StatRZRetIORead;
297 STAMCOUNTER StatRZRetIOWrite;
298 STAMCOUNTER StatRZRetIOCommitWrite;
299 STAMCOUNTER StatRZRetMMIORead;
300 STAMCOUNTER StatRZRetMMIOWrite;
301 STAMCOUNTER StatRZRetMMIOCommitWrite;
302 STAMCOUNTER StatRZRetMMIOPatchRead;
303 STAMCOUNTER StatRZRetMMIOPatchWrite;
304 STAMCOUNTER StatRZRetMMIOReadWrite;
305 STAMCOUNTER StatRZRetMSRRead;
306 STAMCOUNTER StatRZRetMSRWrite;
307 STAMCOUNTER StatRZRetLDTFault;
308 STAMCOUNTER StatRZRetGDTFault;
309 STAMCOUNTER StatRZRetIDTFault;
310 STAMCOUNTER StatRZRetTSSFault;
311 STAMCOUNTER StatRZRetCSAMTask;
312 STAMCOUNTER StatRZRetSyncCR3;
313 STAMCOUNTER StatRZRetMisc;
314 STAMCOUNTER StatRZRetPatchInt3;
315 STAMCOUNTER StatRZRetPatchPF;
316 STAMCOUNTER StatRZRetPatchGP;
317 STAMCOUNTER StatRZRetPatchIretIRQ;
318 STAMCOUNTER StatRZRetRescheduleREM;
319 STAMCOUNTER StatRZRetToR3Total;
320 STAMCOUNTER StatRZRetToR3FF;
321 STAMCOUNTER StatRZRetToR3Unknown;
322 STAMCOUNTER StatRZRetToR3TMVirt;
323 STAMCOUNTER StatRZRetToR3HandyPages;
324 STAMCOUNTER StatRZRetToR3PDMQueues;
325 STAMCOUNTER StatRZRetToR3Rendezvous;
326 STAMCOUNTER StatRZRetToR3Timer;
327 STAMCOUNTER StatRZRetToR3DMA;
328 STAMCOUNTER StatRZRetToR3CritSect;
329 STAMCOUNTER StatRZRetToR3Iem;
330 STAMCOUNTER StatRZRetToR3Iom;
331 STAMCOUNTER StatRZRetTimerPending;
332 STAMCOUNTER StatRZRetInterruptPending;
333 STAMCOUNTER StatRZRetCallRing3;
334 STAMCOUNTER StatRZRetPATMDuplicateFn;
335 STAMCOUNTER StatRZRetPGMChangeMode;
336 STAMCOUNTER StatRZRetPendingRequest;
337 STAMCOUNTER StatRZRetPGMFlushPending;
338 STAMCOUNTER StatRZRetPatchTPR;
339 STAMCOUNTER StatRZCallPDMCritSectEnter;
340 STAMCOUNTER StatRZCallPDMLock;
341 STAMCOUNTER StatRZCallLogFlush;
342 STAMCOUNTER StatRZCallPGMPoolGrow;
343 STAMCOUNTER StatRZCallPGMMapChunk;
344 STAMCOUNTER StatRZCallPGMAllocHandy;
345 STAMCOUNTER StatRZCallVMSetError;
346 STAMCOUNTER StatRZCallVMSetRuntimeError;
347 STAMCOUNTER StatRZCallPGMLock;
348 /** @} */
349} VMM;
350/** Pointer to VMM. */
351typedef VMM *PVMM;
352
353
354/**
355 * VMMCPU Data (part of VMCPU)
356 */
357typedef struct VMMCPU
358{
359 /** The last RC/R0 return code. */
360 int32_t iLastGZRc;
361 /** Alignment padding. */
362 uint32_t u32Padding0;
363
364 /** VMM stack, pointer to the top of the stack in R3.
365 * Stack is allocated from the hypervisor heap and is page aligned
366 * and always writable in RC. */
367 R3PTRTYPE(uint8_t *) pbEMTStackR3;
368
369 /** Pointer to the R0 logger instance - R3 Ptr.
370 * This is NULL if logging is disabled. */
371 R3PTRTYPE(PVMMR0LOGGER) pR0LoggerR3;
372 /** Pointer to the R0 logger instance - R0 Ptr.
373 * This is NULL if logging is disabled. */
374 R0PTRTYPE(PVMMR0LOGGER) pR0LoggerR0;
375
376 /** Pointer to the R0 release logger instance - R3 Ptr.
377 * This is NULL if logging is disabled. */
378 R3PTRTYPE(PVMMR0LOGGER) pR0RelLoggerR3;
379 /** Pointer to the R0 release instance - R0 Ptr.
380 * This is NULL if logging is disabled. */
381 R0PTRTYPE(PVMMR0LOGGER) pR0RelLoggerR0;
382
383 /** @name Rendezvous
384 * @{ */
385 /** Whether the EMT is executing a rendezvous right now. For detecting
386 * attempts at recursive rendezvous. */
387 bool volatile fInRendezvous;
388 bool afPadding1[2];
389 /** @} */
390
391 /** Whether we can HLT in VMMR0 rather than having to return to EM.
392 * Updated by vmR3SetHaltMethodU(). */
393 bool fMayHaltInRing0;
394 /** The minimum delta for which we can HLT in ring-0 for.
395 * The deadlines we can calculate are from TM, so, if it's too close
396 * we should just return to ring-3 and run the timer wheel, no point
397 * in spinning in ring-0.
398 * Updated by vmR3SetHaltMethodU(). */
399 uint32_t cNsSpinBlockThreshold;
400 /** Number of ring-0 halts (used for depreciating following values). */
401 uint32_t cR0Halts;
402 /** Number of ring-0 halts succeeding (VINF_SUCCESS) recently. */
403 uint32_t cR0HaltsSucceeded;
404 /** Number of ring-0 halts failing (VINF_EM_HALT) recently. */
405 uint32_t cR0HaltsToRing3;
406 /** Padding */
407 uint32_t u32Padding2;
408
409 /** @name Raw-mode context tracing data.
410 * @{ */
411 SUPDRVTRACERUSRCTX TracerCtx;
412 /** @} */
413
414 /** Alignment padding, making sure u64CallRing3Arg and CallRing3JmpBufR0 are nicely aligned. */
415 uint32_t au32Padding3[1];
416
417 /** @name Call Ring-3
418 * Formerly known as host calls.
419 * @{ */
420 /** The disable counter. */
421 uint32_t cCallRing3Disabled;
422 /** The pending operation. */
423 VMMCALLRING3 enmCallRing3Operation;
424 /** The result of the last operation. */
425 int32_t rcCallRing3;
426 /** The argument to the operation. */
427 uint64_t u64CallRing3Arg;
428 /** The Ring-0 notification callback. */
429 R0PTRTYPE(PFNVMMR0CALLRING3NOTIFICATION) pfnCallRing3CallbackR0;
430 /** The Ring-0 notification callback user argument. */
431 R0PTRTYPE(void *) pvCallRing3CallbackUserR0;
432 /** The Ring-0 jmp buffer.
433 * @remarks The size of this type isn't stable in assembly, so don't put
434 * anything that needs to be accessed from assembly after it. */
435 VMMR0JMPBUF CallRing3JmpBufR0;
436 /** @} */
437
438 STAMPROFILE StatR0HaltBlock;
439 STAMPROFILE StatR0HaltBlockOnTime;
440 STAMPROFILE StatR0HaltBlockOverslept;
441 STAMPROFILE StatR0HaltBlockInsomnia;
442 STAMCOUNTER StatR0HaltExec;
443 STAMCOUNTER StatR0HaltExecFromBlock;
444 STAMCOUNTER StatR0HaltExecFromSpin;
445 STAMCOUNTER StatR0HaltToR3;
446 STAMCOUNTER StatR0HaltToR3FromSpin;
447 STAMCOUNTER StatR0HaltToR3Other;
448 STAMCOUNTER StatR0HaltToR3PendingFF;
449 STAMCOUNTER StatR0HaltToR3SmallDelta;
450 STAMCOUNTER StatR0HaltToR3PostNoInt;
451 STAMCOUNTER StatR0HaltToR3PostPendingFF;
452} VMMCPU;
453AssertCompileMemberAlignment(VMMCPU, TracerCtx, 8);
454/** Pointer to VMMCPU. */
455typedef VMMCPU *PVMMCPU;
456
457/**
458 * VMM per-VCpu ring-0 only instance data.
459 */
460typedef struct VMMR0PERVCPU
461{
462 /** Set if we've entered HM context. */
463 bool volatile fInHmContext;
464
465 bool afPadding[5];
466 /** The EMT hash table index. */
467 uint16_t idxEmtHash;
468 /** Pointer to the VMMR0EntryFast preemption state structure.
469 * This is used to temporarily restore preemption before blocking. */
470 R0PTRTYPE(PRTTHREADPREEMPTSTATE) pPreemptState;
471 /** Thread context switching hook (ring-0). */
472 RTTHREADCTXHOOK hCtxHook;
473
474 /** @name Arguments passed by VMMR0EntryEx via vmmR0CallRing3SetJmpEx.
475 * @note Cannot be put on the stack as the location may change and upset the
476 * validation of resume-after-ring-3-call logic.
477 * @{ */
478 PGVM pGVM;
479 VMCPUID idCpu;
480 VMMR0OPERATION enmOperation;
481 PSUPVMMR0REQHDR pReq;
482 uint64_t u64Arg;
483 PSUPDRVSESSION pSession;
484 /** @} */
485} VMMR0PERVCPU;
486/** Pointer to VMM ring-0 VMCPU instance data. */
487typedef VMMR0PERVCPU *PVMMR0PERVCPU;
488
489
490RT_C_DECLS_BEGIN
491
492int vmmInitFormatTypes(void);
493void vmmTermFormatTypes(void);
494uint32_t vmmGetBuildType(void);
495
496#ifdef IN_RING3
497int vmmR3SwitcherInit(PVM pVM);
498void vmmR3SwitcherRelocate(PVM pVM, RTGCINTPTR offDelta);
499#endif /* IN_RING3 */
500
501#ifdef IN_RING0
502
503/**
504 * World switcher assembly routine.
505 * It will call VMMRCEntry().
506 *
507 * @returns return code from VMMRCEntry().
508 * @param pVM The cross context VM structure.
509 * @param uArg See VMMRCEntry().
510 * @internal
511 */
512DECLASM(int) vmmR0WorldSwitch(PVM pVM, unsigned uArg);
513
514/**
515 * Callback function for vmmR0CallRing3SetJmp.
516 *
517 * @returns VBox status code.
518 * @param pVM The cross context VM structure.
519 */
520typedef DECLCALLBACKTYPE(int, FNVMMR0SETJMP,(PVMCC pVM, PVMCPUCC pVCpu));
521/** Pointer to FNVMMR0SETJMP(). */
522typedef FNVMMR0SETJMP *PFNVMMR0SETJMP;
523
524/**
525 * The setjmp variant used for calling Ring-3.
526 *
527 * This differs from the normal setjmp in that it will resume VMMRZCallRing3 if we're
528 * in the middle of a ring-3 call. Another differences is the function pointer and
529 * argument. This has to do with resuming code and the stack frame of the caller.
530 *
531 * @returns VINF_SUCCESS on success or whatever is passed to vmmR0CallRing3LongJmp.
532 * @param pJmpBuf The jmp_buf to set.
533 * @param pfn The function to be called when not resuming.
534 * @param pVM The cross context VM structure.
535 * @param pVCpu The cross context virtual CPU structure of the calling EMT.
536 */
537DECLASM(int) vmmR0CallRing3SetJmp(PVMMR0JMPBUF pJmpBuf, PFNVMMR0SETJMP pfn, PVM pVM, PVMCPU pVCpu);
538
539
540/**
541 * Callback function for vmmR0CallRing3SetJmp2.
542 *
543 * @returns VBox status code.
544 * @param pvUser The user argument.
545 */
546typedef DECLCALLBACKTYPE(int, FNVMMR0SETJMP2,(PGVM pGVM, VMCPUID idCpu));
547/** Pointer to FNVMMR0SETJMP2(). */
548typedef FNVMMR0SETJMP2 *PFNVMMR0SETJMP2;
549
550/**
551 * Same as vmmR0CallRing3SetJmp except for the function signature.
552 *
553 * @returns VINF_SUCCESS on success or whatever is passed to vmmR0CallRing3LongJmp.
554 * @param pJmpBuf The jmp_buf to set.
555 * @param pfn The function to be called when not resuming.
556 * @param pGVM The ring-0 VM structure.
557 * @param idCpu The ID of the calling EMT.
558 */
559DECLASM(int) vmmR0CallRing3SetJmp2(PVMMR0JMPBUF pJmpBuf, PFNVMMR0SETJMP2 pfn, PGVM pGVM, VMCPUID idCpu);
560
561
562/**
563 * Callback function for vmmR0CallRing3SetJmpEx.
564 *
565 * @returns VBox status code.
566 * @param pvUser The user argument.
567 */
568typedef DECLCALLBACKTYPE(int, FNVMMR0SETJMPEX,(void *pvUser));
569/** Pointer to FNVMMR0SETJMPEX(). */
570typedef FNVMMR0SETJMPEX *PFNVMMR0SETJMPEX;
571
572/**
573 * Same as vmmR0CallRing3SetJmp except for the function signature.
574 *
575 * @returns VINF_SUCCESS on success or whatever is passed to vmmR0CallRing3LongJmp.
576 * @param pJmpBuf The jmp_buf to set.
577 * @param pfn The function to be called when not resuming.
578 * @param pvUser The argument of that function.
579 * @param uCallKey Unused call parameter that should be used to help
580 * uniquely identify the call.
581 */
582DECLASM(int) vmmR0CallRing3SetJmpEx(PVMMR0JMPBUF pJmpBuf, PFNVMMR0SETJMPEX pfn, void *pvUser, uintptr_t uCallKey);
583
584
585/**
586 * Worker for VMMRZCallRing3.
587 * This will save the stack and registers.
588 *
589 * @returns rc.
590 * @param pJmpBuf Pointer to the jump buffer.
591 * @param rc The return code.
592 */
593DECLASM(int) vmmR0CallRing3LongJmp(PVMMR0JMPBUF pJmpBuf, int rc);
594
595/**
596 * Internal R0 logger worker: Logger wrapper.
597 */
598VMMR0DECL(void) vmmR0LoggerWrapper(const char *pszFormat, ...);
599
600/**
601 * Internal R0 logger worker: Flush logger.
602 *
603 * @param pLogger The logger instance to flush.
604 * @remark This function must be exported!
605 */
606VMMR0DECL(void) vmmR0LoggerFlush(PRTLOGGER pLogger);
607
608/**
609 * Internal R0 logger worker: Custom prefix.
610 *
611 * @returns Number of chars written.
612 *
613 * @param pLogger The logger instance.
614 * @param pchBuf The output buffer.
615 * @param cchBuf The size of the buffer.
616 * @param pvUser User argument (ignored).
617 */
618VMMR0DECL(size_t) vmmR0LoggerPrefix(PRTLOGGER pLogger, char *pchBuf, size_t cchBuf, void *pvUser);
619
620# ifdef VBOX_WITH_TRIPLE_FAULT_HACK
621int vmmR0TripleFaultHackInit(void);
622void vmmR0TripleFaultHackTerm(void);
623# endif
624
625#endif /* IN_RING0 */
626
627RT_C_DECLS_END
628
629/** @} */
630
631#endif /* !VMM_INCLUDED_SRC_include_VMMInternal_h */
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