VirtualBox

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

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

VMM: Must flush changes pending in the handy page array before freeing memory. There may be requests to free shared pages in there, esp. in a guest shutdown scenario.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 54.9 KB
Line 
1/* $Id: VMMR0.cpp 43047 2012-08-28 14:47:29Z vboxsync $ */
2/** @file
3 * VMM - Host Context Ring 0.
4 */
5
6/*
7 * Copyright (C) 2006-2011 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/hwaccm.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, HWACCM, 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 = HWACCMR0Init();
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#ifdef VBOX_WITH_PCI_PASSTHROUGH
169 PciRawR0Term();
170#endif
171 }
172 IntNetR0Term();
173 }
174#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
175 PGMR0DynMapTerm();
176#endif
177 }
178 PGMDeregisterStringFormatTypes();
179 }
180 HWACCMR0Term();
181 }
182 GMMR0Term();
183 }
184 GVMMR0Term();
185 }
186 vmmTermFormatTypes();
187 }
188
189 LogFlow(("ModuleInit: failed %Rrc\n", rc));
190 return rc;
191}
192
193
194/**
195 * Terminate the module.
196 * This is called when we're finally unloaded.
197 *
198 * @param hMod Image handle for use in APIs.
199 */
200DECLEXPORT(void) ModuleTerm(void *hMod)
201{
202 LogFlow(("ModuleTerm:\n"));
203
204 /*
205 * Terminate the CPUM module (Local APIC cleanup).
206 */
207 CPUMR0ModuleTerm();
208
209 /*
210 * Terminate the internal network service.
211 */
212 IntNetR0Term();
213
214 /*
215 * PGM (Darwin), HWACCM and PciRaw global cleanup.
216 */
217#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
218 PGMR0DynMapTerm();
219#endif
220#ifdef VBOX_WITH_PCI_PASSTHROUGH
221 PciRawR0Term();
222#endif
223 PGMDeregisterStringFormatTypes();
224 HWACCMR0Term();
225#ifdef VBOX_WITH_TRIPLE_FAULT_HACK
226 vmmR0TripleFaultHackTerm();
227#endif
228
229 /*
230 * Destroy the GMM and GVMM instances.
231 */
232 GMMR0Term();
233 GVMMR0Term();
234
235 vmmTermFormatTypes();
236
237 LogFlow(("ModuleTerm: returns\n"));
238}
239
240
241/**
242 * Initiates the R0 driver for a particular VM instance.
243 *
244 * @returns VBox status code.
245 *
246 * @param pVM Pointer to the VM.
247 * @param uSvnRev The SVN revision of the ring-3 part.
248 * @thread EMT.
249 */
250static int vmmR0InitVM(PVM pVM, uint32_t uSvnRev)
251{
252 /*
253 * Match the SVN revisions.
254 */
255 if (uSvnRev != VMMGetSvnRev())
256 {
257 LogRel(("VMMR0InitVM: Revision mismatch, r3=%d r0=%d\n", uSvnRev, VMMGetSvnRev()));
258 SUPR0Printf("VMMR0InitVM: Revision mismatch, r3=%d r0=%d\n", uSvnRev, VMMGetSvnRev());
259 return VERR_VMM_R0_VERSION_MISMATCH;
260 }
261 if ( !VALID_PTR(pVM)
262 || pVM->pVMR0 != pVM)
263 return VERR_INVALID_PARAMETER;
264
265#ifdef LOG_ENABLED
266 /*
267 * Register the EMT R0 logger instance for VCPU 0.
268 */
269 PVMCPU pVCpu = &pVM->aCpus[0];
270
271 PVMMR0LOGGER pR0Logger = pVCpu->vmm.s.pR0LoggerR0;
272 if (pR0Logger)
273 {
274# if 0 /* testing of the logger. */
275 LogCom(("vmmR0InitVM: before %p\n", RTLogDefaultInstance()));
276 LogCom(("vmmR0InitVM: pfnFlush=%p actual=%p\n", pR0Logger->Logger.pfnFlush, vmmR0LoggerFlush));
277 LogCom(("vmmR0InitVM: pfnLogger=%p actual=%p\n", pR0Logger->Logger.pfnLogger, vmmR0LoggerWrapper));
278 LogCom(("vmmR0InitVM: offScratch=%d fFlags=%#x fDestFlags=%#x\n", pR0Logger->Logger.offScratch, pR0Logger->Logger.fFlags, pR0Logger->Logger.fDestFlags));
279
280 RTLogSetDefaultInstanceThread(&pR0Logger->Logger, (uintptr_t)pVM->pSession);
281 LogCom(("vmmR0InitVM: after %p reg\n", RTLogDefaultInstance()));
282 RTLogSetDefaultInstanceThread(NULL, pVM->pSession);
283 LogCom(("vmmR0InitVM: after %p dereg\n", RTLogDefaultInstance()));
284
285 pR0Logger->Logger.pfnLogger("hello ring-0 logger\n");
286 LogCom(("vmmR0InitVM: returned successfully from direct logger call.\n"));
287 pR0Logger->Logger.pfnFlush(&pR0Logger->Logger);
288 LogCom(("vmmR0InitVM: returned successfully from direct flush call.\n"));
289
290 RTLogSetDefaultInstanceThread(&pR0Logger->Logger, (uintptr_t)pVM->pSession);
291 LogCom(("vmmR0InitVM: after %p reg2\n", RTLogDefaultInstance()));
292 pR0Logger->Logger.pfnLogger("hello ring-0 logger\n");
293 LogCom(("vmmR0InitVM: returned successfully from direct logger call (2). offScratch=%d\n", pR0Logger->Logger.offScratch));
294 RTLogSetDefaultInstanceThread(NULL, pVM->pSession);
295 LogCom(("vmmR0InitVM: after %p dereg2\n", RTLogDefaultInstance()));
296
297 RTLogLoggerEx(&pR0Logger->Logger, 0, ~0U, "hello ring-0 logger (RTLogLoggerEx)\n");
298 LogCom(("vmmR0InitVM: RTLogLoggerEx returned fine offScratch=%d\n", pR0Logger->Logger.offScratch));
299
300 RTLogSetDefaultInstanceThread(&pR0Logger->Logger, (uintptr_t)pVM->pSession);
301 RTLogPrintf("hello ring-0 logger (RTLogPrintf)\n");
302 LogCom(("vmmR0InitVM: RTLogPrintf returned fine offScratch=%d\n", pR0Logger->Logger.offScratch));
303# endif
304 Log(("Switching to per-thread logging instance %p (key=%p)\n", &pR0Logger->Logger, pVM->pSession));
305 RTLogSetDefaultInstanceThread(&pR0Logger->Logger, (uintptr_t)pVM->pSession);
306 pR0Logger->fRegistered = true;
307 }
308#endif /* LOG_ENABLED */
309
310 /*
311 * Check if the host supports high resolution timers or not.
312 */
313 if ( pVM->vmm.s.fUsePeriodicPreemptionTimers
314 && !RTTimerCanDoHighResolution())
315 pVM->vmm.s.fUsePeriodicPreemptionTimers = false;
316
317 /*
318 * Initialize the per VM data for GVMM and GMM.
319 */
320 int rc = GVMMR0InitVM(pVM);
321// if (RT_SUCCESS(rc))
322// rc = GMMR0InitPerVMData(pVM);
323 if (RT_SUCCESS(rc))
324 {
325 /*
326 * Init HWACCM, CPUM and PGM (Darwin only).
327 */
328 rc = HWACCMR0InitVM(pVM);
329 if (RT_SUCCESS(rc))
330 {
331 rc = CPUMR0Init(pVM); /** @todo rename to CPUMR0InitVM */
332 if (RT_SUCCESS(rc))
333 {
334#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
335 rc = PGMR0DynMapInitVM(pVM);
336#endif
337 if (RT_SUCCESS(rc))
338 {
339#ifdef VBOX_WITH_PCI_PASSTHROUGH
340 rc = PciRawR0InitVM(pVM);
341#endif
342 if (RT_SUCCESS(rc))
343 {
344 GVMMR0DoneInitVM(pVM);
345 return rc;
346 }
347 }
348
349 /* bail out */
350 }
351#ifdef VBOX_WITH_PCI_PASSTHROUGH
352 PciRawR0TermVM(pVM);
353#endif
354 HWACCMR0TermVM(pVM);
355 }
356 }
357
358
359 RTLogSetDefaultInstanceThread(NULL, (uintptr_t)pVM->pSession);
360 return rc;
361}
362
363
364/**
365 * Terminates the R0 bits for a particular VM instance.
366 *
367 * This is normally called by ring-3 as part of the VM termination process, but
368 * may alternatively be called during the support driver session cleanup when
369 * the VM object is destroyed (see GVMM).
370 *
371 * @returns VBox status code.
372 *
373 * @param pVM Pointer to the VM.
374 * @param pGVM Pointer to the global VM structure. Optional.
375 * @thread EMT or session clean up thread.
376 */
377VMMR0DECL(int) VMMR0TermVM(PVM pVM, PGVM pGVM)
378{
379#ifdef VBOX_WITH_PCI_PASSTHROUGH
380 PciRawR0TermVM(pVM);
381#endif
382
383
384 /*
385 * Tell GVMM what we're up to and check that we only do this once.
386 */
387 if (GVMMR0DoingTermVM(pVM, pGVM))
388 {
389 /** @todo I wish to call PGMR0PhysFlushHandyPages(pVM, &pVM->aCpus[idCpu])
390 * here to make sure we don't leak any shared pages if we crash... */
391#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
392 PGMR0DynMapTermVM(pVM);
393#endif
394 HWACCMR0TermVM(pVM);
395 }
396
397 /*
398 * Deregister the logger.
399 */
400 RTLogSetDefaultInstanceThread(NULL, (uintptr_t)pVM->pSession);
401 return VINF_SUCCESS;
402}
403
404
405#ifdef VBOX_WITH_STATISTICS
406/**
407 * Record return code statistics
408 * @param pVM Pointer to the VM.
409 * @param pVCpu Pointer to the VMCPU.
410 * @param rc The status code.
411 */
412static void vmmR0RecordRC(PVM pVM, PVMCPU pVCpu, int rc)
413{
414 /*
415 * Collect statistics.
416 */
417 switch (rc)
418 {
419 case VINF_SUCCESS:
420 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetNormal);
421 break;
422 case VINF_EM_RAW_INTERRUPT:
423 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetInterrupt);
424 break;
425 case VINF_EM_RAW_INTERRUPT_HYPER:
426 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetInterruptHyper);
427 break;
428 case VINF_EM_RAW_GUEST_TRAP:
429 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetGuestTrap);
430 break;
431 case VINF_EM_RAW_RING_SWITCH:
432 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetRingSwitch);
433 break;
434 case VINF_EM_RAW_RING_SWITCH_INT:
435 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetRingSwitchInt);
436 break;
437 case VINF_EM_RAW_STALE_SELECTOR:
438 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetStaleSelector);
439 break;
440 case VINF_EM_RAW_IRET_TRAP:
441 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetIRETTrap);
442 break;
443 case VINF_IOM_R3_IOPORT_READ:
444 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetIORead);
445 break;
446 case VINF_IOM_R3_IOPORT_WRITE:
447 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetIOWrite);
448 break;
449 case VINF_IOM_R3_MMIO_READ:
450 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetMMIORead);
451 break;
452 case VINF_IOM_R3_MMIO_WRITE:
453 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetMMIOWrite);
454 break;
455 case VINF_IOM_R3_MMIO_READ_WRITE:
456 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetMMIOReadWrite);
457 break;
458 case VINF_PATM_HC_MMIO_PATCH_READ:
459 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetMMIOPatchRead);
460 break;
461 case VINF_PATM_HC_MMIO_PATCH_WRITE:
462 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetMMIOPatchWrite);
463 break;
464 case VINF_EM_RAW_EMULATE_INSTR:
465 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetEmulate);
466 break;
467 case VINF_EM_RAW_EMULATE_IO_BLOCK:
468 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetIOBlockEmulate);
469 break;
470 case VINF_PATCH_EMULATE_INSTR:
471 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPatchEmulate);
472 break;
473 case VINF_EM_RAW_EMULATE_INSTR_LDT_FAULT:
474 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetLDTFault);
475 break;
476 case VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT:
477 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetGDTFault);
478 break;
479 case VINF_EM_RAW_EMULATE_INSTR_IDT_FAULT:
480 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetIDTFault);
481 break;
482 case VINF_EM_RAW_EMULATE_INSTR_TSS_FAULT:
483 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetTSSFault);
484 break;
485 case VINF_EM_RAW_EMULATE_INSTR_PD_FAULT:
486 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPDFault);
487 break;
488 case VINF_CSAM_PENDING_ACTION:
489 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetCSAMTask);
490 break;
491 case VINF_PGM_SYNC_CR3:
492 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetSyncCR3);
493 break;
494 case VINF_PATM_PATCH_INT3:
495 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPatchInt3);
496 break;
497 case VINF_PATM_PATCH_TRAP_PF:
498 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPatchPF);
499 break;
500 case VINF_PATM_PATCH_TRAP_GP:
501 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPatchGP);
502 break;
503 case VINF_PATM_PENDING_IRQ_AFTER_IRET:
504 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPatchIretIRQ);
505 break;
506 case VINF_EM_RESCHEDULE_REM:
507 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetRescheduleREM);
508 break;
509 case VINF_EM_RAW_TO_R3:
510 if (VM_FF_ISPENDING(pVM, VM_FF_TM_VIRTUAL_SYNC))
511 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3TMVirt);
512 else if (VM_FF_ISPENDING(pVM, VM_FF_PGM_NEED_HANDY_PAGES))
513 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3HandyPages);
514 else if (VM_FF_ISPENDING(pVM, VM_FF_PDM_QUEUES))
515 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3PDMQueues);
516 else if (VM_FF_ISPENDING(pVM, VM_FF_EMT_RENDEZVOUS))
517 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3Rendezvous);
518 else if (VM_FF_ISPENDING(pVM, VM_FF_PDM_DMA))
519 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3DMA);
520 else if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_TIMER))
521 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3Timer);
522 else if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PDM_CRITSECT))
523 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3CritSect);
524 else if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_TO_R3))
525 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3);
526 else
527 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetToR3Unknown);
528 break;
529
530 case VINF_EM_RAW_TIMER_PENDING:
531 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetTimerPending);
532 break;
533 case VINF_EM_RAW_INTERRUPT_PENDING:
534 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetInterruptPending);
535 break;
536 case VINF_VMM_CALL_HOST:
537 switch (pVCpu->vmm.s.enmCallRing3Operation)
538 {
539 case VMMCALLRING3_PDM_CRIT_SECT_ENTER:
540 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallPDMCritSectEnter);
541 break;
542 case VMMCALLRING3_PDM_LOCK:
543 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallPDMLock);
544 break;
545 case VMMCALLRING3_PGM_POOL_GROW:
546 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallPGMPoolGrow);
547 break;
548 case VMMCALLRING3_PGM_LOCK:
549 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallPGMLock);
550 break;
551 case VMMCALLRING3_PGM_MAP_CHUNK:
552 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallPGMMapChunk);
553 break;
554 case VMMCALLRING3_PGM_ALLOCATE_HANDY_PAGES:
555 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallPGMAllocHandy);
556 break;
557 case VMMCALLRING3_REM_REPLAY_HANDLER_NOTIFICATIONS:
558 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallRemReplay);
559 break;
560 case VMMCALLRING3_VMM_LOGGER_FLUSH:
561 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallLogFlush);
562 break;
563 case VMMCALLRING3_VM_SET_ERROR:
564 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallVMSetError);
565 break;
566 case VMMCALLRING3_VM_SET_RUNTIME_ERROR:
567 STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallVMSetRuntimeError);
568 break;
569 case VMMCALLRING3_VM_R0_ASSERTION:
570 default:
571 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetCallRing3);
572 break;
573 }
574 break;
575 case VINF_PATM_DUPLICATE_FUNCTION:
576 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPATMDuplicateFn);
577 break;
578 case VINF_PGM_CHANGE_MODE:
579 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPGMChangeMode);
580 break;
581 case VINF_PGM_POOL_FLUSH_PENDING:
582 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPGMFlushPending);
583 break;
584 case VINF_EM_PENDING_REQUEST:
585 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPendingRequest);
586 break;
587 case VINF_EM_HWACCM_PATCH_TPR_INSTR:
588 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetPatchTPR);
589 break;
590 default:
591 STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetMisc);
592 break;
593 }
594}
595#endif /* VBOX_WITH_STATISTICS */
596
597
598/**
599 * Unused ring-0 entry point that used to be called from the interrupt gate.
600 *
601 * Will be removed one of the next times we do a major SUPDrv version bump.
602 *
603 * @returns VBox status code.
604 * @param pVM Pointer to the VM.
605 * @param enmOperation Which operation to execute.
606 * @param pvArg Argument to the operation.
607 * @remarks Assume called with interrupts disabled.
608 */
609VMMR0DECL(int) VMMR0EntryInt(PVM pVM, VMMR0OPERATION enmOperation, void *pvArg)
610{
611 /*
612 * We're returning VERR_NOT_SUPPORT here so we've got something else
613 * than -1 which the interrupt gate glue code might return.
614 */
615 Log(("operation %#x is not supported\n", enmOperation));
616 NOREF(enmOperation); NOREF(pvArg); NOREF(pVM);
617 return VERR_NOT_SUPPORTED;
618}
619
620
621/**
622 * The Ring 0 entry point, called by the fast-ioctl path.
623 *
624 * @param pVM Pointer to the VM.
625 * The return code is stored in pVM->vmm.s.iLastGZRc.
626 * @param idCpu The Virtual CPU ID of the calling EMT.
627 * @param enmOperation Which operation to execute.
628 * @remarks Assume called with interrupts _enabled_.
629 */
630VMMR0DECL(void) VMMR0EntryFast(PVM pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation)
631{
632 if (RT_UNLIKELY(idCpu >= pVM->cCpus))
633 return;
634 PVMCPU pVCpu = &pVM->aCpus[idCpu];
635
636 switch (enmOperation)
637 {
638 /*
639 * Switch to GC and run guest raw mode code.
640 * Disable interrupts before doing the world switch.
641 */
642 case VMMR0_DO_RAW_RUN:
643 {
644 /* Some safety precautions first. */
645#ifndef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
646 if (RT_LIKELY( !pVM->vmm.s.fSwitcherDisabled /* hwaccm */
647 && pVM->cCpus == 1 /* !smp */
648 && PGMGetHyperCR3(pVCpu)))
649#else
650 if (RT_LIKELY( !pVM->vmm.s.fSwitcherDisabled
651 && pVM->cCpus == 1))
652#endif
653 {
654 /* Disable preemption and update the periodic preemption timer. */
655 RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
656 RTThreadPreemptDisable(&PreemptState);
657 RTCPUID idHostCpu = RTMpCpuId();
658#ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
659 CPUMR0SetLApic(pVM, idHostCpu);
660#endif
661 ASMAtomicWriteU32(&pVCpu->idHostCpu, idHostCpu);
662 if (pVM->vmm.s.fUsePeriodicPreemptionTimers)
663 GVMMR0SchedUpdatePeriodicPreemptionTimer(pVM, pVCpu->idHostCpu, TMCalcHostTimerFrequency(pVM, pVCpu));
664
665 /* We might need to disable VT-x if the active switcher turns off paging. */
666 bool fVTxDisabled;
667 int rc = HWACCMR0EnterSwitcher(pVM, &fVTxDisabled);
668 if (RT_SUCCESS(rc))
669 {
670 RTCCUINTREG uFlags = ASMIntDisableFlags();
671
672 for (;;)
673 {
674 VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC);
675 TMNotifyStartOfExecution(pVCpu);
676
677 rc = pVM->vmm.s.pfnR0ToRawMode(pVM);
678 pVCpu->vmm.s.iLastGZRc = rc;
679
680 TMNotifyEndOfExecution(pVCpu);
681 VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED);
682
683 if (rc != VINF_VMM_CALL_TRACER)
684 break;
685 SUPR0TracerUmodProbeFire(pVM->pSession, &pVCpu->vmm.s.TracerCtx);
686 }
687
688 /* Re-enable VT-x if previously turned off. */
689 HWACCMR0LeaveSwitcher(pVM, fVTxDisabled);
690
691 if ( rc == VINF_EM_RAW_INTERRUPT
692 || rc == VINF_EM_RAW_INTERRUPT_HYPER)
693 TRPMR0DispatchHostInterrupt(pVM);
694
695 ASMSetFlags(uFlags);
696
697#ifdef VBOX_WITH_STATISTICS
698 STAM_COUNTER_INC(&pVM->vmm.s.StatRunRC);
699 vmmR0RecordRC(pVM, pVCpu, rc);
700#endif
701 }
702 else
703 pVCpu->vmm.s.iLastGZRc = rc;
704 ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
705 RTThreadPreemptRestore(&PreemptState);
706 }
707 else
708 {
709 Assert(!pVM->vmm.s.fSwitcherDisabled);
710 pVCpu->vmm.s.iLastGZRc = VERR_NOT_SUPPORTED;
711 if (pVM->cCpus != 1)
712 pVCpu->vmm.s.iLastGZRc = VERR_RAW_MODE_INVALID_SMP;
713#ifndef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
714 if (!PGMGetHyperCR3(pVCpu))
715 pVCpu->vmm.s.iLastGZRc = VERR_PGM_NO_CR3_SHADOW_ROOT;
716#endif
717 }
718 break;
719 }
720
721 /*
722 * Run guest code using the available hardware acceleration technology.
723 *
724 * Disable interrupts before we do anything interesting. On Windows we avoid
725 * this by having the support driver raise the IRQL before calling us, this way
726 * we hope to get away with page faults and later calling into the kernel.
727 */
728 case VMMR0_DO_HWACC_RUN:
729 {
730#ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
731 RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
732 RTThreadPreemptDisable(&PreemptState);
733#elif !defined(RT_OS_WINDOWS)
734 RTCCUINTREG uFlags = ASMIntDisableFlags();
735#endif
736 ASMAtomicWriteU32(&pVCpu->idHostCpu, RTMpCpuId());
737 if (pVM->vmm.s.fUsePeriodicPreemptionTimers)
738 GVMMR0SchedUpdatePeriodicPreemptionTimer(pVM, pVCpu->idHostCpu, TMCalcHostTimerFrequency(pVM, pVCpu));
739
740#ifdef LOG_ENABLED
741 if (pVCpu->idCpu > 0)
742 {
743 /* Lazy registration of ring 0 loggers. */
744 PVMMR0LOGGER pR0Logger = pVCpu->vmm.s.pR0LoggerR0;
745 if ( pR0Logger
746 && !pR0Logger->fRegistered)
747 {
748 RTLogSetDefaultInstanceThread(&pR0Logger->Logger, (uintptr_t)pVM->pSession);
749 pR0Logger->fRegistered = true;
750 }
751 }
752#endif
753 int rc;
754 if (!HWACCMR0SuspendPending())
755 {
756 rc = HWACCMR0Enter(pVM, pVCpu);
757 if (RT_SUCCESS(rc))
758 {
759 rc = vmmR0CallRing3SetJmp(&pVCpu->vmm.s.CallRing3JmpBufR0, HWACCMR0RunGuestCode, pVM, pVCpu); /* this may resume code. */
760 int rc2 = HWACCMR0Leave(pVM, pVCpu);
761 AssertRC(rc2);
762 }
763 STAM_COUNTER_INC(&pVM->vmm.s.StatRunRC);
764 }
765 else
766 {
767 /* System is about to go into suspend mode; go back to ring 3. */
768 rc = VINF_EM_RAW_INTERRUPT;
769 }
770 pVCpu->vmm.s.iLastGZRc = rc;
771
772 ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
773#ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
774 RTThreadPreemptRestore(&PreemptState);
775#elif !defined(RT_OS_WINDOWS)
776 ASMSetFlags(uFlags);
777#endif
778
779#ifdef VBOX_WITH_STATISTICS
780 vmmR0RecordRC(pVM, pVCpu, rc);
781#endif
782 /* No special action required for external interrupts, just return. */
783 break;
784 }
785
786 /*
787 * For profiling.
788 */
789 case VMMR0_DO_NOP:
790 pVCpu->vmm.s.iLastGZRc = VINF_SUCCESS;
791 break;
792
793 /*
794 * Impossible.
795 */
796 default:
797 AssertMsgFailed(("%#x\n", enmOperation));
798 pVCpu->vmm.s.iLastGZRc = VERR_NOT_SUPPORTED;
799 break;
800 }
801}
802
803
804/**
805 * Validates a session or VM session argument.
806 *
807 * @returns true / false accordingly.
808 * @param pVM Pointer to the VM.
809 * @param pSession The session argument.
810 */
811DECLINLINE(bool) vmmR0IsValidSession(PVM pVM, PSUPDRVSESSION pClaimedSession, PSUPDRVSESSION pSession)
812{
813 /* This must be set! */
814 if (!pSession)
815 return false;
816
817 /* Only one out of the two. */
818 if (pVM && pClaimedSession)
819 return false;
820 if (pVM)
821 pClaimedSession = pVM->pSession;
822 return pClaimedSession == pSession;
823}
824
825
826/**
827 * VMMR0EntryEx worker function, either called directly or when ever possible
828 * called thru a longjmp so we can exit safely on failure.
829 *
830 * @returns VBox status code.
831 * @param pVM Pointer to the VM.
832 * @param idCpu Virtual CPU ID argument. Must be NIL_VMCPUID if pVM
833 * is NIL_RTR0PTR, and may be NIL_VMCPUID if it isn't
834 * @param enmOperation Which operation to execute.
835 * @param pReqHdr This points to a SUPVMMR0REQHDR packet. Optional.
836 * The support driver validates this if it's present.
837 * @param u64Arg Some simple constant argument.
838 * @param pSession The session of the caller.
839 * @remarks Assume called with interrupts _enabled_.
840 */
841static int vmmR0EntryExWorker(PVM pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation, PSUPVMMR0REQHDR pReqHdr, uint64_t u64Arg, PSUPDRVSESSION pSession)
842{
843 /*
844 * Common VM pointer validation.
845 */
846 if (pVM)
847 {
848 if (RT_UNLIKELY( !VALID_PTR(pVM)
849 || ((uintptr_t)pVM & PAGE_OFFSET_MASK)))
850 {
851 SUPR0Printf("vmmR0EntryExWorker: Invalid pVM=%p! (op=%d)\n", pVM, enmOperation);
852 return VERR_INVALID_POINTER;
853 }
854 if (RT_UNLIKELY( pVM->enmVMState < VMSTATE_CREATING
855 || pVM->enmVMState > VMSTATE_TERMINATED
856 || pVM->pVMR0 != pVM))
857 {
858 SUPR0Printf("vmmR0EntryExWorker: Invalid pVM=%p:{enmVMState=%d, .pVMR0=%p}! (op=%d)\n",
859 pVM, pVM->enmVMState, pVM->pVMR0, enmOperation);
860 return VERR_INVALID_POINTER;
861 }
862
863 if (RT_UNLIKELY(idCpu >= pVM->cCpus && idCpu != NIL_VMCPUID))
864 {
865 SUPR0Printf("vmmR0EntryExWorker: Invalid idCpu (%u vs cCpus=%u)\n", idCpu, pVM->cCpus);
866 return VERR_INVALID_PARAMETER;
867 }
868 }
869 else if (RT_UNLIKELY(idCpu != NIL_VMCPUID))
870 {
871 SUPR0Printf("vmmR0EntryExWorker: Invalid idCpu=%u\n", idCpu);
872 return VERR_INVALID_PARAMETER;
873 }
874
875
876 switch (enmOperation)
877 {
878 /*
879 * GVM requests
880 */
881 case VMMR0_DO_GVMM_CREATE_VM:
882 if (pVM || u64Arg || idCpu != NIL_VMCPUID)
883 return VERR_INVALID_PARAMETER;
884 return GVMMR0CreateVMReq((PGVMMCREATEVMREQ)pReqHdr);
885
886 case VMMR0_DO_GVMM_DESTROY_VM:
887 if (pReqHdr || u64Arg)
888 return VERR_INVALID_PARAMETER;
889 return GVMMR0DestroyVM(pVM);
890
891 case VMMR0_DO_GVMM_REGISTER_VMCPU:
892 {
893 if (!pVM)
894 return VERR_INVALID_PARAMETER;
895 return GVMMR0RegisterVCpu(pVM, idCpu);
896 }
897
898 case VMMR0_DO_GVMM_SCHED_HALT:
899 if (pReqHdr)
900 return VERR_INVALID_PARAMETER;
901 return GVMMR0SchedHalt(pVM, idCpu, u64Arg);
902
903 case VMMR0_DO_GVMM_SCHED_WAKE_UP:
904 if (pReqHdr || u64Arg)
905 return VERR_INVALID_PARAMETER;
906 return GVMMR0SchedWakeUp(pVM, idCpu);
907
908 case VMMR0_DO_GVMM_SCHED_POKE:
909 if (pReqHdr || u64Arg)
910 return VERR_INVALID_PARAMETER;
911 return GVMMR0SchedPoke(pVM, idCpu);
912
913 case VMMR0_DO_GVMM_SCHED_WAKE_UP_AND_POKE_CPUS:
914 if (u64Arg)
915 return VERR_INVALID_PARAMETER;
916 return GVMMR0SchedWakeUpAndPokeCpusReq(pVM, (PGVMMSCHEDWAKEUPANDPOKECPUSREQ)pReqHdr);
917
918 case VMMR0_DO_GVMM_SCHED_POLL:
919 if (pReqHdr || u64Arg > 1)
920 return VERR_INVALID_PARAMETER;
921 return GVMMR0SchedPoll(pVM, idCpu, !!u64Arg);
922
923 case VMMR0_DO_GVMM_QUERY_STATISTICS:
924 if (u64Arg)
925 return VERR_INVALID_PARAMETER;
926 return GVMMR0QueryStatisticsReq(pVM, (PGVMMQUERYSTATISTICSSREQ)pReqHdr);
927
928 case VMMR0_DO_GVMM_RESET_STATISTICS:
929 if (u64Arg)
930 return VERR_INVALID_PARAMETER;
931 return GVMMR0ResetStatisticsReq(pVM, (PGVMMRESETSTATISTICSSREQ)pReqHdr);
932
933 /*
934 * Initialize the R0 part of a VM instance.
935 */
936 case VMMR0_DO_VMMR0_INIT:
937 return vmmR0InitVM(pVM, (uint32_t)u64Arg);
938
939 /*
940 * Terminate the R0 part of a VM instance.
941 */
942 case VMMR0_DO_VMMR0_TERM:
943 return VMMR0TermVM(pVM, NULL);
944
945 /*
946 * Attempt to enable hwacc mode and check the current setting.
947 */
948 case VMMR0_DO_HWACC_ENABLE:
949 return HWACCMR0EnableAllCpus(pVM);
950
951 /*
952 * Setup the hardware accelerated session.
953 */
954 case VMMR0_DO_HWACC_SETUP_VM:
955 return HWACCMR0SetupVM(pVM);
956
957 /*
958 * Switch to RC to execute Hypervisor function.
959 */
960 case VMMR0_DO_CALL_HYPERVISOR:
961 {
962 int rc;
963 bool fVTxDisabled;
964
965 /* Safety precaution as HWACCM can disable the switcher. */
966 Assert(!pVM->vmm.s.fSwitcherDisabled);
967 if (RT_UNLIKELY(pVM->vmm.s.fSwitcherDisabled))
968 return VERR_NOT_SUPPORTED;
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 = HWACCMR0EnterSwitcher(pVM, &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 HWACCMR0LeaveSwitcher(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 HWACCMR0TestSwitcher3264(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#endif /* LOG_ENABLED */
1493
1494/**
1495 * Jump back to ring-3 if we're the EMT and the longjmp is armed.
1496 *
1497 * @returns true if the breakpoint should be hit, false if it should be ignored.
1498 */
1499DECLEXPORT(bool) RTCALL RTAssertShouldPanic(void)
1500{
1501#if 0
1502 return true;
1503#else
1504 PVM pVM = GVMMR0GetVMByEMT(NIL_RTNATIVETHREAD);
1505 if (pVM)
1506 {
1507 PVMCPU pVCpu = VMMGetCpu(pVM);
1508
1509 if (pVCpu)
1510 {
1511#ifdef RT_ARCH_X86
1512 if ( pVCpu->vmm.s.CallRing3JmpBufR0.eip
1513 && !pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call)
1514#else
1515 if ( pVCpu->vmm.s.CallRing3JmpBufR0.rip
1516 && !pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call)
1517#endif
1518 {
1519 int rc = VMMRZCallRing3(pVM, pVCpu, VMMCALLRING3_VM_R0_ASSERTION, 0);
1520 return RT_FAILURE_NP(rc);
1521 }
1522 }
1523 }
1524#ifdef RT_OS_LINUX
1525 return true;
1526#else
1527 return false;
1528#endif
1529#endif
1530}
1531
1532
1533/**
1534 * Override this so we can push it up to ring-3.
1535 *
1536 * @param pszExpr Expression. Can be NULL.
1537 * @param uLine Location line number.
1538 * @param pszFile Location file name.
1539 * @param pszFunction Location function name.
1540 */
1541DECLEXPORT(void) RTCALL RTAssertMsg1Weak(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
1542{
1543 /*
1544 * To the log.
1545 */
1546 LogAlways(("\n!!R0-Assertion Failed!!\n"
1547 "Expression: %s\n"
1548 "Location : %s(%d) %s\n",
1549 pszExpr, pszFile, uLine, pszFunction));
1550
1551 /*
1552 * To the global VMM buffer.
1553 */
1554 PVM pVM = GVMMR0GetVMByEMT(NIL_RTNATIVETHREAD);
1555 if (pVM)
1556 RTStrPrintf(pVM->vmm.s.szRing0AssertMsg1, sizeof(pVM->vmm.s.szRing0AssertMsg1),
1557 "\n!!R0-Assertion Failed!!\n"
1558 "Expression: %s\n"
1559 "Location : %s(%d) %s\n",
1560 pszExpr, pszFile, uLine, pszFunction);
1561
1562 /*
1563 * Continue the normal way.
1564 */
1565 RTAssertMsg1(pszExpr, uLine, pszFile, pszFunction);
1566}
1567
1568
1569/**
1570 * Callback for RTLogFormatV which writes to the ring-3 log port.
1571 * See PFNLOGOUTPUT() for details.
1572 */
1573static DECLCALLBACK(size_t) rtLogOutput(void *pv, const char *pachChars, size_t cbChars)
1574{
1575 for (size_t i = 0; i < cbChars; i++)
1576 LogAlways(("%c", pachChars[i]));
1577
1578 NOREF(pv);
1579 return cbChars;
1580}
1581
1582
1583/**
1584 * Override this so we can push it up to ring-3.
1585 *
1586 * @param pszFormat The format string.
1587 * @param va Arguments.
1588 */
1589DECLEXPORT(void) RTCALL RTAssertMsg2WeakV(const char *pszFormat, va_list va)
1590{
1591 va_list vaCopy;
1592
1593 /*
1594 * Push the message to the logger.
1595 */
1596 PRTLOGGER pLog = RTLogDefaultInstance(); /** @todo we want this for release as well! */
1597 if (pLog)
1598 {
1599 va_copy(vaCopy, va);
1600 RTLogFormatV(rtLogOutput, pLog, pszFormat, vaCopy);
1601 va_end(vaCopy);
1602 }
1603
1604 /*
1605 * Push it to the global VMM buffer.
1606 */
1607 PVM pVM = GVMMR0GetVMByEMT(NIL_RTNATIVETHREAD);
1608 if (pVM)
1609 {
1610 va_copy(vaCopy, va);
1611 RTStrPrintfV(pVM->vmm.s.szRing0AssertMsg2, sizeof(pVM->vmm.s.szRing0AssertMsg2), pszFormat, vaCopy);
1612 va_end(vaCopy);
1613 }
1614
1615 /*
1616 * Continue the normal way.
1617 */
1618 RTAssertMsg2V(pszFormat, va);
1619}
1620
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