VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMR0/VMMR0.cpp@ 45747

Last change on this file since 45747 was 45701, checked in by vboxsync, 12 years ago

VMM: SELM and VMM early HM init changes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 55.0 KB
Line 
1/* $Id: VMMR0.cpp 45701 2013-04-24 14:21:09Z vboxsync $ */
2/** @file
3 * VMM - Host Context Ring 0.
4 */
5
6/*
7 * Copyright (C) 2006-2012 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/*******************************************************************************
19* Header Files *
20*******************************************************************************/
21#define LOG_GROUP LOG_GROUP_VMM
22#include <VBox/vmm/vmm.h>
23#include <VBox/sup.h>
24#include <VBox/vmm/trpm.h>
25#include <VBox/vmm/cpum.h>
26#include <VBox/vmm/pdmapi.h>
27#include <VBox/vmm/pgm.h>
28#include <VBox/vmm/stam.h>
29#include <VBox/vmm/tm.h>
30#include "VMMInternal.h"
31#include <VBox/vmm/vm.h>
32#ifdef VBOX_WITH_PCI_PASSTHROUGH
33# include <VBox/vmm/pdmpci.h>
34#endif
35
36#include <VBox/vmm/gvmm.h>
37#include <VBox/vmm/gmm.h>
38#include <VBox/intnet.h>
39#include <VBox/vmm/hm.h>
40#include <VBox/param.h>
41#include <VBox/err.h>
42#include <VBox/version.h>
43#include <VBox/log.h>
44
45#include <iprt/asm-amd64-x86.h>
46#include <iprt/assert.h>
47#include <iprt/crc.h>
48#include <iprt/mp.h>
49#include <iprt/once.h>
50#include <iprt/stdarg.h>
51#include <iprt/string.h>
52#include <iprt/thread.h>
53#include <iprt/timer.h>
54
55#include "dtrace/VBoxVMM.h"
56
57
58#if defined(_MSC_VER) && defined(RT_ARCH_AMD64) /** @todo check this with with VC7! */
59# pragma intrinsic(_AddressOfReturnAddress)
60#endif
61
62
63/*******************************************************************************
64* Internal Functions *
65*******************************************************************************/
66RT_C_DECLS_BEGIN
67#if defined(RT_ARCH_X86) && (defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD))
68extern uint64_t __udivdi3(uint64_t, uint64_t);
69extern uint64_t __umoddi3(uint64_t, uint64_t);
70#endif
71RT_C_DECLS_END
72
73
74/*******************************************************************************
75* Global Variables *
76*******************************************************************************/
77/** Drag in necessary library bits.
78 * The runtime lives here (in VMMR0.r0) and VBoxDD*R0.r0 links against us. */
79PFNRT g_VMMGCDeps[] =
80{
81 (PFNRT)RTCrc32,
82 (PFNRT)RTOnce,
83#if defined(RT_ARCH_X86) && (defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD))
84 (PFNRT)__udivdi3,
85 (PFNRT)__umoddi3,
86#endif
87 NULL
88};
89
90#ifdef RT_OS_SOLARIS
91/* Dependency information for the native solaris loader. */
92extern "C" { char _depends_on[] = "vboxdrv"; }
93#endif
94
95
96
97/**
98 * Initialize the module.
99 * This is called when we're first loaded.
100 *
101 * @returns 0 on success.
102 * @returns VBox status on failure.
103 * @param hMod Image handle for use in APIs.
104 */
105DECLEXPORT(int) ModuleInit(void *hMod)
106{
107#ifdef VBOX_WITH_DTRACE_R0
108 /*
109 * The first thing to do is register the static tracepoints.
110 * (Deregistration is automatic.)
111 */
112 int rc2 = SUPR0TracerRegisterModule(hMod, &g_VTGObjHeader);
113 if (RT_FAILURE(rc2))
114 return rc2;
115#endif
116 LogFlow(("ModuleInit:\n"));
117
118 /*
119 * Initialize the VMM, GVMM, GMM, HM, PGM (Darwin) and INTNET.
120 */
121 int rc = vmmInitFormatTypes();
122 if (RT_SUCCESS(rc))
123 {
124 rc = GVMMR0Init();
125 if (RT_SUCCESS(rc))
126 {
127 rc = GMMR0Init();
128 if (RT_SUCCESS(rc))
129 {
130 rc = HMR0Init();
131 if (RT_SUCCESS(rc))
132 {
133 rc = PGMRegisterStringFormatTypes();
134 if (RT_SUCCESS(rc))
135 {
136#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
137 rc = PGMR0DynMapInit();
138#endif
139 if (RT_SUCCESS(rc))
140 {
141 rc = IntNetR0Init();
142 if (RT_SUCCESS(rc))
143 {
144#ifdef VBOX_WITH_PCI_PASSTHROUGH
145 rc = PciRawR0Init();
146#endif
147 if (RT_SUCCESS(rc))
148 {
149 rc = CPUMR0ModuleInit();
150 if (RT_SUCCESS(rc))
151 {
152#ifdef VBOX_WITH_TRIPLE_FAULT_HACK
153 rc = vmmR0TripleFaultHackInit();
154 if (RT_SUCCESS(rc))
155#endif
156 {
157 LogFlow(("ModuleInit: returns success.\n"));
158 return VINF_SUCCESS;
159 }
160
161 /*
162 * Bail out.
163 */
164#ifdef VBOX_WITH_TRIPLE_FAULT_HACK
165 vmmR0TripleFaultHackTerm();
166#endif
167 }
168 else
169 LogRel(("ModuleInit: CPUMR0ModuleInit -> %Rrc\n", rc));
170#ifdef VBOX_WITH_PCI_PASSTHROUGH
171 PciRawR0Term();
172#endif
173 }
174 else
175 LogRel(("ModuleInit: PciRawR0Init -> %Rrc\n", rc));
176 IntNetR0Term();
177 }
178 else
179 LogRel(("ModuleInit: IntNetR0Init -> %Rrc\n", rc));
180#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
181 PGMR0DynMapTerm();
182#endif
183 }
184 else
185 LogRel(("ModuleInit: PGMR0DynMapInit -> %Rrc\n", rc));
186 PGMDeregisterStringFormatTypes();
187 }
188 else
189 LogRel(("ModuleInit: PGMRegisterStringFormatTypes -> %Rrc\n", rc));
190 HMR0Term();
191 }
192 else
193 LogRel(("ModuleInit: HMR0Init -> %Rrc\n", rc));
194 GMMR0Term();
195 }
196 else
197 LogRel(("ModuleInit: GMMR0Init -> %Rrc\n", rc));
198 GVMMR0Term();
199 }
200 else
201 LogRel(("ModuleInit: GVMMR0Init -> %Rrc\n", rc));
202 vmmTermFormatTypes();
203 }
204 else
205 LogRel(("ModuleInit: vmmInitFormatTypes -> %Rrc\n", rc));
206
207 LogFlow(("ModuleInit: failed %Rrc\n", rc));
208 return rc;
209}
210
211
212/**
213 * Terminate the module.
214 * This is called when we're finally unloaded.
215 *
216 * @param hMod Image handle for use in APIs.
217 */
218DECLEXPORT(void) ModuleTerm(void *hMod)
219{
220 LogFlow(("ModuleTerm:\n"));
221
222 /*
223 * Terminate the CPUM module (Local APIC cleanup).
224 */
225 CPUMR0ModuleTerm();
226
227 /*
228 * Terminate the internal network service.
229 */
230 IntNetR0Term();
231
232 /*
233 * PGM (Darwin), HM and PciRaw global cleanup.
234 */
235#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
236 PGMR0DynMapTerm();
237#endif
238#ifdef VBOX_WITH_PCI_PASSTHROUGH
239 PciRawR0Term();
240#endif
241 PGMDeregisterStringFormatTypes();
242 HMR0Term();
243#ifdef VBOX_WITH_TRIPLE_FAULT_HACK
244 vmmR0TripleFaultHackTerm();
245#endif
246
247 /*
248 * Destroy the GMM and GVMM instances.
249 */
250 GMMR0Term();
251 GVMMR0Term();
252
253 vmmTermFormatTypes();
254
255 LogFlow(("ModuleTerm: returns\n"));
256}
257
258
259/**
260 * Initiates the R0 driver for a particular VM instance.
261 *
262 * @returns VBox status code.
263 *
264 * @param pVM Pointer to the VM.
265 * @param uSvnRev The SVN revision of the ring-3 part.
266 * @thread EMT.
267 */
268static int vmmR0InitVM(PVM pVM, uint32_t uSvnRev)
269{
270 /*
271 * Match the SVN revisions.
272 */
273 if (uSvnRev != VMMGetSvnRev())
274 {
275 LogRel(("VMMR0InitVM: Revision mismatch, r3=%d r0=%d\n", uSvnRev, VMMGetSvnRev()));
276 SUPR0Printf("VMMR0InitVM: Revision mismatch, r3=%d r0=%d\n", uSvnRev, VMMGetSvnRev());
277 return VERR_VMM_R0_VERSION_MISMATCH;
278 }
279 if ( !VALID_PTR(pVM)
280 || pVM->pVMR0 != pVM)
281 return VERR_INVALID_PARAMETER;
282
283#ifdef LOG_ENABLED
284 /*
285 * Register the EMT R0 logger instance for VCPU 0.
286 */
287 PVMCPU pVCpu = &pVM->aCpus[0];
288
289 PVMMR0LOGGER pR0Logger = pVCpu->vmm.s.pR0LoggerR0;
290 if (pR0Logger)
291 {
292# if 0 /* testing of the logger. */
293 LogCom(("vmmR0InitVM: before %p\n", RTLogDefaultInstance()));
294 LogCom(("vmmR0InitVM: pfnFlush=%p actual=%p\n", pR0Logger->Logger.pfnFlush, vmmR0LoggerFlush));
295 LogCom(("vmmR0InitVM: pfnLogger=%p actual=%p\n", pR0Logger->Logger.pfnLogger, vmmR0LoggerWrapper));
296 LogCom(("vmmR0InitVM: offScratch=%d fFlags=%#x fDestFlags=%#x\n", pR0Logger->Logger.offScratch, pR0Logger->Logger.fFlags, pR0Logger->Logger.fDestFlags));
297
298 RTLogSetDefaultInstanceThread(&pR0Logger->Logger, (uintptr_t)pVM->pSession);
299 LogCom(("vmmR0InitVM: after %p reg\n", RTLogDefaultInstance()));
300 RTLogSetDefaultInstanceThread(NULL, pVM->pSession);
301 LogCom(("vmmR0InitVM: after %p dereg\n", RTLogDefaultInstance()));
302
303 pR0Logger->Logger.pfnLogger("hello ring-0 logger\n");
304 LogCom(("vmmR0InitVM: returned successfully from direct logger call.\n"));
305 pR0Logger->Logger.pfnFlush(&pR0Logger->Logger);
306 LogCom(("vmmR0InitVM: returned successfully from direct flush call.\n"));
307
308 RTLogSetDefaultInstanceThread(&pR0Logger->Logger, (uintptr_t)pVM->pSession);
309 LogCom(("vmmR0InitVM: after %p reg2\n", RTLogDefaultInstance()));
310 pR0Logger->Logger.pfnLogger("hello ring-0 logger\n");
311 LogCom(("vmmR0InitVM: returned successfully from direct logger call (2). offScratch=%d\n", pR0Logger->Logger.offScratch));
312 RTLogSetDefaultInstanceThread(NULL, pVM->pSession);
313 LogCom(("vmmR0InitVM: after %p dereg2\n", RTLogDefaultInstance()));
314
315 RTLogLoggerEx(&pR0Logger->Logger, 0, ~0U, "hello ring-0 logger (RTLogLoggerEx)\n");
316 LogCom(("vmmR0InitVM: RTLogLoggerEx returned fine offScratch=%d\n", pR0Logger->Logger.offScratch));
317
318 RTLogSetDefaultInstanceThread(&pR0Logger->Logger, (uintptr_t)pVM->pSession);
319 RTLogPrintf("hello ring-0 logger (RTLogPrintf)\n");
320 LogCom(("vmmR0InitVM: RTLogPrintf returned fine offScratch=%d\n", pR0Logger->Logger.offScratch));
321# endif
322 Log(("Switching to per-thread logging instance %p (key=%p)\n", &pR0Logger->Logger, pVM->pSession));
323 RTLogSetDefaultInstanceThread(&pR0Logger->Logger, (uintptr_t)pVM->pSession);
324 pR0Logger->fRegistered = true;
325 }
326#endif /* LOG_ENABLED */
327
328 /*
329 * Check if the host supports high resolution timers or not.
330 */
331 if ( pVM->vmm.s.fUsePeriodicPreemptionTimers
332 && !RTTimerCanDoHighResolution())
333 pVM->vmm.s.fUsePeriodicPreemptionTimers = false;
334
335 /*
336 * Initialize the per VM data for GVMM and GMM.
337 */
338 int rc = GVMMR0InitVM(pVM);
339// if (RT_SUCCESS(rc))
340// rc = GMMR0InitPerVMData(pVM);
341 if (RT_SUCCESS(rc))
342 {
343 /*
344 * Init HM, CPUM and PGM (Darwin only).
345 */
346 rc = HMR0InitVM(pVM);
347 if (RT_SUCCESS(rc))
348 {
349 rc = CPUMR0Init(pVM); /** @todo rename to CPUMR0InitVM */
350 if (RT_SUCCESS(rc))
351 {
352#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
353 rc = PGMR0DynMapInitVM(pVM);
354#endif
355 if (RT_SUCCESS(rc))
356 {
357#ifdef VBOX_WITH_PCI_PASSTHROUGH
358 rc = PciRawR0InitVM(pVM);
359#endif
360 if (RT_SUCCESS(rc))
361 {
362 GVMMR0DoneInitVM(pVM);
363 return rc;
364 }
365 }
366
367 /* bail out */
368 }
369#ifdef VBOX_WITH_PCI_PASSTHROUGH
370 PciRawR0TermVM(pVM);
371#endif
372 HMR0TermVM(pVM);
373 }
374 }
375
376
377 RTLogSetDefaultInstanceThread(NULL, (uintptr_t)pVM->pSession);
378 return rc;
379}
380
381
382/**
383 * Terminates the R0 bits for a particular VM instance.
384 *
385 * This is normally called by ring-3 as part of the VM termination process, but
386 * may alternatively be called during the support driver session cleanup when
387 * the VM object is destroyed (see GVMM).
388 *
389 * @returns VBox status code.
390 *
391 * @param pVM Pointer to the VM.
392 * @param pGVM Pointer to the global VM structure. Optional.
393 * @thread EMT or session clean up thread.
394 */
395VMMR0DECL(int) VMMR0TermVM(PVM pVM, PGVM pGVM)
396{
397#ifdef VBOX_WITH_PCI_PASSTHROUGH
398 PciRawR0TermVM(pVM);
399#endif
400
401
402 /*
403 * Tell GVMM what we're up to and check that we only do this once.
404 */
405 if (GVMMR0DoingTermVM(pVM, pGVM))
406 {
407 /** @todo I wish to call PGMR0PhysFlushHandyPages(pVM, &pVM->aCpus[idCpu])
408 * here to make sure we don't leak any shared pages if we crash... */
409#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
410 PGMR0DynMapTermVM(pVM);
411#endif
412 HMR0TermVM(pVM);
413 }
414
415 /*
416 * Deregister the logger.
417 */
418 RTLogSetDefaultInstanceThread(NULL, (uintptr_t)pVM->pSession);
419 return VINF_SUCCESS;
420}
421
422
423#ifdef VBOX_WITH_STATISTICS
424/**
425 * Record return code statistics
426 * @param pVM Pointer to the VM.
427 * @param pVCpu Pointer to the VMCPU.
428 * @param rc The status code.
429 */
430static void vmmR0RecordRC(PVM pVM, PVMCPU pVCpu, int rc)
431{
432 /*
433 * Collect statistics.
434 */
435 switch (rc)
436 {
437 case VINF_SUCCESS:
438 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetNormal);
439 break;
440 case VINF_EM_RAW_INTERRUPT:
441 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetInterrupt);
442 break;
443 case VINF_EM_RAW_INTERRUPT_HYPER:
444 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetInterruptHyper);
445 break;
446 case VINF_EM_RAW_GUEST_TRAP:
447 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetGuestTrap);
448 break;
449 case VINF_EM_RAW_RING_SWITCH:
450 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetRingSwitch);
451 break;
452 case VINF_EM_RAW_RING_SWITCH_INT:
453 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetRingSwitchInt);
454 break;
455 case VINF_EM_RAW_STALE_SELECTOR:
456 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetStaleSelector);
457 break;
458 case VINF_EM_RAW_IRET_TRAP:
459 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetIRETTrap);
460 break;
461 case VINF_IOM_R3_IOPORT_READ:
462 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetIORead);
463 break;
464 case VINF_IOM_R3_IOPORT_WRITE:
465 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetIOWrite);
466 break;
467 case VINF_IOM_R3_MMIO_READ:
468 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetMMIORead);
469 break;
470 case VINF_IOM_R3_MMIO_WRITE:
471 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetMMIOWrite);
472 break;
473 case VINF_IOM_R3_MMIO_READ_WRITE:
474 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetMMIOReadWrite);
475 break;
476 case VINF_PATM_HC_MMIO_PATCH_READ:
477 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetMMIOPatchRead);
478 break;
479 case VINF_PATM_HC_MMIO_PATCH_WRITE:
480 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetMMIOPatchWrite);
481 break;
482 case VINF_EM_RAW_EMULATE_INSTR:
483 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetEmulate);
484 break;
485 case VINF_EM_RAW_EMULATE_IO_BLOCK:
486 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetIOBlockEmulate);
487 break;
488 case VINF_PATCH_EMULATE_INSTR:
489 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPatchEmulate);
490 break;
491 case VINF_EM_RAW_EMULATE_INSTR_LDT_FAULT:
492 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetLDTFault);
493 break;
494 case VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT:
495 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetGDTFault);
496 break;
497 case VINF_EM_RAW_EMULATE_INSTR_IDT_FAULT:
498 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetIDTFault);
499 break;
500 case VINF_EM_RAW_EMULATE_INSTR_TSS_FAULT:
501 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetTSSFault);
502 break;
503 case VINF_EM_RAW_EMULATE_INSTR_PD_FAULT:
504 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPDFault);
505 break;
506 case VINF_CSAM_PENDING_ACTION:
507 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetCSAMTask);
508 break;
509 case VINF_PGM_SYNC_CR3:
510 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetSyncCR3);
511 break;
512 case VINF_PATM_PATCH_INT3:
513 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPatchInt3);
514 break;
515 case VINF_PATM_PATCH_TRAP_PF:
516 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPatchPF);
517 break;
518 case VINF_PATM_PATCH_TRAP_GP:
519 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPatchGP);
520 break;
521 case VINF_PATM_PENDING_IRQ_AFTER_IRET:
522 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPatchIretIRQ);
523 break;
524 case VINF_EM_RESCHEDULE_REM:
525 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetRescheduleREM);
526 break;
527 case VINF_EM_RAW_TO_R3:
528 if (VM_FF_ISPENDING(pVM, VM_FF_TM_VIRTUAL_SYNC))
529 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3TMVirt);
530 else if (VM_FF_ISPENDING(pVM, VM_FF_PGM_NEED_HANDY_PAGES))
531 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3HandyPages);
532 else if (VM_FF_ISPENDING(pVM, VM_FF_PDM_QUEUES))
533 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3PDMQueues);
534 else if (VM_FF_ISPENDING(pVM, VM_FF_EMT_RENDEZVOUS))
535 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3Rendezvous);
536 else if (VM_FF_ISPENDING(pVM, VM_FF_PDM_DMA))
537 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3DMA);
538 else if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_TIMER))
539 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3Timer);
540 else if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PDM_CRITSECT))
541 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3CritSect);
542 else if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_TO_R3))
543 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3);
544 else
545 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3Unknown);
546 break;
547
548 case VINF_EM_RAW_TIMER_PENDING:
549 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetTimerPending);
550 break;
551 case VINF_EM_RAW_INTERRUPT_PENDING:
552 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetInterruptPending);
553 break;
554 case VINF_VMM_CALL_HOST:
555 switch (pVCpu->vmm.s.enmCallRing3Operation)
556 {
557 case VMMCALLRING3_PDM_CRIT_SECT_ENTER:
558 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallPDMCritSectEnter);
559 break;
560 case VMMCALLRING3_PDM_LOCK:
561 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallPDMLock);
562 break;
563 case VMMCALLRING3_PGM_POOL_GROW:
564 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallPGMPoolGrow);
565 break;
566 case VMMCALLRING3_PGM_LOCK:
567 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallPGMLock);
568 break;
569 case VMMCALLRING3_PGM_MAP_CHUNK:
570 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallPGMMapChunk);
571 break;
572 case VMMCALLRING3_PGM_ALLOCATE_HANDY_PAGES:
573 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallPGMAllocHandy);
574 break;
575 case VMMCALLRING3_REM_REPLAY_HANDLER_NOTIFICATIONS:
576 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallRemReplay);
577 break;
578 case VMMCALLRING3_VMM_LOGGER_FLUSH:
579 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallLogFlush);
580 break;
581 case VMMCALLRING3_VM_SET_ERROR:
582 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallVMSetError);
583 break;
584 case VMMCALLRING3_VM_SET_RUNTIME_ERROR:
585 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallVMSetRuntimeError);
586 break;
587 case VMMCALLRING3_VM_R0_ASSERTION:
588 default:
589 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetCallRing3);
590 break;
591 }
592 break;
593 case VINF_PATM_DUPLICATE_FUNCTION:
594 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPATMDuplicateFn);
595 break;
596 case VINF_PGM_CHANGE_MODE:
597 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPGMChangeMode);
598 break;
599 case VINF_PGM_POOL_FLUSH_PENDING:
600 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPGMFlushPending);
601 break;
602 case VINF_EM_PENDING_REQUEST:
603 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPendingRequest);
604 break;
605 case VINF_EM_HM_PATCH_TPR_INSTR:
606 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPatchTPR);
607 break;
608 default:
609 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetMisc);
610 break;
611 }
612}
613#endif /* VBOX_WITH_STATISTICS */
614
615
616/**
617 * Unused ring-0 entry point that used to be called from the interrupt gate.
618 *
619 * Will be removed one of the next times we do a major SUPDrv version bump.
620 *
621 * @returns VBox status code.
622 * @param pVM Pointer to the VM.
623 * @param enmOperation Which operation to execute.
624 * @param pvArg Argument to the operation.
625 * @remarks Assume called with interrupts disabled.
626 */
627VMMR0DECL(int) VMMR0EntryInt(PVM pVM, VMMR0OPERATION enmOperation, void *pvArg)
628{
629 /*
630 * We're returning VERR_NOT_SUPPORT here so we've got something else
631 * than -1 which the interrupt gate glue code might return.
632 */
633 Log(("operation %#x is not supported\n", enmOperation));
634 NOREF(enmOperation); NOREF(pvArg); NOREF(pVM);
635 return VERR_NOT_SUPPORTED;
636}
637
638
639/**
640 * The Ring 0 entry point, called by the fast-ioctl path.
641 *
642 * @param pVM Pointer to the VM.
643 * The return code is stored in pVM->vmm.s.iLastGZRc.
644 * @param idCpu The Virtual CPU ID of the calling EMT.
645 * @param enmOperation Which operation to execute.
646 * @remarks Assume called with interrupts _enabled_.
647 */
648VMMR0DECL(void) VMMR0EntryFast(PVM pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation)
649{
650 if (RT_UNLIKELY(idCpu >= pVM->cCpus))
651 return;
652 PVMCPU pVCpu = &pVM->aCpus[idCpu];
653
654 switch (enmOperation)
655 {
656 /*
657 * Switch to GC and run guest raw mode code.
658 * Disable interrupts before doing the world switch.
659 */
660 case VMMR0_DO_RAW_RUN:
661 {
662#ifndef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
663 /* Some safety precautions first. */
664 if (RT_UNLIKELY(!PGMGetHyperCR3(pVCpu)))
665 {
666 pVCpu->vmm.s.iLastGZRc = VERR_PGM_NO_CR3_SHADOW_ROOT;
667 break;
668 }
669#endif
670
671 /* Disable preemption and update the periodic preemption timer. */
672 RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
673 RTThreadPreemptDisable(&PreemptState);
674 RTCPUID idHostCpu = RTMpCpuId();
675#ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
676 CPUMR0SetLApic(pVM, idHostCpu);
677#endif
678 ASMAtomicWriteU32(&pVCpu->idHostCpu, idHostCpu);
679 if (pVM->vmm.s.fUsePeriodicPreemptionTimers)
680 GVMMR0SchedUpdatePeriodicPreemptionTimer(pVM, pVCpu->idHostCpu, TMCalcHostTimerFrequency(pVM, pVCpu));
681
682 /* We might need to disable VT-x if the active switcher turns off paging. */
683 bool fVTxDisabled;
684 int rc = HMR0EnterSwitcher(pVM, pVM->vmm.s.enmSwitcher, &fVTxDisabled);
685 if (RT_SUCCESS(rc))
686 {
687 RTCCUINTREG uFlags = ASMIntDisableFlags();
688
689 for (;;)
690 {
691 VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC);
692 TMNotifyStartOfExecution(pVCpu);
693
694 rc = pVM->vmm.s.pfnR0ToRawMode(pVM);
695 pVCpu->vmm.s.iLastGZRc = rc;
696
697 TMNotifyEndOfExecution(pVCpu);
698 VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED);
699
700 if (rc != VINF_VMM_CALL_TRACER)
701 break;
702 SUPR0TracerUmodProbeFire(pVM->pSession, &pVCpu->vmm.s.TracerCtx);
703 }
704
705 /* Re-enable VT-x if previously turned off. */
706 HMR0LeaveSwitcher(pVM, fVTxDisabled);
707
708 if ( rc == VINF_EM_RAW_INTERRUPT
709 || rc == VINF_EM_RAW_INTERRUPT_HYPER)
710 TRPMR0DispatchHostInterrupt(pVM);
711
712 ASMSetFlags(uFlags);
713
714#ifdef VBOX_WITH_STATISTICS
715 STAM_COUNTER_INC(&pVM->vmm.s.StatRunRC);
716 vmmR0RecordRC(pVM, pVCpu, rc);
717#endif
718 }
719 else
720 pVCpu->vmm.s.iLastGZRc = rc;
721 ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
722 RTThreadPreemptRestore(&PreemptState);
723 break;
724 }
725
726 /*
727 * Run guest code using the available hardware acceleration technology.
728 *
729 * Disable interrupts before we do anything interesting. On Windows we avoid
730 * this by having the support driver raise the IRQL before calling us, this way
731 * we hope to get away with page faults and later calling into the kernel.
732 */
733 case VMMR0_DO_HM_RUN:
734 {
735#ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
736 RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
737 RTThreadPreemptDisable(&PreemptState);
738#elif !defined(RT_OS_WINDOWS)
739 RTCCUINTREG uFlags = ASMIntDisableFlags();
740#endif
741 ASMAtomicWriteU32(&pVCpu->idHostCpu, RTMpCpuId());
742 if (pVM->vmm.s.fUsePeriodicPreemptionTimers)
743 GVMMR0SchedUpdatePeriodicPreemptionTimer(pVM, pVCpu->idHostCpu, TMCalcHostTimerFrequency(pVM, pVCpu));
744
745#ifdef LOG_ENABLED
746 if (pVCpu->idCpu > 0)
747 {
748 /* Lazy registration of ring 0 loggers. */
749 PVMMR0LOGGER pR0Logger = pVCpu->vmm.s.pR0LoggerR0;
750 if ( pR0Logger
751 && !pR0Logger->fRegistered)
752 {
753 RTLogSetDefaultInstanceThread(&pR0Logger->Logger, (uintptr_t)pVM->pSession);
754 pR0Logger->fRegistered = true;
755 }
756 }
757#endif
758 int rc;
759 if (!HMR0SuspendPending())
760 {
761 rc = HMR0Enter(pVM, pVCpu);
762 if (RT_SUCCESS(rc))
763 {
764 rc = vmmR0CallRing3SetJmp(&pVCpu->vmm.s.CallRing3JmpBufR0, HMR0RunGuestCode, pVM, pVCpu); /* this may resume code. */
765 int rc2 = HMR0Leave(pVM, pVCpu);
766 AssertRC(rc2);
767 }
768 STAM_COUNTER_INC(&pVM->vmm.s.StatRunRC);
769 }
770 else
771 {
772 /* System is about to go into suspend mode; go back to ring 3. */
773 rc = VINF_EM_RAW_INTERRUPT;
774 }
775 pVCpu->vmm.s.iLastGZRc = rc;
776
777 ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
778#ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
779 RTThreadPreemptRestore(&PreemptState);
780#elif !defined(RT_OS_WINDOWS)
781 ASMSetFlags(uFlags);
782#endif
783
784#ifdef VBOX_WITH_STATISTICS
785 vmmR0RecordRC(pVM, pVCpu, rc);
786#endif
787 /* No special action required for external interrupts, just return. */
788 break;
789 }
790
791 /*
792 * For profiling.
793 */
794 case VMMR0_DO_NOP:
795 pVCpu->vmm.s.iLastGZRc = VINF_SUCCESS;
796 break;
797
798 /*
799 * Impossible.
800 */
801 default:
802 AssertMsgFailed(("%#x\n", enmOperation));
803 pVCpu->vmm.s.iLastGZRc = VERR_NOT_SUPPORTED;
804 break;
805 }
806}
807
808
809/**
810 * Validates a session or VM session argument.
811 *
812 * @returns true / false accordingly.
813 * @param pVM Pointer to the VM.
814 * @param pSession The session argument.
815 */
816DECLINLINE(bool) vmmR0IsValidSession(PVM pVM, PSUPDRVSESSION pClaimedSession, PSUPDRVSESSION pSession)
817{
818 /* This must be set! */
819 if (!pSession)
820 return false;
821
822 /* Only one out of the two. */
823 if (pVM && pClaimedSession)
824 return false;
825 if (pVM)
826 pClaimedSession = pVM->pSession;
827 return pClaimedSession == pSession;
828}
829
830
831/**
832 * VMMR0EntryEx worker function, either called directly or when ever possible
833 * called thru a longjmp so we can exit safely on failure.
834 *
835 * @returns VBox status code.
836 * @param pVM Pointer to the VM.
837 * @param idCpu Virtual CPU ID argument. Must be NIL_VMCPUID if pVM
838 * is NIL_RTR0PTR, and may be NIL_VMCPUID if it isn't
839 * @param enmOperation Which operation to execute.
840 * @param pReqHdr This points to a SUPVMMR0REQHDR packet. Optional.
841 * The support driver validates this if it's present.
842 * @param u64Arg Some simple constant argument.
843 * @param pSession The session of the caller.
844 * @remarks Assume called with interrupts _enabled_.
845 */
846static int vmmR0EntryExWorker(PVM pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation, PSUPVMMR0REQHDR pReqHdr, uint64_t u64Arg, PSUPDRVSESSION pSession)
847{
848 /*
849 * Common VM pointer validation.
850 */
851 if (pVM)
852 {
853 if (RT_UNLIKELY( !VALID_PTR(pVM)
854 || ((uintptr_t)pVM & PAGE_OFFSET_MASK)))
855 {
856 SUPR0Printf("vmmR0EntryExWorker: Invalid pVM=%p! (op=%d)\n", pVM, enmOperation);
857 return VERR_INVALID_POINTER;
858 }
859 if (RT_UNLIKELY( pVM->enmVMState < VMSTATE_CREATING
860 || pVM->enmVMState > VMSTATE_TERMINATED
861 || pVM->pVMR0 != pVM))
862 {
863 SUPR0Printf("vmmR0EntryExWorker: Invalid pVM=%p:{enmVMState=%d, .pVMR0=%p}! (op=%d)\n",
864 pVM, pVM->enmVMState, pVM->pVMR0, enmOperation);
865 return VERR_INVALID_POINTER;
866 }
867
868 if (RT_UNLIKELY(idCpu >= pVM->cCpus && idCpu != NIL_VMCPUID))
869 {
870 SUPR0Printf("vmmR0EntryExWorker: Invalid idCpu (%u vs cCpus=%u)\n", idCpu, pVM->cCpus);
871 return VERR_INVALID_PARAMETER;
872 }
873 }
874 else if (RT_UNLIKELY(idCpu != NIL_VMCPUID))
875 {
876 SUPR0Printf("vmmR0EntryExWorker: Invalid idCpu=%u\n", idCpu);
877 return VERR_INVALID_PARAMETER;
878 }
879
880
881 switch (enmOperation)
882 {
883 /*
884 * GVM requests
885 */
886 case VMMR0_DO_GVMM_CREATE_VM:
887 if (pVM || u64Arg || idCpu != NIL_VMCPUID)
888 return VERR_INVALID_PARAMETER;
889 return GVMMR0CreateVMReq((PGVMMCREATEVMREQ)pReqHdr);
890
891 case VMMR0_DO_GVMM_DESTROY_VM:
892 if (pReqHdr || u64Arg)
893 return VERR_INVALID_PARAMETER;
894 return GVMMR0DestroyVM(pVM);
895
896 case VMMR0_DO_GVMM_REGISTER_VMCPU:
897 {
898 if (!pVM)
899 return VERR_INVALID_PARAMETER;
900 return GVMMR0RegisterVCpu(pVM, idCpu);
901 }
902
903 case VMMR0_DO_GVMM_SCHED_HALT:
904 if (pReqHdr)
905 return VERR_INVALID_PARAMETER;
906 return GVMMR0SchedHalt(pVM, idCpu, u64Arg);
907
908 case VMMR0_DO_GVMM_SCHED_WAKE_UP:
909 if (pReqHdr || u64Arg)
910 return VERR_INVALID_PARAMETER;
911 return GVMMR0SchedWakeUp(pVM, idCpu);
912
913 case VMMR0_DO_GVMM_SCHED_POKE:
914 if (pReqHdr || u64Arg)
915 return VERR_INVALID_PARAMETER;
916 return GVMMR0SchedPoke(pVM, idCpu);
917
918 case VMMR0_DO_GVMM_SCHED_WAKE_UP_AND_POKE_CPUS:
919 if (u64Arg)
920 return VERR_INVALID_PARAMETER;
921 return GVMMR0SchedWakeUpAndPokeCpusReq(pVM, (PGVMMSCHEDWAKEUPANDPOKECPUSREQ)pReqHdr);
922
923 case VMMR0_DO_GVMM_SCHED_POLL:
924 if (pReqHdr || u64Arg > 1)
925 return VERR_INVALID_PARAMETER;
926 return GVMMR0SchedPoll(pVM, idCpu, !!u64Arg);
927
928 case VMMR0_DO_GVMM_QUERY_STATISTICS:
929 if (u64Arg)
930 return VERR_INVALID_PARAMETER;
931 return GVMMR0QueryStatisticsReq(pVM, (PGVMMQUERYSTATISTICSSREQ)pReqHdr);
932
933 case VMMR0_DO_GVMM_RESET_STATISTICS:
934 if (u64Arg)
935 return VERR_INVALID_PARAMETER;
936 return GVMMR0ResetStatisticsReq(pVM, (PGVMMRESETSTATISTICSSREQ)pReqHdr);
937
938 /*
939 * Initialize the R0 part of a VM instance.
940 */
941 case VMMR0_DO_VMMR0_INIT:
942 return vmmR0InitVM(pVM, (uint32_t)u64Arg);
943
944 /*
945 * Terminate the R0 part of a VM instance.
946 */
947 case VMMR0_DO_VMMR0_TERM:
948 return VMMR0TermVM(pVM, NULL);
949
950 /*
951 * Attempt to enable hm mode and check the current setting.
952 */
953 case VMMR0_DO_HM_ENABLE:
954 return HMR0EnableAllCpus(pVM);
955
956 /*
957 * Setup the hardware accelerated session.
958 */
959 case VMMR0_DO_HM_SETUP_VM:
960 return HMR0SetupVM(pVM);
961
962 /*
963 * Switch to RC to execute Hypervisor function.
964 */
965 case VMMR0_DO_CALL_HYPERVISOR:
966 {
967 int rc;
968 bool fVTxDisabled;
969
970#ifndef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
971 if (RT_UNLIKELY(!PGMGetHyperCR3(VMMGetCpu0(pVM))))
972 return VERR_PGM_NO_CR3_SHADOW_ROOT;
973#endif
974
975 RTCCUINTREG fFlags = ASMIntDisableFlags();
976
977#ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
978 RTCPUID idHostCpu = RTMpCpuId();
979 CPUMR0SetLApic(pVM, idHostCpu);
980#endif
981
982 /* We might need to disable VT-x if the active switcher turns off paging. */
983 rc = HMR0EnterSwitcher(pVM, pVM->vmm.s.enmSwitcher, &fVTxDisabled);
984 if (RT_FAILURE(rc))
985 return rc;
986
987 rc = pVM->vmm.s.pfnR0ToRawMode(pVM);
988
989 /* Re-enable VT-x if previously turned off. */
990 HMR0LeaveSwitcher(pVM, fVTxDisabled);
991
992 /** @todo dispatch interrupts? */
993 ASMSetFlags(fFlags);
994 return rc;
995 }
996
997 /*
998 * PGM wrappers.
999 */
1000 case VMMR0_DO_PGM_ALLOCATE_HANDY_PAGES:
1001 if (idCpu == NIL_VMCPUID)
1002 return VERR_INVALID_CPU_ID;
1003 return PGMR0PhysAllocateHandyPages(pVM, &pVM->aCpus[idCpu]);
1004
1005 case VMMR0_DO_PGM_FLUSH_HANDY_PAGES:
1006 if (idCpu == NIL_VMCPUID)
1007 return VERR_INVALID_CPU_ID;
1008 return PGMR0PhysFlushHandyPages(pVM, &pVM->aCpus[idCpu]);
1009
1010 case VMMR0_DO_PGM_ALLOCATE_LARGE_HANDY_PAGE:
1011 if (idCpu == NIL_VMCPUID)
1012 return VERR_INVALID_CPU_ID;
1013 return PGMR0PhysAllocateLargeHandyPage(pVM, &pVM->aCpus[idCpu]);
1014
1015 case VMMR0_DO_PGM_PHYS_SETUP_IOMMU:
1016 if (idCpu != 0)
1017 return VERR_INVALID_CPU_ID;
1018 return PGMR0PhysSetupIommu(pVM);
1019
1020 /*
1021 * GMM wrappers.
1022 */
1023 case VMMR0_DO_GMM_INITIAL_RESERVATION:
1024 if (u64Arg)
1025 return VERR_INVALID_PARAMETER;
1026 return GMMR0InitialReservationReq(pVM, idCpu, (PGMMINITIALRESERVATIONREQ)pReqHdr);
1027
1028 case VMMR0_DO_GMM_UPDATE_RESERVATION:
1029 if (u64Arg)
1030 return VERR_INVALID_PARAMETER;
1031 return GMMR0UpdateReservationReq(pVM, idCpu, (PGMMUPDATERESERVATIONREQ)pReqHdr);
1032
1033 case VMMR0_DO_GMM_ALLOCATE_PAGES:
1034 if (u64Arg)
1035 return VERR_INVALID_PARAMETER;
1036 return GMMR0AllocatePagesReq(pVM, idCpu, (PGMMALLOCATEPAGESREQ)pReqHdr);
1037
1038 case VMMR0_DO_GMM_FREE_PAGES:
1039 if (u64Arg)
1040 return VERR_INVALID_PARAMETER;
1041 return GMMR0FreePagesReq(pVM, idCpu, (PGMMFREEPAGESREQ)pReqHdr);
1042
1043 case VMMR0_DO_GMM_FREE_LARGE_PAGE:
1044 if (u64Arg)
1045 return VERR_INVALID_PARAMETER;
1046 return GMMR0FreeLargePageReq(pVM, idCpu, (PGMMFREELARGEPAGEREQ)pReqHdr);
1047
1048 case VMMR0_DO_GMM_QUERY_HYPERVISOR_MEM_STATS:
1049 if (u64Arg)
1050 return VERR_INVALID_PARAMETER;
1051 return GMMR0QueryHypervisorMemoryStatsReq(pVM, (PGMMMEMSTATSREQ)pReqHdr);
1052
1053 case VMMR0_DO_GMM_QUERY_MEM_STATS:
1054 if (idCpu == NIL_VMCPUID)
1055 return VERR_INVALID_CPU_ID;
1056 if (u64Arg)
1057 return VERR_INVALID_PARAMETER;
1058 return GMMR0QueryMemoryStatsReq(pVM, idCpu, (PGMMMEMSTATSREQ)pReqHdr);
1059
1060 case VMMR0_DO_GMM_BALLOONED_PAGES:
1061 if (u64Arg)
1062 return VERR_INVALID_PARAMETER;
1063 return GMMR0BalloonedPagesReq(pVM, idCpu, (PGMMBALLOONEDPAGESREQ)pReqHdr);
1064
1065 case VMMR0_DO_GMM_MAP_UNMAP_CHUNK:
1066 if (u64Arg)
1067 return VERR_INVALID_PARAMETER;
1068 return GMMR0MapUnmapChunkReq(pVM, (PGMMMAPUNMAPCHUNKREQ)pReqHdr);
1069
1070 case VMMR0_DO_GMM_SEED_CHUNK:
1071 if (pReqHdr)
1072 return VERR_INVALID_PARAMETER;
1073 return GMMR0SeedChunk(pVM, idCpu, (RTR3PTR)u64Arg);
1074
1075 case VMMR0_DO_GMM_REGISTER_SHARED_MODULE:
1076 if (idCpu == NIL_VMCPUID)
1077 return VERR_INVALID_CPU_ID;
1078 if (u64Arg)
1079 return VERR_INVALID_PARAMETER;
1080 return GMMR0RegisterSharedModuleReq(pVM, idCpu, (PGMMREGISTERSHAREDMODULEREQ)pReqHdr);
1081
1082 case VMMR0_DO_GMM_UNREGISTER_SHARED_MODULE:
1083 if (idCpu == NIL_VMCPUID)
1084 return VERR_INVALID_CPU_ID;
1085 if (u64Arg)
1086 return VERR_INVALID_PARAMETER;
1087 return GMMR0UnregisterSharedModuleReq(pVM, idCpu, (PGMMUNREGISTERSHAREDMODULEREQ)pReqHdr);
1088
1089 case VMMR0_DO_GMM_RESET_SHARED_MODULES:
1090 if (idCpu == NIL_VMCPUID)
1091 return VERR_INVALID_CPU_ID;
1092 if ( u64Arg
1093 || pReqHdr)
1094 return VERR_INVALID_PARAMETER;
1095 return GMMR0ResetSharedModules(pVM, idCpu);
1096
1097#ifdef VBOX_WITH_PAGE_SHARING
1098 case VMMR0_DO_GMM_CHECK_SHARED_MODULES:
1099 {
1100 if (idCpu == NIL_VMCPUID)
1101 return VERR_INVALID_CPU_ID;
1102 if ( u64Arg
1103 || pReqHdr)
1104 return VERR_INVALID_PARAMETER;
1105
1106 PVMCPU pVCpu = &pVM->aCpus[idCpu];
1107 Assert(pVCpu->hNativeThreadR0 == RTThreadNativeSelf());
1108
1109# ifdef DEBUG_sandervl
1110 /* Make sure that log flushes can jump back to ring-3; annoying to get an incomplete log (this is risky though as the code doesn't take this into account). */
1111 /* Todo: this can have bad side effects for unexpected jumps back to r3. */
1112 int rc = GMMR0CheckSharedModulesStart(pVM);
1113 if (rc == VINF_SUCCESS)
1114 {
1115 rc = vmmR0CallRing3SetJmp(&pVCpu->vmm.s.CallRing3JmpBufR0, GMMR0CheckSharedModules, pVM, pVCpu); /* this may resume code. */
1116 Assert( rc == VINF_SUCCESS
1117 || (rc == VINF_VMM_CALL_HOST && pVCpu->vmm.s.enmCallRing3Operation == VMMCALLRING3_VMM_LOGGER_FLUSH));
1118 GMMR0CheckSharedModulesEnd(pVM);
1119 }
1120# else
1121 int rc = GMMR0CheckSharedModules(pVM, pVCpu);
1122# endif
1123 return rc;
1124 }
1125#endif
1126
1127#if defined(VBOX_STRICT) && HC_ARCH_BITS == 64
1128 case VMMR0_DO_GMM_FIND_DUPLICATE_PAGE:
1129 if (u64Arg)
1130 return VERR_INVALID_PARAMETER;
1131 return GMMR0FindDuplicatePageReq(pVM, (PGMMFINDDUPLICATEPAGEREQ)pReqHdr);
1132#endif
1133
1134 case VMMR0_DO_GMM_QUERY_STATISTICS:
1135 if (u64Arg)
1136 return VERR_INVALID_PARAMETER;
1137 return GMMR0QueryStatisticsReq(pVM, (PGMMQUERYSTATISTICSSREQ)pReqHdr);
1138
1139 case VMMR0_DO_GMM_RESET_STATISTICS:
1140 if (u64Arg)
1141 return VERR_INVALID_PARAMETER;
1142 return GMMR0ResetStatisticsReq(pVM, (PGMMRESETSTATISTICSSREQ)pReqHdr);
1143
1144 /*
1145 * A quick GCFGM mock-up.
1146 */
1147 /** @todo GCFGM with proper access control, ring-3 management interface and all that. */
1148 case VMMR0_DO_GCFGM_SET_VALUE:
1149 case VMMR0_DO_GCFGM_QUERY_VALUE:
1150 {
1151 if (pVM || !pReqHdr || u64Arg || idCpu != NIL_VMCPUID)
1152 return VERR_INVALID_PARAMETER;
1153 PGCFGMVALUEREQ pReq = (PGCFGMVALUEREQ)pReqHdr;
1154 if (pReq->Hdr.cbReq != sizeof(*pReq))
1155 return VERR_INVALID_PARAMETER;
1156 int rc;
1157 if (enmOperation == VMMR0_DO_GCFGM_SET_VALUE)
1158 {
1159 rc = GVMMR0SetConfig(pReq->pSession, &pReq->szName[0], pReq->u64Value);
1160 //if (rc == VERR_CFGM_VALUE_NOT_FOUND)
1161 // rc = GMMR0SetConfig(pReq->pSession, &pReq->szName[0], pReq->u64Value);
1162 }
1163 else
1164 {
1165 rc = GVMMR0QueryConfig(pReq->pSession, &pReq->szName[0], &pReq->u64Value);
1166 //if (rc == VERR_CFGM_VALUE_NOT_FOUND)
1167 // rc = GMMR0QueryConfig(pReq->pSession, &pReq->szName[0], &pReq->u64Value);
1168 }
1169 return rc;
1170 }
1171
1172 /*
1173 * PDM Wrappers.
1174 */
1175 case VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER:
1176 {
1177 if (!pVM || !pReqHdr || u64Arg || idCpu != NIL_VMCPUID)
1178 return VERR_INVALID_PARAMETER;
1179 return PDMR0DriverCallReqHandler(pVM, (PPDMDRIVERCALLREQHANDLERREQ)pReqHdr);
1180 }
1181
1182 case VMMR0_DO_PDM_DEVICE_CALL_REQ_HANDLER:
1183 {
1184 if (!pVM || !pReqHdr || u64Arg || idCpu != NIL_VMCPUID)
1185 return VERR_INVALID_PARAMETER;
1186 return PDMR0DeviceCallReqHandler(pVM, (PPDMDEVICECALLREQHANDLERREQ)pReqHdr);
1187 }
1188
1189 /*
1190 * Requests to the internal networking service.
1191 */
1192 case VMMR0_DO_INTNET_OPEN:
1193 {
1194 PINTNETOPENREQ pReq = (PINTNETOPENREQ)pReqHdr;
1195 if (u64Arg || !pReq || !vmmR0IsValidSession(pVM, pReq->pSession, pSession) || idCpu != NIL_VMCPUID)
1196 return VERR_INVALID_PARAMETER;
1197 return IntNetR0OpenReq(pSession, pReq);
1198 }
1199
1200 case VMMR0_DO_INTNET_IF_CLOSE:
1201 if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFCLOSEREQ)pReqHdr)->pSession, pSession) || idCpu != NIL_VMCPUID)
1202 return VERR_INVALID_PARAMETER;
1203 return IntNetR0IfCloseReq(pSession, (PINTNETIFCLOSEREQ)pReqHdr);
1204
1205 case VMMR0_DO_INTNET_IF_GET_BUFFER_PTRS:
1206 if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFGETBUFFERPTRSREQ)pReqHdr)->pSession, pSession) || idCpu != NIL_VMCPUID)
1207 return VERR_INVALID_PARAMETER;
1208 return IntNetR0IfGetBufferPtrsReq(pSession, (PINTNETIFGETBUFFERPTRSREQ)pReqHdr);
1209
1210 case VMMR0_DO_INTNET_IF_SET_PROMISCUOUS_MODE:
1211 if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFSETPROMISCUOUSMODEREQ)pReqHdr)->pSession, pSession) || idCpu != NIL_VMCPUID)
1212 return VERR_INVALID_PARAMETER;
1213 return IntNetR0IfSetPromiscuousModeReq(pSession, (PINTNETIFSETPROMISCUOUSMODEREQ)pReqHdr);
1214
1215 case VMMR0_DO_INTNET_IF_SET_MAC_ADDRESS:
1216 if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFSETMACADDRESSREQ)pReqHdr)->pSession, pSession) || idCpu != NIL_VMCPUID)
1217 return VERR_INVALID_PARAMETER;
1218 return IntNetR0IfSetMacAddressReq(pSession, (PINTNETIFSETMACADDRESSREQ)pReqHdr);
1219
1220 case VMMR0_DO_INTNET_IF_SET_ACTIVE:
1221 if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFSETACTIVEREQ)pReqHdr)->pSession, pSession) || idCpu != NIL_VMCPUID)
1222 return VERR_INVALID_PARAMETER;
1223 return IntNetR0IfSetActiveReq(pSession, (PINTNETIFSETACTIVEREQ)pReqHdr);
1224
1225 case VMMR0_DO_INTNET_IF_SEND:
1226 if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFSENDREQ)pReqHdr)->pSession, pSession) || idCpu != NIL_VMCPUID)
1227 return VERR_INVALID_PARAMETER;
1228 return IntNetR0IfSendReq(pSession, (PINTNETIFSENDREQ)pReqHdr);
1229
1230 case VMMR0_DO_INTNET_IF_WAIT:
1231 if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFWAITREQ)pReqHdr)->pSession, pSession) || idCpu != NIL_VMCPUID)
1232 return VERR_INVALID_PARAMETER;
1233 return IntNetR0IfWaitReq(pSession, (PINTNETIFWAITREQ)pReqHdr);
1234
1235 case VMMR0_DO_INTNET_IF_ABORT_WAIT:
1236 if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFWAITREQ)pReqHdr)->pSession, pSession) || idCpu != NIL_VMCPUID)
1237 return VERR_INVALID_PARAMETER;
1238 return IntNetR0IfAbortWaitReq(pSession, (PINTNETIFABORTWAITREQ)pReqHdr);
1239
1240#ifdef VBOX_WITH_PCI_PASSTHROUGH
1241 /*
1242 * Requests to host PCI driver service.
1243 */
1244 case VMMR0_DO_PCIRAW_REQ:
1245 if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PPCIRAWSENDREQ)pReqHdr)->pSession, pSession) || idCpu != NIL_VMCPUID)
1246 return VERR_INVALID_PARAMETER;
1247 return PciRawR0ProcessReq(pSession, pVM, (PPCIRAWSENDREQ)pReqHdr);
1248#endif
1249 /*
1250 * For profiling.
1251 */
1252 case VMMR0_DO_NOP:
1253 case VMMR0_DO_SLOW_NOP:
1254 return VINF_SUCCESS;
1255
1256 /*
1257 * For testing Ring-0 APIs invoked in this environment.
1258 */
1259 case VMMR0_DO_TESTS:
1260 /** @todo make new test */
1261 return VINF_SUCCESS;
1262
1263
1264#if HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS) && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
1265 case VMMR0_DO_TEST_SWITCHER3264:
1266 if (idCpu == NIL_VMCPUID)
1267 return VERR_INVALID_CPU_ID;
1268 return HMR0TestSwitcher3264(pVM);
1269#endif
1270 default:
1271 /*
1272 * We're returning VERR_NOT_SUPPORT here so we've got something else
1273 * than -1 which the interrupt gate glue code might return.
1274 */
1275 Log(("operation %#x is not supported\n", enmOperation));
1276 return VERR_NOT_SUPPORTED;
1277 }
1278}
1279
1280
1281/**
1282 * Argument for vmmR0EntryExWrapper containing the arguments for VMMR0EntryEx.
1283 */
1284typedef struct VMMR0ENTRYEXARGS
1285{
1286 PVM pVM;
1287 VMCPUID idCpu;
1288 VMMR0OPERATION enmOperation;
1289 PSUPVMMR0REQHDR pReq;
1290 uint64_t u64Arg;
1291 PSUPDRVSESSION pSession;
1292} VMMR0ENTRYEXARGS;
1293/** Pointer to a vmmR0EntryExWrapper argument package. */
1294typedef VMMR0ENTRYEXARGS *PVMMR0ENTRYEXARGS;
1295
1296/**
1297 * This is just a longjmp wrapper function for VMMR0EntryEx calls.
1298 *
1299 * @returns VBox status code.
1300 * @param pvArgs The argument package
1301 */
1302static DECLCALLBACK(int) vmmR0EntryExWrapper(void *pvArgs)
1303{
1304 return vmmR0EntryExWorker(((PVMMR0ENTRYEXARGS)pvArgs)->pVM,
1305 ((PVMMR0ENTRYEXARGS)pvArgs)->idCpu,
1306 ((PVMMR0ENTRYEXARGS)pvArgs)->enmOperation,
1307 ((PVMMR0ENTRYEXARGS)pvArgs)->pReq,
1308 ((PVMMR0ENTRYEXARGS)pvArgs)->u64Arg,
1309 ((PVMMR0ENTRYEXARGS)pvArgs)->pSession);
1310}
1311
1312
1313/**
1314 * The Ring 0 entry point, called by the support library (SUP).
1315 *
1316 * @returns VBox status code.
1317 * @param pVM Pointer to the VM.
1318 * @param idCpu Virtual CPU ID argument. Must be NIL_VMCPUID if pVM
1319 * is NIL_RTR0PTR, and may be NIL_VMCPUID if it isn't
1320 * @param enmOperation Which operation to execute.
1321 * @param pReq Pointer to the SUPVMMR0REQHDR packet. Optional.
1322 * @param u64Arg Some simple constant argument.
1323 * @param pSession The session of the caller.
1324 * @remarks Assume called with interrupts _enabled_.
1325 */
1326VMMR0DECL(int) VMMR0EntryEx(PVM pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg, PSUPDRVSESSION pSession)
1327{
1328 /*
1329 * Requests that should only happen on the EMT thread will be
1330 * wrapped in a setjmp so we can assert without causing trouble.
1331 */
1332 if ( VALID_PTR(pVM)
1333 && pVM->pVMR0
1334 && idCpu < pVM->cCpus)
1335 {
1336 switch (enmOperation)
1337 {
1338 /* These might/will be called before VMMR3Init. */
1339 case VMMR0_DO_GMM_INITIAL_RESERVATION:
1340 case VMMR0_DO_GMM_UPDATE_RESERVATION:
1341 case VMMR0_DO_GMM_ALLOCATE_PAGES:
1342 case VMMR0_DO_GMM_FREE_PAGES:
1343 case VMMR0_DO_GMM_BALLOONED_PAGES:
1344 /* On the mac we might not have a valid jmp buf, so check these as well. */
1345 case VMMR0_DO_VMMR0_INIT:
1346 case VMMR0_DO_VMMR0_TERM:
1347 {
1348 PVMCPU pVCpu = &pVM->aCpus[idCpu];
1349
1350 if (!pVCpu->vmm.s.CallRing3JmpBufR0.pvSavedStack)
1351 break;
1352
1353 /** @todo validate this EMT claim... GVM knows. */
1354 VMMR0ENTRYEXARGS Args;
1355 Args.pVM = pVM;
1356 Args.idCpu = idCpu;
1357 Args.enmOperation = enmOperation;
1358 Args.pReq = pReq;
1359 Args.u64Arg = u64Arg;
1360 Args.pSession = pSession;
1361 return vmmR0CallRing3SetJmpEx(&pVCpu->vmm.s.CallRing3JmpBufR0, vmmR0EntryExWrapper, &Args);
1362 }
1363
1364 default:
1365 break;
1366 }
1367 }
1368 return vmmR0EntryExWorker(pVM, idCpu, enmOperation, pReq, u64Arg, pSession);
1369}
1370
1371/**
1372 * Internal R0 logger worker: Flush logger.
1373 *
1374 * @param pLogger The logger instance to flush.
1375 * @remark This function must be exported!
1376 */
1377VMMR0DECL(void) vmmR0LoggerFlush(PRTLOGGER pLogger)
1378{
1379#ifdef LOG_ENABLED
1380 /*
1381 * Convert the pLogger into a VM handle and 'call' back to Ring-3.
1382 * (This is a bit paranoid code.)
1383 */
1384 PVMMR0LOGGER pR0Logger = (PVMMR0LOGGER)((uintptr_t)pLogger - RT_OFFSETOF(VMMR0LOGGER, Logger));
1385 if ( !VALID_PTR(pR0Logger)
1386 || !VALID_PTR(pR0Logger + 1)
1387 || pLogger->u32Magic != RTLOGGER_MAGIC)
1388 {
1389# ifdef DEBUG
1390 SUPR0Printf("vmmR0LoggerFlush: pLogger=%p!\n", pLogger);
1391# endif
1392 return;
1393 }
1394 if (pR0Logger->fFlushingDisabled)
1395 return; /* quietly */
1396
1397 PVM pVM = pR0Logger->pVM;
1398 if ( !VALID_PTR(pVM)
1399 || pVM->pVMR0 != pVM)
1400 {
1401# ifdef DEBUG
1402 SUPR0Printf("vmmR0LoggerFlush: pVM=%p! pVMR0=%p! pLogger=%p\n", pVM, pVM->pVMR0, pLogger);
1403# endif
1404 return;
1405 }
1406
1407 PVMCPU pVCpu = VMMGetCpu(pVM);
1408 if (pVCpu)
1409 {
1410 /*
1411 * Check that the jump buffer is armed.
1412 */
1413# ifdef RT_ARCH_X86
1414 if ( !pVCpu->vmm.s.CallRing3JmpBufR0.eip
1415 || pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call)
1416# else
1417 if ( !pVCpu->vmm.s.CallRing3JmpBufR0.rip
1418 || pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call)
1419# endif
1420 {
1421# ifdef DEBUG
1422 SUPR0Printf("vmmR0LoggerFlush: Jump buffer isn't armed!\n");
1423# endif
1424 return;
1425 }
1426 VMMRZCallRing3(pVM, pVCpu, VMMCALLRING3_VMM_LOGGER_FLUSH, 0);
1427 }
1428# ifdef DEBUG
1429 else
1430 SUPR0Printf("vmmR0LoggerFlush: invalid VCPU context!\n");
1431# endif
1432#endif
1433}
1434
1435/**
1436 * Internal R0 logger worker: Custom prefix.
1437 *
1438 * @returns Number of chars written.
1439 *
1440 * @param pLogger The logger instance.
1441 * @param pchBuf The output buffer.
1442 * @param cchBuf The size of the buffer.
1443 * @param pvUser User argument (ignored).
1444 */
1445VMMR0DECL(size_t) vmmR0LoggerPrefix(PRTLOGGER pLogger, char *pchBuf, size_t cchBuf, void *pvUser)
1446{
1447 NOREF(pvUser);
1448#ifdef LOG_ENABLED
1449 PVMMR0LOGGER pR0Logger = (PVMMR0LOGGER)((uintptr_t)pLogger - RT_OFFSETOF(VMMR0LOGGER, Logger));
1450 if ( !VALID_PTR(pR0Logger)
1451 || !VALID_PTR(pR0Logger + 1)
1452 || pLogger->u32Magic != RTLOGGER_MAGIC
1453 || cchBuf < 2)
1454 return 0;
1455
1456 static const char s_szHex[17] = "0123456789abcdef";
1457 VMCPUID const idCpu = pR0Logger->idCpu;
1458 pchBuf[1] = s_szHex[ idCpu & 15];
1459 pchBuf[0] = s_szHex[(idCpu >> 4) & 15];
1460
1461 return 2;
1462#else
1463 return 0;
1464#endif
1465}
1466
1467#ifdef LOG_ENABLED
1468
1469/**
1470 * Disables flushing of the ring-0 debug log.
1471 *
1472 * @param pVCpu Pointer to the VMCPU.
1473 */
1474VMMR0DECL(void) VMMR0LogFlushDisable(PVMCPU pVCpu)
1475{
1476 if (pVCpu->vmm.s.pR0LoggerR0)
1477 pVCpu->vmm.s.pR0LoggerR0->fFlushingDisabled = true;
1478}
1479
1480
1481/**
1482 * Enables flushing of the ring-0 debug log.
1483 *
1484 * @param pVCpu Pointer to the VMCPU.
1485 */
1486VMMR0DECL(void) VMMR0LogFlushEnable(PVMCPU pVCpu)
1487{
1488 if (pVCpu->vmm.s.pR0LoggerR0)
1489 pVCpu->vmm.s.pR0LoggerR0->fFlushingDisabled = false;
1490}
1491
1492
1493/**
1494 * Checks if log flushing is disabled or not.
1495 *
1496 * @param pVCpu Pointer to the VMCPU.
1497 */
1498VMMR0DECL(bool) VMMR0IsLogFlushDisabled(PVMCPU pVCpu)
1499{
1500 if (pVCpu->vmm.s.pR0LoggerR0)
1501 return pVCpu->vmm.s.pR0LoggerR0->fFlushingDisabled;
1502 return true;
1503}
1504#endif /* LOG_ENABLED */
1505
1506/**
1507 * Jump back to ring-3 if we're the EMT and the longjmp is armed.
1508 *
1509 * @returns true if the breakpoint should be hit, false if it should be ignored.
1510 */
1511DECLEXPORT(bool) RTCALL RTAssertShouldPanic(void)
1512{
1513#if 0
1514 return true;
1515#else
1516 PVM pVM = GVMMR0GetVMByEMT(NIL_RTNATIVETHREAD);
1517 if (pVM)
1518 {
1519 PVMCPU pVCpu = VMMGetCpu(pVM);
1520
1521 if (pVCpu)
1522 {
1523#ifdef RT_ARCH_X86
1524 if ( pVCpu->vmm.s.CallRing3JmpBufR0.eip
1525 && !pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call)
1526#else
1527 if ( pVCpu->vmm.s.CallRing3JmpBufR0.rip
1528 && !pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call)
1529#endif
1530 {
1531 int rc = VMMRZCallRing3(pVM, pVCpu, VMMCALLRING3_VM_R0_ASSERTION, 0);
1532 return RT_FAILURE_NP(rc);
1533 }
1534 }
1535 }
1536#ifdef RT_OS_LINUX
1537 return true;
1538#else
1539 return false;
1540#endif
1541#endif
1542}
1543
1544
1545/**
1546 * Override this so we can push it up to ring-3.
1547 *
1548 * @param pszExpr Expression. Can be NULL.
1549 * @param uLine Location line number.
1550 * @param pszFile Location file name.
1551 * @param pszFunction Location function name.
1552 */
1553DECLEXPORT(void) RTCALL RTAssertMsg1Weak(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
1554{
1555 /*
1556 * To the log.
1557 */
1558 LogAlways(("\n!!R0-Assertion Failed!!\n"
1559 "Expression: %s\n"
1560 "Location : %s(%d) %s\n",
1561 pszExpr, pszFile, uLine, pszFunction));
1562
1563 /*
1564 * To the global VMM buffer.
1565 */
1566 PVM pVM = GVMMR0GetVMByEMT(NIL_RTNATIVETHREAD);
1567 if (pVM)
1568 RTStrPrintf(pVM->vmm.s.szRing0AssertMsg1, sizeof(pVM->vmm.s.szRing0AssertMsg1),
1569 "\n!!R0-Assertion Failed!!\n"
1570 "Expression: %s\n"
1571 "Location : %s(%d) %s\n",
1572 pszExpr, pszFile, uLine, pszFunction);
1573
1574 /*
1575 * Continue the normal way.
1576 */
1577 RTAssertMsg1(pszExpr, uLine, pszFile, pszFunction);
1578}
1579
1580
1581/**
1582 * Callback for RTLogFormatV which writes to the ring-3 log port.
1583 * See PFNLOGOUTPUT() for details.
1584 */
1585static DECLCALLBACK(size_t) rtLogOutput(void *pv, const char *pachChars, size_t cbChars)
1586{
1587 for (size_t i = 0; i < cbChars; i++)
1588 LogAlways(("%c", pachChars[i]));
1589
1590 NOREF(pv);
1591 return cbChars;
1592}
1593
1594
1595/**
1596 * Override this so we can push it up to ring-3.
1597 *
1598 * @param pszFormat The format string.
1599 * @param va Arguments.
1600 */
1601DECLEXPORT(void) RTCALL RTAssertMsg2WeakV(const char *pszFormat, va_list va)
1602{
1603 va_list vaCopy;
1604
1605 /*
1606 * Push the message to the logger.
1607 */
1608 PRTLOGGER pLog = RTLogDefaultInstance(); /** @todo we want this for release as well! */
1609 if (pLog)
1610 {
1611 va_copy(vaCopy, va);
1612 RTLogFormatV(rtLogOutput, pLog, pszFormat, vaCopy);
1613 va_end(vaCopy);
1614 }
1615
1616 /*
1617 * Push it to the global VMM buffer.
1618 */
1619 PVM pVM = GVMMR0GetVMByEMT(NIL_RTNATIVETHREAD);
1620 if (pVM)
1621 {
1622 va_copy(vaCopy, va);
1623 RTStrPrintfV(pVM->vmm.s.szRing0AssertMsg2, sizeof(pVM->vmm.s.szRing0AssertMsg2), pszFormat, vaCopy);
1624 va_end(vaCopy);
1625 }
1626
1627 /*
1628 * Continue the normal way.
1629 */
1630 RTAssertMsg2V(pszFormat, va);
1631}
1632
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