VirtualBox

source: vbox/trunk/src/VBox/VMM/PDMDriver.cpp@ 28425

Last change on this file since 28425 was 28425, checked in by vboxsync, 15 years ago

Added PDMDRVHLP::pfnCallR0 / PDMDrvHlpCallR0 / PFNPDMDRVREQHANDLERR0 for making it possible for a driver to call it's ring-0 side via a private interface.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 53.8 KB
Line 
1/* $Id: PDMDriver.cpp 28425 2010-04-16 18:06:35Z vboxsync $ */
2/** @file
3 * PDM - Pluggable Device and Driver Manager, Driver parts.
4 */
5
6/*
7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22
23/*******************************************************************************
24* Header Files *
25*******************************************************************************/
26#define LOG_GROUP LOG_GROUP_PDM_DRIVER
27#include "PDMInternal.h"
28#include <VBox/pdm.h>
29#include <VBox/mm.h>
30#include <VBox/cfgm.h>
31#include <VBox/vmm.h>
32#include <VBox/sup.h>
33#include <VBox/vm.h>
34#include <VBox/version.h>
35#include <VBox/err.h>
36
37#include <VBox/log.h>
38#include <iprt/assert.h>
39#include <iprt/thread.h>
40#include <iprt/string.h>
41#include <iprt/asm.h>
42#include <iprt/alloc.h>
43#include <iprt/path.h>
44
45
46/*******************************************************************************
47* Structures and Typedefs *
48*******************************************************************************/
49/**
50 * Internal callback structure pointer.
51 *
52 * The main purpose is to define the extra data we associate
53 * with PDMDRVREGCB so we can find the VM instance and so on.
54 */
55typedef struct PDMDRVREGCBINT
56{
57 /** The callback structure. */
58 PDMDRVREGCB Core;
59 /** A bit of padding. */
60 uint32_t u32[4];
61 /** VM Handle. */
62 PVM pVM;
63} PDMDRVREGCBINT, *PPDMDRVREGCBINT;
64typedef const PDMDRVREGCBINT *PCPDMDRVREGCBINT;
65
66
67/*******************************************************************************
68* Internal Functions *
69*******************************************************************************/
70static DECLCALLBACK(int) pdmR3DrvRegister(PCPDMDRVREGCB pCallbacks, PCPDMDRVREG pReg);
71static int pdmR3DrvLoad(PVM pVM, PPDMDRVREGCBINT pRegCB, const char *pszFilename, const char *pszName);
72
73
74
75/**
76 * Register external drivers
77 *
78 * @returns VBox status code.
79 * @param pVM The VM to operate on.
80 * @param pfnCallback Driver registration callback
81 */
82VMMR3DECL(int) PDMR3RegisterDrivers(PVM pVM, FNPDMVBOXDRIVERSREGISTER pfnCallback)
83{
84 /*
85 * The registration callbacks.
86 */
87 PDMDRVREGCBINT RegCB;
88 RegCB.Core.u32Version = PDM_DRVREG_CB_VERSION;
89 RegCB.Core.pfnRegister = pdmR3DrvRegister;
90 RegCB.pVM = pVM;
91
92 int rc = pfnCallback(&RegCB.Core, VBOX_VERSION);
93 if (RT_FAILURE(rc))
94 AssertMsgFailed(("VBoxDriversRegister failed with rc=%Rrc\n"));
95
96 return rc;
97}
98
99/**
100 * This function will initialize the drivers for this VM instance.
101 *
102 * First of all this mean loading the builtin drivers and letting them
103 * register themselves. Beyond that any additional driver modules are
104 * loaded and called for registration.
105 *
106 * @returns VBox status code.
107 * @param pVM VM Handle.
108 */
109int pdmR3DrvInit(PVM pVM)
110{
111 LogFlow(("pdmR3DrvInit:\n"));
112
113 AssertRelease(!(RT_OFFSETOF(PDMDRVINS, achInstanceData) & 15));
114 PPDMDRVINS pDrvInsAssert;
115 AssertRelease(sizeof(pDrvInsAssert->Internal.s) <= sizeof(pDrvInsAssert->Internal.padding));
116
117 /*
118 * The registration callbacks.
119 */
120 PDMDRVREGCBINT RegCB;
121 RegCB.Core.u32Version = PDM_DRVREG_CB_VERSION;
122 RegCB.Core.pfnRegister = pdmR3DrvRegister;
123 RegCB.pVM = pVM;
124
125 /*
126 * Load the builtin module
127 */
128 PCFGMNODE pDriversNode = CFGMR3GetChild(CFGMR3GetRoot(pVM), "PDM/Drivers");
129 bool fLoadBuiltin;
130 int rc = CFGMR3QueryBool(pDriversNode, "LoadBuiltin", &fLoadBuiltin);
131 if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT)
132 fLoadBuiltin = true;
133 else if (RT_FAILURE(rc))
134 {
135 AssertMsgFailed(("Configuration error: Querying boolean \"LoadBuiltin\" failed with %Rrc\n", rc));
136 return rc;
137 }
138 if (fLoadBuiltin)
139 {
140 /* make filename */
141 char *pszFilename = pdmR3FileR3("VBoxDD", /*fShared=*/true);
142 if (!pszFilename)
143 return VERR_NO_TMP_MEMORY;
144 rc = pdmR3DrvLoad(pVM, &RegCB, pszFilename, "VBoxDD");
145 RTMemTmpFree(pszFilename);
146 if (RT_FAILURE(rc))
147 return rc;
148 }
149
150 /*
151 * Load additional driver modules.
152 */
153 for (PCFGMNODE pCur = CFGMR3GetFirstChild(pDriversNode); pCur; pCur = CFGMR3GetNextChild(pCur))
154 {
155 /*
156 * Get the name and path.
157 */
158 char szName[PDMMOD_NAME_LEN];
159 rc = CFGMR3GetName(pCur, &szName[0], sizeof(szName));
160 if (rc == VERR_CFGM_NOT_ENOUGH_SPACE)
161 {
162 AssertMsgFailed(("configuration error: The module name is too long, cchName=%zu.\n", CFGMR3GetNameLen(pCur)));
163 return VERR_PDM_MODULE_NAME_TOO_LONG;
164 }
165 else if (RT_FAILURE(rc))
166 {
167 AssertMsgFailed(("CFGMR3GetName -> %Rrc.\n", rc));
168 return rc;
169 }
170
171 /* the path is optional, if no path the module name + path is used. */
172 char szFilename[RTPATH_MAX];
173 rc = CFGMR3QueryString(pCur, "Path", &szFilename[0], sizeof(szFilename));
174 if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT)
175 strcpy(szFilename, szName);
176 else if (RT_FAILURE(rc))
177 {
178 AssertMsgFailed(("configuration error: Failure to query the module path, rc=%Rrc.\n", rc));
179 return rc;
180 }
181
182 /* prepend path? */
183 if (!RTPathHavePath(szFilename))
184 {
185 char *psz = pdmR3FileR3(szFilename);
186 if (!psz)
187 return VERR_NO_TMP_MEMORY;
188 size_t cch = strlen(psz) + 1;
189 if (cch > sizeof(szFilename))
190 {
191 RTMemTmpFree(psz);
192 AssertMsgFailed(("Filename too long! cch=%d '%s'\n", cch, psz));
193 return VERR_FILENAME_TOO_LONG;
194 }
195 memcpy(szFilename, psz, cch);
196 RTMemTmpFree(psz);
197 }
198
199 /*
200 * Load the module and register it's drivers.
201 */
202 rc = pdmR3DrvLoad(pVM, &RegCB, szFilename, szName);
203 if (RT_FAILURE(rc))
204 return rc;
205 }
206
207 LogFlow(("pdmR3DrvInit: returns VINF_SUCCESS\n"));
208 return VINF_SUCCESS;
209}
210
211
212/**
213 * Loads one driver module and call the registration entry point.
214 *
215 * @returns VBox status code.
216 * @param pVM VM handle.
217 * @param pRegCB The registration callback stuff.
218 * @param pszFilename Module filename.
219 * @param pszName Module name.
220 */
221static int pdmR3DrvLoad(PVM pVM, PPDMDRVREGCBINT pRegCB, const char *pszFilename, const char *pszName)
222{
223 /*
224 * Load it.
225 */
226 int rc = pdmR3LoadR3U(pVM->pUVM, pszFilename, pszName);
227 if (RT_SUCCESS(rc))
228 {
229 /*
230 * Get the registration export and call it.
231 */
232 FNPDMVBOXDRIVERSREGISTER *pfnVBoxDriversRegister;
233 rc = PDMR3LdrGetSymbolR3(pVM, pszName, "VBoxDriversRegister", (void **)&pfnVBoxDriversRegister);
234 if (RT_SUCCESS(rc))
235 {
236 Log(("PDM: Calling VBoxDriversRegister (%p) of %s (%s)\n", pfnVBoxDriversRegister, pszName, pszFilename));
237 rc = pfnVBoxDriversRegister(&pRegCB->Core, VBOX_VERSION);
238 if (RT_SUCCESS(rc))
239 Log(("PDM: Successfully loaded driver module %s (%s).\n", pszName, pszFilename));
240 else
241 AssertMsgFailed(("VBoxDriversRegister failed with rc=%Rrc\n"));
242 }
243 else
244 {
245 AssertMsgFailed(("Failed to locate 'VBoxDriversRegister' in %s (%s) rc=%Rrc\n", pszName, pszFilename, rc));
246 if (rc == VERR_SYMBOL_NOT_FOUND)
247 rc = VERR_PDM_NO_REGISTRATION_EXPORT;
248 }
249 }
250 else
251 AssertMsgFailed(("Failed to load %s (%s) rc=%Rrc!\n", pszName, pszFilename, rc));
252 return rc;
253}
254
255
256/** @interface_method_impl{PDMDRVREGCB,pfnRegister} */
257static DECLCALLBACK(int) pdmR3DrvRegister(PCPDMDRVREGCB pCallbacks, PCPDMDRVREG pReg)
258{
259 /*
260 * Validate the registration structure.
261 */
262 AssertPtrReturn(pReg, VERR_INVALID_POINTER);
263 AssertMsgReturn(pReg->u32Version == PDM_DRVREG_VERSION,
264 ("%#x\n", pReg->u32Version),
265 VERR_PDM_UNKNOWN_DRVREG_VERSION);
266 AssertReturn(pReg->szName[0], VERR_PDM_INVALID_DRIVER_REGISTRATION);
267 AssertMsgReturn(memchr(pReg->szName, '\0', sizeof(pReg->szName)),
268 (".*s\n", sizeof(pReg->szName), pReg->szName),
269 VERR_PDM_INVALID_DRIVER_REGISTRATION);
270 AssertMsgReturn( !(pReg->fFlags & PDM_DRVREG_FLAGS_R0)
271 || ( pReg->szR0Mod[0]
272 && memchr(pReg->szR0Mod, '\0', sizeof(pReg->szR0Mod))),
273 ("%s: %.*s\n", pReg->szName, sizeof(pReg->szR0Mod), pReg->szR0Mod),
274 VERR_PDM_INVALID_DRIVER_REGISTRATION);
275 AssertMsgReturn( !(pReg->fFlags & PDM_DRVREG_FLAGS_RC)
276 || ( pReg->szRCMod[0]
277 && memchr(pReg->szRCMod, '\0', sizeof(pReg->szRCMod))),
278 ("%s: %.*s\n", pReg->szName, sizeof(pReg->szRCMod), pReg->szRCMod),
279 VERR_PDM_INVALID_DRIVER_REGISTRATION);
280 AssertMsgReturn(VALID_PTR(pReg->pszDescription),
281 ("%s: %p\n", pReg->szName, pReg->pszDescription),
282 VERR_PDM_INVALID_DRIVER_REGISTRATION);
283 AssertMsgReturn(!(pReg->fFlags & ~(PDM_DRVREG_FLAGS_HOST_BITS_MASK | PDM_DRVREG_FLAGS_R0 | PDM_DRVREG_FLAGS_RC)),
284 ("%s: %#x\n", pReg->szName, pReg->fFlags),
285 VERR_PDM_INVALID_DRIVER_REGISTRATION);
286 AssertMsgReturn((pReg->fFlags & PDM_DRVREG_FLAGS_HOST_BITS_MASK) == PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
287 ("%s: %#x\n", pReg->szName, pReg->fFlags),
288 VERR_PDM_INVALID_DRIVER_HOST_BITS);
289 AssertMsgReturn(pReg->cMaxInstances > 0,
290 ("%s: %#x\n", pReg->szName, pReg->cMaxInstances),
291 VERR_PDM_INVALID_DRIVER_REGISTRATION);
292 AssertMsgReturn(pReg->cbInstance <= _1M,
293 ("%s: %#x\n", pReg->szName, pReg->cbInstance),
294 VERR_PDM_INVALID_DRIVER_REGISTRATION);
295 AssertMsgReturn(VALID_PTR(pReg->pfnConstruct),
296 ("%s: %p\n", pReg->szName, pReg->pfnConstruct),
297 VERR_PDM_INVALID_DRIVER_REGISTRATION);
298 AssertMsgReturn(VALID_PTR(pReg->pfnRelocate) || !(pReg->fFlags & PDM_DRVREG_FLAGS_RC),
299 ("%s: %#x\n", pReg->szName, pReg->cbInstance),
300 VERR_PDM_INVALID_DRIVER_REGISTRATION);
301 AssertMsgReturn(pReg->pfnSoftReset == NULL,
302 ("%s: %p\n", pReg->szName, pReg->pfnSoftReset),
303 VERR_PDM_INVALID_DRIVER_REGISTRATION);
304 AssertMsgReturn(pReg->u32VersionEnd == PDM_DRVREG_VERSION,
305 ("%s: #x\n", pReg->szName, pReg->u32VersionEnd),
306 VERR_PDM_INVALID_DRIVER_REGISTRATION);
307
308 /*
309 * Check for duplicate and find FIFO entry at the same time.
310 */
311 PCPDMDRVREGCBINT pRegCB = (PCPDMDRVREGCBINT)pCallbacks;
312 PPDMDRV pDrvPrev = NULL;
313 PPDMDRV pDrv = pRegCB->pVM->pdm.s.pDrvs;
314 for (; pDrv; pDrvPrev = pDrv, pDrv = pDrv->pNext)
315 {
316 if (!strcmp(pDrv->pReg->szName, pReg->szName))
317 {
318 AssertMsgFailed(("Driver '%s' already exists\n", pReg->szName));
319 return VERR_PDM_DRIVER_NAME_CLASH;
320 }
321 }
322
323 /*
324 * Allocate new driver structure and insert it into the list.
325 */
326 pDrv = (PPDMDRV)MMR3HeapAlloc(pRegCB->pVM, MM_TAG_PDM_DRIVER, sizeof(*pDrv));
327 if (pDrv)
328 {
329 pDrv->pNext = NULL;
330 pDrv->cInstances = 0;
331 pDrv->iNextInstance = 0;
332 pDrv->pReg = pReg;
333
334 if (pDrvPrev)
335 pDrvPrev->pNext = pDrv;
336 else
337 pRegCB->pVM->pdm.s.pDrvs = pDrv;
338 Log(("PDM: Registered driver '%s'\n", pReg->szName));
339 return VINF_SUCCESS;
340 }
341 return VERR_NO_MEMORY;
342}
343
344
345/**
346 * Lookups a driver structure by name.
347 * @internal
348 */
349PPDMDRV pdmR3DrvLookup(PVM pVM, const char *pszName)
350{
351 for (PPDMDRV pDrv = pVM->pdm.s.pDrvs; pDrv; pDrv = pDrv->pNext)
352 if (!strcmp(pDrv->pReg->szName, pszName))
353 return pDrv;
354 return NULL;
355}
356
357
358/**
359 * Instantiate a driver.
360 *
361 * @returns VBox status code, including informational statuses.
362 *
363 * @param pVM The VM handle.
364 * @param pNode The CFGM node for the driver.
365 * @param pBaseInterface The base interface.
366 * @param pDrvAbove The driver above it. NULL if it's the top-most
367 * driver.
368 * @param pLun The LUN the driver is being attached to. NULL
369 * if we're instantiating a driver chain before
370 * attaching it - untested.
371 * @param ppBaseInterface Where to return the pointer to the base
372 * interface of the newly created driver.
373 *
374 * @remarks Recursive calls to this function is normal as the drivers will
375 * attach to anything below them during the pfnContruct call.
376 */
377int pdmR3DrvInstantiate(PVM pVM, PCFGMNODE pNode, PPDMIBASE pBaseInterface, PPDMDRVINS pDrvAbove,
378 PPDMLUN pLun, PPDMIBASE *ppBaseInterface)
379{
380 Assert(!pDrvAbove || !pDrvAbove->Internal.s.pDown);
381 Assert(!pDrvAbove || !pDrvAbove->pDownBase);
382
383 Assert(pBaseInterface->pfnQueryInterface(pBaseInterface, PDMIBASE_IID) == pBaseInterface);
384
385 /*
386 * Find the driver.
387 */
388 char *pszName;
389 int rc = CFGMR3QueryStringAlloc(pNode, "Driver", &pszName);
390 if (RT_SUCCESS(rc))
391 {
392 PPDMDRV pDrv = pdmR3DrvLookup(pVM, pszName);
393 MMR3HeapFree(pszName);
394 if ( pDrv
395 && pDrv->cInstances < pDrv->pReg->cMaxInstances)
396 {
397 /* config node */
398 PCFGMNODE pConfigNode = CFGMR3GetChild(pNode, "Config");
399 if (!pConfigNode)
400 rc = CFGMR3InsertNode(pNode, "Config", &pConfigNode);
401 if (RT_SUCCESS(rc))
402 {
403 CFGMR3SetRestrictedRoot(pConfigNode);
404
405 /*
406 * Allocate the driver instance.
407 */
408 size_t cb = RT_OFFSETOF(PDMDRVINS, achInstanceData[pDrv->pReg->cbInstance]);
409 cb = RT_ALIGN_Z(cb, 16);
410 bool const fHyperHeap = !!(pDrv->pReg->fFlags & (PDM_DRVREG_FLAGS_R0 | PDM_DRVREG_FLAGS_RC));
411 PPDMDRVINS pNew;
412 if (fHyperHeap)
413 rc = MMHyperAlloc(pVM, cb, 64, MM_TAG_PDM_DRIVER, (void **)&pNew);
414 else
415 rc = MMR3HeapAllocZEx(pVM, MM_TAG_PDM_DRIVER, cb, (void **)&pNew);
416 if (pNew)
417 {
418 /*
419 * Initialize the instance structure (declaration order).
420 */
421 pNew->u32Version = PDM_DRVINS_VERSION;
422 pNew->Internal.s.pUp = pDrvAbove ? pDrvAbove : NULL;
423 //pNew->Internal.s.pDown = NULL;
424 pNew->Internal.s.pLun = pLun;
425 pNew->Internal.s.pDrv = pDrv;
426 pNew->Internal.s.pVMR3 = pVM;
427 pNew->Internal.s.pVMR0 = pDrv->pReg->fFlags & PDM_DRVREG_FLAGS_R0 ? pVM->pVMR0 : NIL_RTR0PTR;
428 pNew->Internal.s.pVMRC = pDrv->pReg->fFlags & PDM_DRVREG_FLAGS_RC ? pVM->pVMRC : NIL_RTRCPTR;
429 //pNew->Internal.s.fDetaching = false;
430 pNew->Internal.s.fVMSuspended = true;
431 //pNew->Internal.s.fVMReset = false;
432 pNew->Internal.s.fHyperHeap = fHyperHeap;
433 //pNew->Internal.s.pfnAsyncNotify = NULL;
434 pNew->Internal.s.pCfgHandle = pNode;
435 pNew->pReg = pDrv->pReg;
436 pNew->pCfg = pConfigNode;
437 pNew->iInstance = pDrv->iNextInstance;
438 pNew->pUpBase = pBaseInterface;
439 Assert(!pDrvAbove || pBaseInterface == &pDrvAbove->IBase);
440 //pNew->pDownBase = NULL;
441 //pNew->IBase.pfnQueryInterface = NULL;
442 pNew->pHlpR3 = &g_pdmR3DrvHlp;
443 pNew->pvInstanceDataR3 = &pNew->achInstanceData[0];
444 if (pDrv->pReg->fFlags & PDM_DRVREG_FLAGS_R0)
445 {
446 pNew->pvInstanceDataR0 = MMHyperR3ToR0(pVM, &pNew->achInstanceData[0]);
447 rc = PDMR3LdrGetSymbolR0(pVM, NULL, "g_pdmR0DrvHlp", &pNew->pHlpR0);
448 AssertReleaseRCReturn(rc, rc);
449
450 }
451 if (pDrv->pReg->fFlags & PDM_DRVREG_FLAGS_RC)
452 {
453 pNew->pvInstanceDataR0 = MMHyperR3ToRC(pVM, &pNew->achInstanceData[0]);
454 rc = PDMR3LdrGetSymbolRC(pVM, NULL, "g_pdmRCDrvHlp", &pNew->pHlpRC);
455 AssertReleaseRCReturn(rc, rc);
456 }
457
458 pDrv->iNextInstance++;
459 pDrv->cInstances++;
460
461 /*
462 * Link with it with the driver above / LUN.
463 */
464 if (pDrvAbove)
465 {
466 pDrvAbove->pDownBase = &pNew->IBase;
467 pDrvAbove->Internal.s.pDown = pNew;
468 }
469 else if (pLun)
470 pLun->pTop = pNew;
471 if (pLun)
472 pLun->pBottom = pNew;
473
474 /*
475 * Invoke the constructor.
476 */
477 rc = pDrv->pReg->pfnConstruct(pNew, pNew->pCfg, 0 /*fFlags*/);
478 if (RT_SUCCESS(rc))
479 {
480 AssertPtr(pNew->IBase.pfnQueryInterface);
481 Assert(pNew->IBase.pfnQueryInterface(&pNew->IBase, PDMIBASE_IID) == &pNew->IBase);
482
483 /* Success! */
484 *ppBaseInterface = &pNew->IBase;
485 if (pLun)
486 Log(("PDM: Attached driver %p:'%s'/%d to LUN#%d on device '%s'/%d, pDrvAbove=%p:'%s'/%d\n",
487 pNew, pDrv->pReg->szName, pNew->iInstance,
488 pLun->iLun,
489 pLun->pDevIns ? pLun->pDevIns->pReg->szName : pLun->pUsbIns->pReg->szName,
490 pLun->pDevIns ? pLun->pDevIns->iInstance : pLun->pUsbIns->iInstance,
491 pDrvAbove, pDrvAbove ? pDrvAbove->pReg->szName : "", pDrvAbove ? pDrvAbove->iInstance : UINT32_MAX));
492 else
493 Log(("PDM: Attached driver %p:'%s'/%d, pDrvAbove=%p:'%s'/%d\n",
494 pNew, pDrv->pReg->szName, pNew->iInstance,
495 pDrvAbove, pDrvAbove ? pDrvAbove->pReg->szName : "", pDrvAbove ? pDrvAbove->iInstance : UINT32_MAX));
496 }
497 else
498 pdmR3DrvDestroyChain(pNew, PDM_TACH_FLAGS_NO_CALLBACKS);
499 }
500 else
501 {
502 AssertMsgFailed(("Failed to allocate %d bytes for instantiating driver '%s'\n", cb, pszName));
503 rc = VERR_NO_MEMORY;
504 }
505 }
506 else
507 AssertMsgFailed(("Failed to create Config node! rc=%Rrc\n", rc));
508 }
509 else if (pDrv)
510 {
511 AssertMsgFailed(("Too many instances of driver '%s', max is %u\n", pszName, pDrv->pReg->cMaxInstances));
512 rc = VERR_PDM_TOO_MANY_DRIVER_INSTANCES;
513 }
514 else
515 {
516 AssertMsgFailed(("Driver '%s' wasn't found!\n", pszName));
517 rc = VERR_PDM_DRIVER_NOT_FOUND;
518 }
519 }
520 else
521 {
522 AssertMsgFailed(("Query for string value of \"Driver\" -> %Rrc\n", rc));
523 if (rc == VERR_CFGM_VALUE_NOT_FOUND)
524 rc = VERR_PDM_CFG_MISSING_DRIVER_NAME;
525 }
526 return rc;
527}
528
529
530/**
531 * Detaches a driver from whatever it's attached to.
532 * This will of course lead to the destruction of the driver and all drivers below it in the chain.
533 *
534 * @returns VINF_SUCCESS
535 * @param pDrvIns The driver instance to detach.
536 * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
537 */
538int pdmR3DrvDetach(PPDMDRVINS pDrvIns, uint32_t fFlags)
539{
540 PDMDRV_ASSERT_DRVINS(pDrvIns);
541 LogFlow(("pdmR3DrvDetach: pDrvIns=%p '%s'/%d\n", pDrvIns, pDrvIns->pReg->szName, pDrvIns->iInstance));
542 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
543
544 /*
545 * Check that we're not doing this recursively, that could have unwanted sideeffects!
546 */
547 if (pDrvIns->Internal.s.fDetaching)
548 {
549 AssertMsgFailed(("Recursive detach! '%s'/%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance));
550 return VINF_SUCCESS; }
551
552 /*
553 * Check that we actually can detach this instance.
554 * The requirement is that the driver/device above has a detach method.
555 */
556 if (pDrvIns->Internal.s.pUp
557 ? !pDrvIns->Internal.s.pUp->pReg->pfnDetach
558 : !pDrvIns->Internal.s.pLun->pDevIns->pReg->pfnDetach)
559 {
560 AssertMsgFailed(("Cannot detach driver instance because the driver/device above doesn't support it!\n"));
561 return VERR_PDM_DRIVER_DETACH_NOT_POSSIBLE;
562 }
563
564 /*
565 * Join paths with pdmR3DrvDestroyChain.
566 */
567 pdmR3DrvDestroyChain(pDrvIns, fFlags);
568 return VINF_SUCCESS;
569}
570
571
572/**
573 * Destroys a driver chain starting with the specified driver.
574 *
575 * This is used when unplugging a device at run time.
576 *
577 * @param pDrvIns Pointer to the driver instance to start with.
578 * @param fFlags PDM_TACH_FLAGS_NOT_HOT_PLUG, PDM_TACH_FLAGS_NO_CALLBACKS
579 * or 0.
580 */
581void pdmR3DrvDestroyChain(PPDMDRVINS pDrvIns, uint32_t fFlags)
582{
583 PVM pVM = pDrvIns->Internal.s.pVMR3;
584 VM_ASSERT_EMT(pVM);
585
586 /*
587 * Detach the bottommost driver until we've detached pDrvIns.
588 */
589 pDrvIns->Internal.s.fDetaching = true;
590 PPDMDRVINS pCur;
591 do
592 {
593 /* find the driver to detach. */
594 pCur = pDrvIns;
595 while (pCur->Internal.s.pDown)
596 pCur = pCur->Internal.s.pDown;
597 LogFlow(("pdmR3DrvDestroyChain: pCur=%p '%s'/%d\n", pCur, pCur->pReg->szName, pCur->iInstance));
598
599 /*
600 * Unlink it and notify parent.
601 */
602 pCur->Internal.s.fDetaching = true;
603
604 PPDMLUN pLun = pCur->Internal.s.pLun;
605 Assert(pLun->pBottom == pCur);
606 pLun->pBottom = pCur->Internal.s.pUp;
607
608 if (pCur->Internal.s.pUp)
609 {
610 /* driver parent */
611 PPDMDRVINS pParent = pCur->Internal.s.pUp;
612 pCur->Internal.s.pUp = NULL;
613 pParent->Internal.s.pDown = NULL;
614
615 if (!(fFlags & PDM_TACH_FLAGS_NO_CALLBACKS) && pParent->pReg->pfnDetach)
616 pParent->pReg->pfnDetach(pParent, fFlags);
617
618 pParent->pDownBase = NULL;
619 }
620 else
621 {
622 /* device parent */
623 Assert(pLun->pTop == pCur);
624 pLun->pTop = NULL;
625 if (!(fFlags & PDM_TACH_FLAGS_NO_CALLBACKS) && pLun->pDevIns->pReg->pfnDetach)
626 pLun->pDevIns->pReg->pfnDetach(pLun->pDevIns, pLun->iLun, fFlags);
627 }
628
629 /*
630 * Call destructor.
631 */
632 pCur->pUpBase = NULL;
633 if (pCur->pReg->pfnDestruct)
634 pCur->pReg->pfnDestruct(pCur);
635 pCur->Internal.s.pDrv->cInstances--;
636
637 /*
638 * Free all resources allocated by the driver.
639 */
640 /* Queues. */
641 int rc = PDMR3QueueDestroyDriver(pVM, pCur);
642 AssertRC(rc);
643
644 /* Timers. */
645 rc = TMR3TimerDestroyDriver(pVM, pCur);
646 AssertRC(rc);
647
648 /* SSM data units. */
649 rc = SSMR3DeregisterDriver(pVM, pCur, NULL, 0);
650 AssertRC(rc);
651
652 /* PDM threads. */
653 rc = pdmR3ThreadDestroyDriver(pVM, pCur);
654 AssertRC(rc);
655
656 /* PDM critsects. */
657 rc = pdmR3CritSectDeleteDriver(pVM, pCur);
658 AssertRC(rc);
659
660 /* Finally, the driver it self. */
661 bool fHyperHeap = pCur->Internal.s.fHyperHeap;
662 ASMMemFill32(pCur, RT_OFFSETOF(PDMDRVINS, achInstanceData[pCur->pReg->cbInstance]), 0xdeadd0d0);
663 if (fHyperHeap)
664 MMHyperFree(pVM, pCur);
665 else
666 MMR3HeapFree(pCur);
667
668 } while (pCur != pDrvIns);
669}
670
671
672
673
674/** @name Driver Helpers
675 * @{
676 */
677
678/** @interface_method_impl{PDMDRVHLP,pfnAttach} */
679static DECLCALLBACK(int) pdmR3DrvHlp_Attach(PPDMDRVINS pDrvIns, uint32_t fFlags, PPDMIBASE *ppBaseInterface)
680{
681 PDMDRV_ASSERT_DRVINS(pDrvIns);
682 PVM pVM = pDrvIns->Internal.s.pVMR3;
683 VM_ASSERT_EMT(pVM);
684 LogFlow(("pdmR3DrvHlp_Attach: caller='%s'/%d: fFlags=%#x\n", pDrvIns->pReg->szName, pDrvIns->iInstance, fFlags));
685 Assert(!(fFlags & ~(PDM_TACH_FLAGS_NOT_HOT_PLUG)));
686
687 /*
688 * Check that there isn't anything attached already.
689 */
690 int rc;
691 if (!pDrvIns->Internal.s.pDown)
692 {
693 Assert(pDrvIns->Internal.s.pLun->pBottom == pDrvIns);
694
695 /*
696 * Get the attached driver configuration.
697 */
698 PCFGMNODE pNode = CFGMR3GetChild(pDrvIns->Internal.s.pCfgHandle, "AttachedDriver");
699 if (pNode)
700 rc = pdmR3DrvInstantiate(pVM, pNode, &pDrvIns->IBase, pDrvIns, pDrvIns->Internal.s.pLun, ppBaseInterface);
701 else
702 rc = VERR_PDM_NO_ATTACHED_DRIVER;
703 }
704 else
705 {
706 AssertMsgFailed(("Already got a driver attached. The driver should keep track of such things!\n"));
707 rc = VERR_PDM_DRIVER_ALREADY_ATTACHED;
708 }
709
710 LogFlow(("pdmR3DrvHlp_Attach: caller='%s'/%d: return %Rrc\n",
711 pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
712 return rc;
713}
714
715
716/** @interface_method_impl{PDMDRVHLP,pfnDetach} */
717static DECLCALLBACK(int) pdmR3DrvHlp_Detach(PPDMDRVINS pDrvIns, uint32_t fFlags)
718{
719 PDMDRV_ASSERT_DRVINS(pDrvIns);
720 LogFlow(("pdmR3DrvHlp_Detach: caller='%s'/%d: fFlags=%#x\n",
721 pDrvIns->pReg->szName, pDrvIns->iInstance, fFlags));
722 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
723
724 /*
725 * Anything attached?
726 */
727 int rc;
728 if (pDrvIns->Internal.s.pDown)
729 rc = pdmR3DrvDetach(pDrvIns->Internal.s.pDown, fFlags);
730 else
731 {
732 AssertMsgFailed(("Nothing attached!\n"));
733 rc = VERR_PDM_NO_DRIVER_ATTACHED;
734 }
735
736 LogFlow(("pdmR3DrvHlp_Detach: caller='%s'/%d: returns %Rrc\n",
737 pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
738 return rc;
739}
740
741
742/** @interface_method_impl{PDMDRVHLP,pfnDetachSelf} */
743static DECLCALLBACK(int) pdmR3DrvHlp_DetachSelf(PPDMDRVINS pDrvIns, uint32_t fFlags)
744{
745 PDMDRV_ASSERT_DRVINS(pDrvIns);
746 LogFlow(("pdmR3DrvHlp_DetachSelf: caller='%s'/%d: fFlags=%#x\n",
747 pDrvIns->pReg->szName, pDrvIns->iInstance, fFlags));
748 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
749
750 int rc = pdmR3DrvDetach(pDrvIns, fFlags);
751
752 LogFlow(("pdmR3DrvHlp_Detach: returns %Rrc\n", rc)); /* pDrvIns is freed by now. */
753 return rc;
754}
755
756
757/** @interface_method_impl{PDMDRVHLP,pfnMountPrepare} */
758static DECLCALLBACK(int) pdmR3DrvHlp_MountPrepare(PPDMDRVINS pDrvIns, const char *pszFilename, const char *pszCoreDriver)
759{
760 PDMDRV_ASSERT_DRVINS(pDrvIns);
761 LogFlow(("pdmR3DrvHlp_MountPrepare: caller='%s'/%d: pszFilename=%p:{%s} pszCoreDriver=%p:{%s}\n",
762 pDrvIns->pReg->szName, pDrvIns->iInstance, pszFilename, pszFilename, pszCoreDriver, pszCoreDriver));
763 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
764
765 /*
766 * Do the caller have anything attached below itself?
767 */
768 if (pDrvIns->Internal.s.pDown)
769 {
770 AssertMsgFailed(("Cannot prepare a mount when something's attached to you!\n"));
771 return VERR_PDM_DRIVER_ALREADY_ATTACHED;
772 }
773
774 /*
775 * We're asked to prepare, so we'll start off by nuking the
776 * attached configuration tree.
777 */
778 PCFGMNODE pNode = CFGMR3GetChild(pDrvIns->Internal.s.pCfgHandle, "AttachedDriver");
779 if (pNode)
780 CFGMR3RemoveNode(pNode);
781
782 /*
783 * If there is no core driver, we'll have to probe for it.
784 */
785 if (!pszCoreDriver)
786 {
787 /** @todo implement image probing. */
788 AssertReleaseMsgFailed(("Not implemented!\n"));
789 return VERR_NOT_IMPLEMENTED;
790 }
791
792 /*
793 * Construct the basic attached driver configuration.
794 */
795 int rc = CFGMR3InsertNode(pDrvIns->Internal.s.pCfgHandle, "AttachedDriver", &pNode);
796 if (RT_SUCCESS(rc))
797 {
798 rc = CFGMR3InsertString(pNode, "Driver", pszCoreDriver);
799 if (RT_SUCCESS(rc))
800 {
801 PCFGMNODE pCfg;
802 rc = CFGMR3InsertNode(pNode, "Config", &pCfg);
803 if (RT_SUCCESS(rc))
804 {
805 rc = CFGMR3InsertString(pCfg, "Path", pszFilename);
806 if (RT_SUCCESS(rc))
807 {
808 LogFlow(("pdmR3DrvHlp_MountPrepare: caller='%s'/%d: returns %Rrc (Driver=%s)\n",
809 pDrvIns->pReg->szName, pDrvIns->iInstance, rc, pszCoreDriver));
810 return rc;
811 }
812 else
813 AssertMsgFailed(("Path string insert failed, rc=%Rrc\n", rc));
814 }
815 else
816 AssertMsgFailed(("Config node failed, rc=%Rrc\n", rc));
817 }
818 else
819 AssertMsgFailed(("Driver string insert failed, rc=%Rrc\n", rc));
820 CFGMR3RemoveNode(pNode);
821 }
822 else
823 AssertMsgFailed(("AttachedDriver node insert failed, rc=%Rrc\n", rc));
824
825 LogFlow(("pdmR3DrvHlp_MountPrepare: caller='%s'/%d: returns %Rrc\n",
826 pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
827 return rc;
828}
829
830
831/** @interface_method_impl{PDMDRVHLP,pfnAssertEMT} */
832static DECLCALLBACK(bool) pdmR3DrvHlp_AssertEMT(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction)
833{
834 PDMDRV_ASSERT_DRVINS(pDrvIns);
835 if (VM_IS_EMT(pDrvIns->Internal.s.pVMR3))
836 return true;
837
838 char szMsg[100];
839 RTStrPrintf(szMsg, sizeof(szMsg), "AssertEMT '%s'/%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance);
840 RTAssertMsg1Weak(szMsg, iLine, pszFile, pszFunction);
841 AssertBreakpoint();
842 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
843 return false;
844}
845
846
847/** @interface_method_impl{PDMDRVHLP,pfnAssertOther} */
848static DECLCALLBACK(bool) pdmR3DrvHlp_AssertOther(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction)
849{
850 PDMDRV_ASSERT_DRVINS(pDrvIns);
851 if (!VM_IS_EMT(pDrvIns->Internal.s.pVMR3))
852 return true;
853
854 char szMsg[100];
855 RTStrPrintf(szMsg, sizeof(szMsg), "AssertOther '%s'/%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance);
856 RTAssertMsg1Weak(szMsg, iLine, pszFile, pszFunction);
857 AssertBreakpoint();
858 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
859 return false;
860}
861
862
863/** @interface_method_impl{PDMDRVHLP,pfnVMSetError} */
864static DECLCALLBACK(int) pdmR3DrvHlp_VMSetError(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)
865{
866 PDMDRV_ASSERT_DRVINS(pDrvIns);
867 va_list args;
868 va_start(args, pszFormat);
869 int rc2 = VMSetErrorV(pDrvIns->Internal.s.pVMR3, rc, RT_SRC_POS_ARGS, pszFormat, args); Assert(rc2 == rc); NOREF(rc2);
870 va_end(args);
871 return rc;
872}
873
874
875/** @interface_method_impl{PDMDRVHLP,pfnVMSetErrorV} */
876static DECLCALLBACK(int) pdmR3DrvHlp_VMSetErrorV(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)
877{
878 PDMDRV_ASSERT_DRVINS(pDrvIns);
879 int rc2 = VMSetErrorV(pDrvIns->Internal.s.pVMR3, rc, RT_SRC_POS_ARGS, pszFormat, va); Assert(rc2 == rc); NOREF(rc2);
880 return rc;
881}
882
883
884/** @interface_method_impl{PDMDRVHLP,pfnVMSetRuntimeError} */
885static DECLCALLBACK(int) pdmR3DrvHlp_VMSetRuntimeError(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...)
886{
887 PDMDRV_ASSERT_DRVINS(pDrvIns);
888 va_list args;
889 va_start(args, pszFormat);
890 int rc = VMSetRuntimeErrorV(pDrvIns->Internal.s.pVMR3, fFlags, pszErrorId, pszFormat, args);
891 va_end(args);
892 return rc;
893}
894
895
896/** @interface_method_impl{PDMDRVHLP,pfnVMSetRuntimeErrorV} */
897static DECLCALLBACK(int) pdmR3DrvHlp_VMSetRuntimeErrorV(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va)
898{
899 PDMDRV_ASSERT_DRVINS(pDrvIns);
900 int rc = VMSetRuntimeErrorV(pDrvIns->Internal.s.pVMR3, fFlags, pszErrorId, pszFormat, va);
901 return rc;
902}
903
904
905/** @interface_method_impl{PDMDEVHLPR3,pfnVMState} */
906static DECLCALLBACK(VMSTATE) pdmR3DrvHlp_VMState(PPDMDRVINS pDrvIns)
907{
908 PDMDRV_ASSERT_DRVINS(pDrvIns);
909
910 VMSTATE enmVMState = VMR3GetState(pDrvIns->Internal.s.pVMR3);
911
912 LogFlow(("pdmR3DrvHlp_VMState: caller='%s'/%d: returns %d (%s)\n", pDrvIns->pReg->szName, pDrvIns->iInstance,
913 enmVMState, VMR3GetStateName(enmVMState)));
914 return enmVMState;
915}
916
917
918/** @interface_method_impl{PDMDEVHLPR3,pfnVMTeleportedAndNotFullyResumedYet} */
919static DECLCALLBACK(bool) pdmR3DrvHlp_VMTeleportedAndNotFullyResumedYet(PPDMDRVINS pDrvIns)
920{
921 PDMDRV_ASSERT_DRVINS(pDrvIns);
922
923 bool fRc = VMR3TeleportedAndNotFullyResumedYet(pDrvIns->Internal.s.pVMR3);
924
925 LogFlow(("pdmR3DrvHlp_VMState: caller='%s'/%d: returns %RTbool)\n", pDrvIns->pReg->szName, pDrvIns->iInstance,
926 fRc));
927 return fRc;
928}
929
930
931/** @interface_method_impl{PDMDEVHLPR3,pfnGetSupDrvSession} */
932static DECLCALLBACK(PSUPDRVSESSION) pdmR3DrvHlp_GetSupDrvSession(PPDMDRVINS pDrvIns)
933{
934 PDMDRV_ASSERT_DRVINS(pDrvIns);
935
936 PSUPDRVSESSION pSession = pDrvIns->Internal.s.pVMR3->pSession;
937 LogFlow(("pdmR3DrvHlp_GetSupDrvSession: caller='%s'/%d: returns %p)\n", pDrvIns->pReg->szName, pDrvIns->iInstance,
938 pSession));
939 return pSession;
940}
941
942
943/** @interface_method_impl{PDMDRVHLP,pfnQueueCreate} */
944static DECLCALLBACK(int) pdmR3DrvHlp_QueueCreate(PPDMDRVINS pDrvIns, uint32_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
945 PFNPDMQUEUEDRV pfnCallback, const char *pszName, PPDMQUEUE *ppQueue)
946{
947 PDMDRV_ASSERT_DRVINS(pDrvIns);
948 LogFlow(("pdmR3DrvHlp_PDMQueueCreate: caller='%s'/%d: cbItem=%d cItems=%d cMilliesInterval=%d pfnCallback=%p pszName=%p:{%s} ppQueue=%p\n",
949 pDrvIns->pReg->szName, pDrvIns->iInstance, cbItem, cItems, cMilliesInterval, pfnCallback, pszName, pszName, ppQueue, ppQueue));
950 PVM pVM = pDrvIns->Internal.s.pVMR3;
951 VM_ASSERT_EMT(pVM);
952
953 if (pDrvIns->iInstance > 0)
954 {
955 pszName = MMR3HeapAPrintf(pVM, MM_TAG_PDM_DRIVER_DESC, "%s_%u", pszName, pDrvIns->iInstance);
956 AssertLogRelReturn(pszName, VERR_NO_MEMORY);
957 }
958
959 int rc = PDMR3QueueCreateDriver(pVM, pDrvIns, cbItem, cItems, cMilliesInterval, pfnCallback, pszName, ppQueue);
960
961 LogFlow(("pdmR3DrvHlp_PDMQueueCreate: caller='%s'/%d: returns %Rrc *ppQueue=%p\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc, *ppQueue));
962 return rc;
963}
964
965
966/** @interface_method_impl{PDMDRVHLP,pfnTMGetVirtualFreq} */
967static DECLCALLBACK(uint64_t) pdmR3DrvHlp_TMGetVirtualFreq(PPDMDRVINS pDrvIns)
968{
969 PDMDRV_ASSERT_DRVINS(pDrvIns);
970
971 return TMVirtualGetFreq(pDrvIns->Internal.s.pVMR3);
972}
973
974
975/** @interface_method_impl{PDMDRVHLP,pfnTMGetVirtualTime} */
976static DECLCALLBACK(uint64_t) pdmR3DrvHlp_TMGetVirtualTime(PPDMDRVINS pDrvIns)
977{
978 PDMDRV_ASSERT_DRVINS(pDrvIns);
979
980 return TMVirtualGet(pDrvIns->Internal.s.pVMR3);
981}
982
983
984/** @interface_method_impl{PDMDRVHLP,pfnTMTimerCreate} */
985static DECLCALLBACK(int) pdmR3DrvHlp_TMTimerCreate(PPDMDRVINS pDrvIns, TMCLOCK enmClock, PFNTMTIMERDRV pfnCallback, void *pvUser, uint32_t fFlags, const char *pszDesc, PPTMTIMERR3 ppTimer)
986{
987 PDMDRV_ASSERT_DRVINS(pDrvIns);
988 LogFlow(("pdmR3DrvHlp_TMTimerCreate: caller='%s'/%d: enmClock=%d pfnCallback=%p pvUser=%p fFlags=%#x pszDesc=%p:{%s} ppTimer=%p\n",
989 pDrvIns->pReg->szName, pDrvIns->iInstance, enmClock, pfnCallback, pvUser, fFlags, pszDesc, pszDesc, ppTimer));
990
991 int rc = TMR3TimerCreateDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, enmClock, pfnCallback, pvUser, fFlags, pszDesc, ppTimer);
992
993 LogFlow(("pdmR3DrvHlp_TMTimerCreate: caller='%s'/%d: returns %Rrc *ppTimer=%p\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc, *ppTimer));
994 return rc;
995}
996
997
998
999/** @interface_method_impl{PDMDRVHLP,pfnSSMRegister} */
1000static DECLCALLBACK(int) pdmR3DrvHlp_SSMRegister(PPDMDRVINS pDrvIns, uint32_t uVersion, size_t cbGuess,
1001 PFNSSMDRVLIVEPREP pfnLivePrep, PFNSSMDRVLIVEEXEC pfnLiveExec, PFNSSMDRVLIVEVOTE pfnLiveVote,
1002 PFNSSMDRVSAVEPREP pfnSavePrep, PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVSAVEDONE pfnSaveDone,
1003 PFNSSMDRVLOADPREP pfnLoadPrep, PFNSSMDRVLOADEXEC pfnLoadExec, PFNSSMDRVLOADDONE pfnLoadDone)
1004{
1005 PDMDRV_ASSERT_DRVINS(pDrvIns);
1006 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
1007 LogFlow(("pdmR3DrvHlp_SSMRegister: caller='%s'/%d: uVersion=#x cbGuess=%#x \n"
1008 " pfnLivePrep=%p pfnLiveExec=%p pfnLiveVote=%p pfnSavePrep=%p pfnSaveExec=%p pfnSaveDone=%p pszLoadPrep=%p pfnLoadExec=%p pfnLoaddone=%p\n",
1009 pDrvIns->pReg->szName, pDrvIns->iInstance, uVersion, cbGuess,
1010 pfnLivePrep, pfnLiveExec, pfnLiveVote,
1011 pfnSavePrep, pfnSaveExec, pfnSaveDone, pfnLoadPrep, pfnLoadExec, pfnLoadDone));
1012
1013 int rc = SSMR3RegisterDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, pDrvIns->pReg->szName, pDrvIns->iInstance,
1014 uVersion, cbGuess,
1015 pfnLivePrep, pfnLiveExec, pfnLiveVote,
1016 pfnSavePrep, pfnSaveExec, pfnSaveDone,
1017 pfnLoadPrep, pfnLoadExec, pfnLoadDone);
1018
1019 LogFlow(("pdmR3DrvHlp_SSMRegister: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
1020 return rc;
1021}
1022
1023
1024/** @interface_method_impl{PDMDRVHLP,pfnSSMDeregister} */
1025static DECLCALLBACK(int) pdmR3DrvHlp_SSMDeregister(PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance)
1026{
1027 PDMDRV_ASSERT_DRVINS(pDrvIns);
1028 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
1029 LogFlow(("pdmR3DrvHlp_SSMDeregister: caller='%s'/%d: pszName=%p:{%s} u32Instance=%#x\n",
1030 pDrvIns->pReg->szName, pDrvIns->iInstance, pszName, pszName, u32Instance));
1031
1032 int rc = SSMR3DeregisterDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, pszName, u32Instance);
1033
1034 LogFlow(("pdmR3DrvHlp_SSMDeregister: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
1035 return rc;
1036}
1037
1038
1039/** @interface_method_impl{PDMDRVHLP,pfnSTAMRegister} */
1040static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegister(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, const char *pszName, STAMUNIT enmUnit, const char *pszDesc)
1041{
1042 PDMDRV_ASSERT_DRVINS(pDrvIns);
1043 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
1044
1045 STAM_REG(pDrvIns->Internal.s.pVMR3, pvSample, enmType, pszName, enmUnit, pszDesc);
1046 /** @todo track the samples so they can be dumped & deregistered when the driver instance is destroyed.
1047 * For now we just have to be careful not to use this call for drivers which can be unloaded. */
1048}
1049
1050
1051/** @interface_method_impl{PDMDRVHLP,pfnSTAMRegisterF} */
1052static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegisterF(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
1053 STAMUNIT enmUnit, const char *pszDesc, const char *pszName, ...)
1054{
1055 PDMDRV_ASSERT_DRVINS(pDrvIns);
1056 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
1057
1058 va_list args;
1059 va_start(args, pszName);
1060 int rc = STAMR3RegisterV(pDrvIns->Internal.s.pVMR3, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, args);
1061 va_end(args);
1062 AssertRC(rc);
1063}
1064
1065
1066/** @interface_method_impl{PDMDRVHLP,pfnSTAMRegisterV} */
1067static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegisterV(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
1068 STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list args)
1069{
1070 PDMDRV_ASSERT_DRVINS(pDrvIns);
1071 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
1072
1073 int rc = STAMR3RegisterV(pDrvIns->Internal.s.pVMR3, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, args);
1074 AssertRC(rc);
1075}
1076
1077
1078/** @interface_method_impl{PDMDRVHLP,pfnSTAMDeregister} */
1079static DECLCALLBACK(int) pdmR3DrvHlp_STAMDeregister(PPDMDRVINS pDrvIns, void *pvSample)
1080{
1081 PDMDRV_ASSERT_DRVINS(pDrvIns);
1082 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
1083
1084 int rc = STAMR3DeregisterU(pDrvIns->Internal.s.pVMR3->pUVM, pvSample);
1085 AssertRC(rc);
1086 return rc;
1087}
1088
1089
1090/** @interface_method_impl{PDMDRVHLP,pfnSUPCallVMMR0Ex} */
1091static DECLCALLBACK(int) pdmR3DrvHlp_SUPCallVMMR0Ex(PPDMDRVINS pDrvIns, unsigned uOperation, void *pvArg, unsigned cbArg)
1092{
1093 PDMDRV_ASSERT_DRVINS(pDrvIns);
1094 LogFlow(("pdmR3DrvHlp_SSMCallVMMR0Ex: caller='%s'/%d: uOperation=%u pvArg=%p cbArg=%d\n",
1095 pDrvIns->pReg->szName, pDrvIns->iInstance, uOperation, pvArg, cbArg));
1096 int rc;
1097 if ( uOperation >= VMMR0_DO_SRV_START
1098 && uOperation < VMMR0_DO_SRV_END)
1099 rc = SUPR3CallVMMR0Ex(pDrvIns->Internal.s.pVMR3->pVMR0, NIL_VMCPUID, uOperation, 0, (PSUPVMMR0REQHDR)pvArg);
1100 else
1101 {
1102 AssertMsgFailed(("Invalid uOperation=%u\n", uOperation));
1103 rc = VERR_INVALID_PARAMETER;
1104 }
1105
1106 LogFlow(("pdmR3DrvHlp_SUPCallVMMR0Ex: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
1107 return rc;
1108}
1109
1110
1111/** @interface_method_impl{PDMDRVHLP,pfnUSBRegisterHub} */
1112static DECLCALLBACK(int) pdmR3DrvHlp_USBRegisterHub(PPDMDRVINS pDrvIns, uint32_t fVersions, uint32_t cPorts, PCPDMUSBHUBREG pUsbHubReg, PPCPDMUSBHUBHLP ppUsbHubHlp)
1113{
1114 PDMDRV_ASSERT_DRVINS(pDrvIns);
1115 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
1116 LogFlow(("pdmR3DrvHlp_USBRegisterHub: caller='%s'/%d: fVersions=%#x cPorts=%#x pUsbHubReg=%p ppUsbHubHlp=%p\n",
1117 pDrvIns->pReg->szName, pDrvIns->iInstance, fVersions, cPorts, pUsbHubReg, ppUsbHubHlp));
1118
1119#ifdef VBOX_WITH_USB
1120 int rc = pdmR3UsbRegisterHub(pDrvIns->Internal.s.pVMR3, pDrvIns, fVersions, cPorts, pUsbHubReg, ppUsbHubHlp);
1121#else
1122 int rc = VERR_NOT_SUPPORTED;
1123#endif
1124
1125 LogFlow(("pdmR3DrvHlp_USBRegisterHub: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
1126 return rc;
1127}
1128
1129
1130/** @interface_method_impl{PDMDRVHLP,pfnSetAsyncNotification} */
1131static DECLCALLBACK(int) pdmR3DrvHlp_SetAsyncNotification(PPDMDRVINS pDrvIns, PFNPDMDRVASYNCNOTIFY pfnAsyncNotify)
1132{
1133 PDMDRV_ASSERT_DRVINS(pDrvIns);
1134 VM_ASSERT_EMT0(pDrvIns->Internal.s.pVMR3);
1135 LogFlow(("pdmR3DrvHlp_SetAsyncNotification: caller='%s'/%d: pfnAsyncNotify=%p\n", pDrvIns->pReg->szName, pDrvIns->iInstance, pfnAsyncNotify));
1136
1137 int rc = VINF_SUCCESS;
1138 AssertStmt(pfnAsyncNotify, rc = VERR_INVALID_PARAMETER);
1139 AssertStmt(!pDrvIns->Internal.s.pfnAsyncNotify, rc = VERR_WRONG_ORDER);
1140 AssertStmt(pDrvIns->Internal.s.fVMSuspended || pDrvIns->Internal.s.fVMReset, rc = VERR_WRONG_ORDER);
1141 VMSTATE enmVMState = VMR3GetState(pDrvIns->Internal.s.pVMR3);
1142 AssertStmt( enmVMState == VMSTATE_SUSPENDING
1143 || enmVMState == VMSTATE_SUSPENDING_EXT_LS
1144 || enmVMState == VMSTATE_SUSPENDING_LS
1145 || enmVMState == VMSTATE_RESETTING
1146 || enmVMState == VMSTATE_RESETTING_LS
1147 || enmVMState == VMSTATE_POWERING_OFF
1148 || enmVMState == VMSTATE_POWERING_OFF_LS,
1149 rc = VERR_INVALID_STATE);
1150
1151 if (RT_SUCCESS(rc))
1152 pDrvIns->Internal.s.pfnAsyncNotify = pfnAsyncNotify;
1153
1154 LogFlow(("pdmR3DrvHlp_SetAsyncNotification: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
1155 return rc;
1156}
1157
1158
1159/** @interface_method_impl{PDMDRVHLP,pfnAsyncNotificationCompleted} */
1160static DECLCALLBACK(void) pdmR3DrvHlp_AsyncNotificationCompleted(PPDMDRVINS pDrvIns)
1161{
1162 PDMDRV_ASSERT_DRVINS(pDrvIns);
1163 PVM pVM = pDrvIns->Internal.s.pVMR3;
1164
1165 VMSTATE enmVMState = VMR3GetState(pVM);
1166 if ( enmVMState == VMSTATE_SUSPENDING
1167 || enmVMState == VMSTATE_SUSPENDING_EXT_LS
1168 || enmVMState == VMSTATE_SUSPENDING_LS
1169 || enmVMState == VMSTATE_RESETTING
1170 || enmVMState == VMSTATE_RESETTING_LS
1171 || enmVMState == VMSTATE_POWERING_OFF
1172 || enmVMState == VMSTATE_POWERING_OFF_LS)
1173 {
1174 LogFlow(("pdmR3DrvHlp_AsyncNotificationCompleted: caller='%s'/%d:\n", pDrvIns->pReg->szName, pDrvIns->iInstance));
1175 VMR3AsyncPdmNotificationWakeupU(pVM->pUVM);
1176 }
1177 else
1178 LogFlow(("pdmR3DrvHlp_AsyncNotificationCompleted: caller='%s'/%d: enmVMState=%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance, enmVMState));
1179}
1180
1181
1182/** @interface_method_impl{PDMDRVHLP,pfnThreadCreate} */
1183static DECLCALLBACK(int) pdmR3DrvHlp_ThreadCreate(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
1184 PFNPDMTHREADWAKEUPDRV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)
1185{
1186 PDMDRV_ASSERT_DRVINS(pDrvIns);
1187 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
1188 LogFlow(("pdmR3DrvHlp_ThreadCreate: caller='%s'/%d: ppThread=%p pvUser=%p pfnThread=%p pfnWakeup=%p cbStack=%#zx enmType=%d pszName=%p:{%s}\n",
1189 pDrvIns->pReg->szName, pDrvIns->iInstance, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName, pszName));
1190
1191 int rc = pdmR3ThreadCreateDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
1192
1193 LogFlow(("pdmR3DrvHlp_ThreadCreate: caller='%s'/%d: returns %Rrc *ppThread=%RTthrd\n", pDrvIns->pReg->szName, pDrvIns->iInstance,
1194 rc, *ppThread));
1195 return rc;
1196}
1197
1198
1199/** @interface_method_impl{PDMDRVHLP,pfnAsyncCompletionTemplateCreate} */
1200static DECLCALLBACK(int) pdmR3DrvHlp_AsyncCompletionTemplateCreate(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate,
1201 PFNPDMASYNCCOMPLETEDRV pfnCompleted, void *pvTemplateUser,
1202 const char *pszDesc)
1203{
1204 PDMDRV_ASSERT_DRVINS(pDrvIns);
1205 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
1206 LogFlow(("pdmR3DrvHlp_AsyncCompletionTemplateCreate: caller='%s'/%d: ppTemplate=%p pfnCompleted=%p pszDesc=%p:{%s}\n",
1207 pDrvIns->pReg->szName, pDrvIns->iInstance, ppTemplate, pfnCompleted, pszDesc, pszDesc));
1208
1209 int rc = PDMR3AsyncCompletionTemplateCreateDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, ppTemplate, pfnCompleted, pvTemplateUser, pszDesc);
1210
1211 LogFlow(("pdmR3DrvHlp_AsyncCompletionTemplateCreate: caller='%s'/%d: returns %Rrc *ppThread=%p\n", pDrvIns->pReg->szName,
1212 pDrvIns->iInstance, rc, *ppTemplate));
1213 return rc;
1214}
1215
1216
1217/** @interface_method_impl{PDMDRVHLP,pfnLdrGetRCInterfaceSymbols} */
1218static DECLCALLBACK(int) pdmR3DrvHlp_LdrGetRCInterfaceSymbols(PPDMDRVINS pDrvIns, void *pvInterface, size_t cbInterface,
1219 const char *pszSymPrefix, const char *pszSymList)
1220{
1221 PDMDRV_ASSERT_DRVINS(pDrvIns);
1222 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
1223 LogFlow(("pdmR3DrvHlp_LdrGetRCInterfaceSymbols: caller='%s'/%d: pvInterface=%p cbInterface=%zu pszSymPrefix=%p:{%s} pszSymList=%p:{%s}\n",
1224 pDrvIns->pReg->szName, pDrvIns->iInstance, pvInterface, cbInterface, pszSymPrefix, pszSymPrefix, pszSymList, pszSymList));
1225
1226 int rc;
1227 if ( strncmp(pszSymPrefix, "drv", 3) == 0
1228 && RTStrIStr(pszSymPrefix + 3, pDrvIns->pReg->szName) != NULL)
1229 {
1230 if (pDrvIns->pReg->fFlags & PDM_DRVREG_FLAGS_RC)
1231 rc = PDMR3LdrGetInterfaceSymbols(pDrvIns->Internal.s.pVMR3, pvInterface, cbInterface,
1232 pDrvIns->pReg->szRCMod, pszSymPrefix, pszSymList,
1233 false /*fRing0OrRC*/);
1234 else
1235 {
1236 AssertMsgFailed(("Not a raw-mode enabled driver\n"));
1237 rc = VERR_PERMISSION_DENIED;
1238 }
1239 }
1240 else
1241 {
1242 AssertMsgFailed(("Invalid prefix '%s' for '%s'; must start with 'drv' and contain the driver name!\n",
1243 pszSymPrefix, pDrvIns->pReg->szName));
1244 rc = VERR_INVALID_NAME;
1245 }
1246
1247 LogFlow(("pdmR3DrvHlp_LdrGetRCInterfaceSymbols: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName,
1248 pDrvIns->iInstance, rc));
1249 return rc;
1250}
1251
1252
1253/** @interface_method_impl{PDMDRVHLP,pfnLdrGetR0InterfaceSymbols} */
1254static DECLCALLBACK(int) pdmR3DrvHlp_LdrGetR0InterfaceSymbols(PPDMDRVINS pDrvIns, void *pvInterface, size_t cbInterface,
1255 const char *pszSymPrefix, const char *pszSymList)
1256{
1257 PDMDRV_ASSERT_DRVINS(pDrvIns);
1258 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
1259 LogFlow(("pdmR3DrvHlp_LdrGetR0InterfaceSymbols: caller='%s'/%d: pvInterface=%p cbInterface=%zu pszSymPrefix=%p:{%s} pszSymList=%p:{%s}\n",
1260 pDrvIns->pReg->szName, pDrvIns->iInstance, pvInterface, cbInterface, pszSymPrefix, pszSymPrefix, pszSymList, pszSymList));
1261
1262 int rc;
1263 if ( strncmp(pszSymPrefix, "drv", 3) == 0
1264 && RTStrIStr(pszSymPrefix + 3, pDrvIns->pReg->szName) != NULL)
1265 {
1266 if (pDrvIns->pReg->fFlags & PDM_DRVREG_FLAGS_R0)
1267 rc = PDMR3LdrGetInterfaceSymbols(pDrvIns->Internal.s.pVMR3, pvInterface, cbInterface,
1268 pDrvIns->pReg->szR0Mod, pszSymPrefix, pszSymList,
1269 true /*fRing0OrRC*/);
1270 else
1271 {
1272 AssertMsgFailed(("Not a ring-0 enabled driver\n"));
1273 rc = VERR_PERMISSION_DENIED;
1274 }
1275 }
1276 else
1277 {
1278 AssertMsgFailed(("Invalid prefix '%s' for '%s'; must start with 'drv' and contain the driver name!\n",
1279 pszSymPrefix, pDrvIns->pReg->szName));
1280 rc = VERR_INVALID_NAME;
1281 }
1282
1283 LogFlow(("pdmR3DrvHlp_LdrGetR0InterfaceSymbols: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName,
1284 pDrvIns->iInstance, rc));
1285 return rc;
1286}
1287
1288
1289/** @interface_method_impl{PDMDRVHLP,pfnCritSectInit} */
1290static DECLCALLBACK(int) pdmR3DrvHlp_CritSectInit(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect,
1291 RT_SRC_POS_DECL, const char *pszName)
1292{
1293 PDMDRV_ASSERT_DRVINS(pDrvIns);
1294 PVM pVM = pDrvIns->Internal.s.pVMR3;
1295 VM_ASSERT_EMT(pVM);
1296 LogFlow(("pdmR3DrvHlp_CritSectInit: caller='%s'/%d: pCritSect=%p pszName=%s\n",
1297 pDrvIns->pReg->szName, pDrvIns->iInstance, pCritSect, pszName));
1298
1299 int rc = pdmR3CritSectInitDriver(pVM, pDrvIns, pCritSect, RT_SRC_POS_ARGS, "%s_%u", pszName, pDrvIns->iInstance);
1300
1301 LogFlow(("pdmR3DrvHlp_CritSectInit: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName,
1302 pDrvIns->iInstance, rc));
1303 return rc;
1304}
1305
1306
1307/** @interface_method_impl{PDMDRVHLP,pfnCallR0} */
1308static DECLCALLBACK(int) pdmR3DrvHlp_CallR0(PPDMDRVINS pDrvIns, uint32_t uOperation, uint64_t u64Arg)
1309{
1310 PDMDRV_ASSERT_DRVINS(pDrvIns);
1311 PVM pVM = pDrvIns->Internal.s.pVMR3;
1312 LogFlow(("pdmR3DrvHlp_CallR0: caller='%s'/%d: uOperation=%#x u64Arg=%#RX64\n",
1313 pDrvIns->pReg->szName, pDrvIns->iInstance, uOperation, u64Arg));
1314
1315 /*
1316 * Lazy resolve the ring-0 entry point.
1317 */
1318 int rc = VINF_SUCCESS;
1319 PFNPDMDRVREQHANDLERR0 pfnReqHandlerR0 = pDrvIns->Internal.s.pfnReqHandlerR0;
1320 if (RT_UNLIKELY(pfnReqHandlerR0 == NIL_RTR0PTR))
1321 {
1322 if (pDrvIns->pReg->fFlags & PDM_DRVREG_FLAGS_R0)
1323 {
1324 char szSymbol[ sizeof("drvR0") + sizeof(pDrvIns->pReg->szName) + sizeof("ReqHandler")];
1325 strcat(strcat(strcpy(szSymbol, "drvR0"), pDrvIns->pReg->szName), "ReqHandler");
1326 rc = PDMR3LdrGetSymbolR0Lazy(pVM, pDrvIns->pReg->szR0Mod, szSymbol, &pfnReqHandlerR0);
1327 if (RT_SUCCESS(rc))
1328 pDrvIns->Internal.s.pfnReqHandlerR0 = pfnReqHandlerR0;
1329 else
1330 pfnReqHandlerR0 = NIL_RTR0PTR;
1331 }
1332 else
1333 rc = VERR_ACCESS_DENIED;
1334 }
1335 if (RT_LIKELY(pfnReqHandlerR0 != NIL_RTR0PTR))
1336 {
1337 /*
1338 * Make the ring-0 call.
1339 */
1340 PDMDRIVERCALLREQHANDLERREQ Req;
1341 Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
1342 Req.Hdr.cbReq = sizeof(Req);
1343 Req.pDrvInsR0 = PDMDRVINS_2_R0PTR(pDrvIns);
1344 Req.uOperation = uOperation;
1345 Req.u32Alignment = 0;
1346 Req.u64Arg = u64Arg;
1347 rc = SUPR3CallVMMR0Ex(pVM->pVMR0, NIL_VMCPUID, VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER, 0, &Req.Hdr);
1348 }
1349
1350 LogFlow(("pdmR3DrvHlp_CallR0: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName,
1351 pDrvIns->iInstance, rc));
1352 return rc;
1353}
1354
1355
1356/**
1357 * The driver helper structure.
1358 */
1359const PDMDRVHLPR3 g_pdmR3DrvHlp =
1360{
1361 PDM_DRVHLPR3_VERSION,
1362 pdmR3DrvHlp_Attach,
1363 pdmR3DrvHlp_Detach,
1364 pdmR3DrvHlp_DetachSelf,
1365 pdmR3DrvHlp_MountPrepare,
1366 pdmR3DrvHlp_AssertEMT,
1367 pdmR3DrvHlp_AssertOther,
1368 pdmR3DrvHlp_VMSetError,
1369 pdmR3DrvHlp_VMSetErrorV,
1370 pdmR3DrvHlp_VMSetRuntimeError,
1371 pdmR3DrvHlp_VMSetRuntimeErrorV,
1372 pdmR3DrvHlp_VMState,
1373 pdmR3DrvHlp_VMTeleportedAndNotFullyResumedYet,
1374 pdmR3DrvHlp_GetSupDrvSession,
1375 pdmR3DrvHlp_QueueCreate,
1376 pdmR3DrvHlp_TMGetVirtualFreq,
1377 pdmR3DrvHlp_TMGetVirtualTime,
1378 pdmR3DrvHlp_TMTimerCreate,
1379 pdmR3DrvHlp_SSMRegister,
1380 pdmR3DrvHlp_SSMDeregister,
1381 pdmR3DrvHlp_STAMRegister,
1382 pdmR3DrvHlp_STAMRegisterF,
1383 pdmR3DrvHlp_STAMRegisterV,
1384 pdmR3DrvHlp_STAMDeregister,
1385 pdmR3DrvHlp_SUPCallVMMR0Ex,
1386 pdmR3DrvHlp_USBRegisterHub,
1387 pdmR3DrvHlp_SetAsyncNotification,
1388 pdmR3DrvHlp_AsyncNotificationCompleted,
1389 pdmR3DrvHlp_ThreadCreate,
1390 pdmR3DrvHlp_AsyncCompletionTemplateCreate,
1391 pdmR3DrvHlp_LdrGetRCInterfaceSymbols,
1392 pdmR3DrvHlp_LdrGetR0InterfaceSymbols,
1393 pdmR3DrvHlp_CritSectInit,
1394 pdmR3DrvHlp_CallR0,
1395 PDM_DRVHLPR3_VERSION /* u32TheEnd */
1396};
1397
1398/** @} */
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