PDMDriver.cpp revision 06dc6eb95cf33b2b83f0d07c602d1ca20a575663
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * PDM - Pluggable Device and Driver Manager, Driver parts.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * available from http://www.virtualbox.org. This file is free software;
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * you can redistribute it and/or modify it under the terms of the GNU
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * General Public License (GPL) as published by the Free Software
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * additional information or have any questions.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync/*******************************************************************************
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync* Header Files *
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync*******************************************************************************/
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync/*******************************************************************************
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync* Structures and Typedefs *
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync*******************************************************************************/
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Internal callback structure pointer.
2c95722bb302f4ce9454d04324b09314c0ccc038vboxsync * The main purpose is to define the extra data we associate
2c95722bb302f4ce9454d04324b09314c0ccc038vboxsync * with PDMDRVREGCB so we can find the VM instance and so on.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync /** The callback structure. */
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync /** A bit of padding. */
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync /** VM Handle. */
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync/*******************************************************************************
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync* Internal Functions *
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync*******************************************************************************/
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsyncstatic DECLCALLBACK(int) pdmR3DrvRegister(PCPDMDRVREGCB pCallbacks, PCPDMDRVREG pReg);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsyncstatic int pdmR3DrvLoad(PVM pVM, PPDMDRVREGCBINT pRegCB, const char *pszFilename, const char *pszName);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Register external drivers
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @returns VBox status code.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @param pVM The VM to operate on.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @param pfnCallback Driver registration callback
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsyncVMMR3DECL(int) PDMR3RegisterDrivers(PVM pVM, FNPDMVBOXDRIVERSREGISTER pfnCallback)
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * The registration callbacks.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgFailed(("VBoxDriversRegister failed with rc=%Rrc\n"));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * This function will initialize the drivers for this VM instance.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * First of all this mean loading the builtin drivers and letting them
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * register themselves. Beyond that any additional driver modules are
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * loaded and called for registration.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @returns VBox status code.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @param pVM VM Handle.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertRelease(!(RT_OFFSETOF(PDMDRVINS, achInstanceData) & 15));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertRelease(sizeof(pDrvInsAssert->Internal.s) <= sizeof(pDrvInsAssert->Internal.padding));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * The registration callbacks.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Load the builtin module
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync PCFGMNODE pDriversNode = CFGMR3GetChild(CFGMR3GetRoot(pVM), "PDM/Drivers");
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync int rc = CFGMR3QueryBool(pDriversNode, "LoadBuiltin", &fLoadBuiltin);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT)
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgFailed(("Configuration error: Querying boolean \"LoadBuiltin\" failed with %Rrc\n", rc));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync /* make filename */
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync char *pszFilename = pdmR3FileR3("VBoxDD", /*fShared=*/true);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync rc = pdmR3DrvLoad(pVM, &RegCB, pszFilename, "VBoxDD");
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Load additional driver modules.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync for (PCFGMNODE pCur = CFGMR3GetFirstChild(pDriversNode); pCur; pCur = CFGMR3GetNextChild(pCur))
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Get the name and path.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync rc = CFGMR3GetName(pCur, &szName[0], sizeof(szName));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgFailed(("configuration error: The module name is too long, cchName=%zu.\n", CFGMR3GetNameLen(pCur)));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync /* the path is optional, if no path the module name + path is used. */
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync rc = CFGMR3QueryString(pCur, "Path", &szFilename[0], sizeof(szFilename));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT)
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgFailed(("configuration error: Failure to query the module path, rc=%Rrc.\n", rc));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync /* prepend path? */
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgFailed(("Filename too long! cch=%d '%s'\n", cch, psz));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Load the module and register it's drivers.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync rc = pdmR3DrvLoad(pVM, &RegCB, szFilename, szName);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Loads one driver module and call the registration entry point.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @returns VBox status code.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @param pVM VM handle.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @param pRegCB The registration callback stuff.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @param pszFilename Module filename.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @param pszName Module name.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsyncstatic int pdmR3DrvLoad(PVM pVM, PPDMDRVREGCBINT pRegCB, const char *pszFilename, const char *pszName)
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync int rc = pdmR3LoadR3U(pVM->pUVM, pszFilename, pszName);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Get the registration export and call it.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync rc = PDMR3LdrGetSymbolR3(pVM, pszName, "VBoxDriversRegister", (void **)&pfnVBoxDriversRegister);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync Log(("PDM: Calling VBoxDriversRegister (%p) of %s (%s)\n", pfnVBoxDriversRegister, pszName, pszFilename));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync rc = pfnVBoxDriversRegister(&pRegCB->Core, VBOX_VERSION);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync Log(("PDM: Successfully loaded driver module %s (%s).\n", pszName, pszFilename));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgFailed(("VBoxDriversRegister failed with rc=%Rrc\n"));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgFailed(("Failed to locate 'VBoxDriversRegister' in %s (%s) rc=%Rrc\n", pszName, pszFilename, rc));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgFailed(("Failed to load %s (%s) rc=%Rrc!\n", pszName, pszFilename, rc));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync/** @interface_method_impl{PDMDRVREGCB,pfnRegister} */
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsyncstatic DECLCALLBACK(int) pdmR3DrvRegister(PCPDMDRVREGCB pCallbacks, PCPDMDRVREG pReg)
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Validate the registration structure.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgReturn(pReg->u32Version == PDM_DRVREG_VERSION,
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertReturn(pReg->szName[0], VERR_PDM_INVALID_DRIVER_REGISTRATION);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgReturn(memchr(pReg->szName, '\0', sizeof(pReg->szName)),
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgReturn( !(pReg->fFlags & PDM_DRVREG_FLAGS_R0)
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync && memchr(pReg->szR0Mod, '\0', sizeof(pReg->szR0Mod))),
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync ("%s: %.*s\n", pReg->szName, sizeof(pReg->szR0Mod), pReg->szR0Mod),
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgReturn( !(pReg->fFlags & PDM_DRVREG_FLAGS_RC)
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync && memchr(pReg->szRCMod, '\0', sizeof(pReg->szRCMod))),
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync ("%s: %.*s\n", pReg->szName, sizeof(pReg->szRCMod), pReg->szRCMod),
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgReturn(!(pReg->fFlags & ~(PDM_DRVREG_FLAGS_HOST_BITS_MASK | PDM_DRVREG_FLAGS_R0 | PDM_DRVREG_FLAGS_RC)),
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgReturn((pReg->fFlags & PDM_DRVREG_FLAGS_HOST_BITS_MASK) == PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgReturn(VALID_PTR(pReg->pfnRelocate) || !(pReg->fFlags & PDM_DRVREG_FLAGS_RC),
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgReturn(pReg->u32VersionEnd == PDM_DRVREG_VERSION,
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Check for duplicate and find FIFO entry at the same time.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync PCPDMDRVREGCBINT pRegCB = (PCPDMDRVREGCBINT)pCallbacks;
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgFailed(("Driver '%s' already exists\n", pReg->szName));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Allocate new driver structure and insert it into the list.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync pDrv = (PPDMDRV)MMR3HeapAlloc(pRegCB->pVM, MM_TAG_PDM_DRIVER, sizeof(*pDrv));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync Log(("PDM: Registered driver '%s'\n", pReg->szName));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Lookups a driver structure by name.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @internal
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsyncPPDMDRV pdmR3DrvLookup(PVM pVM, const char *pszName)
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync for (PPDMDRV pDrv = pVM->pdm.s.pDrvs; pDrv; pDrv = pDrv->pNext)
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Instantiate a driver.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @returns VBox status code, including informational statuses.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @param pVM The VM handle.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @param pNode The CFGM node for the driver.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @param pBaseInterface The base interface.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @param pDrvAbove The driver above it. NULL if it's the top-most
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @param pLun The LUN the driver is being attached to. NULL
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * if we're instantiating a driver chain before
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * attaching it - untested.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @param ppBaseInterface Where to return the pointer to the base
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * interface of the newly created driver.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @remarks Recursive calls to this function is normal as the drivers will
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * attach to anything below them during the pfnContruct call.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsyncint pdmR3DrvInstantiate(PVM pVM, PCFGMNODE pNode, PPDMIBASE pBaseInterface, PPDMDRVINS pDrvAbove,
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync Assert(!pDrvAbove || !pDrvAbove->Internal.s.pDown);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync Assert(pBaseInterface->pfnQueryInterface(pBaseInterface, PDMIBASE_IID) == pBaseInterface);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Find the driver.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync int rc = CFGMR3QueryStringAlloc(pNode, "Driver", &pszName);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync /* config node */
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync PCFGMNODE pConfigNode = CFGMR3GetChild(pNode, "Config");
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync rc = CFGMR3InsertNode(pNode, "Config", &pConfigNode);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Allocate the driver instance.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync size_t cb = RT_OFFSETOF(PDMDRVINS, achInstanceData[pDrv->pReg->cbInstance]);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync bool const fHyperHeap = !!(pDrv->pReg->fFlags & (PDM_DRVREG_FLAGS_R0 | PDM_DRVREG_FLAGS_RC));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync rc = MMHyperAlloc(pVM, cb, 64, MM_TAG_PDM_DRIVER, (void **)&pNew);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync rc = MMR3HeapAllocZEx(pVM, MM_TAG_PDM_DRIVER, cb, (void **)&pNew);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Initialize the instance structure (declaration order).
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync pNew->Internal.s.pUp = pDrvAbove ? pDrvAbove : NULL;
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync //pNew->Internal.s.pDown = NULL;
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync pNew->Internal.s.pVMR0 = pDrv->pReg->fFlags & PDM_DRVREG_FLAGS_R0 ? pVM->pVMR0 : NIL_RTR0PTR;
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync pNew->Internal.s.pVMRC = pDrv->pReg->fFlags & PDM_DRVREG_FLAGS_RC ? pVM->pVMRC : NIL_RTRCPTR;
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync //pNew->Internal.s.fDetaching = false;
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync //pNew->Internal.s.fVMReset = false;
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync //pNew->Internal.s.pfnAsyncNotify = NULL;
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync Assert(!pDrvAbove || pBaseInterface == &pDrvAbove->IBase);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync //pNew->pDownBase = NULL;
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync //pNew->IBase.pfnQueryInterface = NULL;
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync pNew->pvInstanceDataR3 = &pNew->achInstanceData[0];
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync pNew->pvInstanceDataR0 = MMHyperR3ToR0(pVM, &pNew->achInstanceData[0]);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync rc = PDMR3LdrGetSymbolR0(pVM, NULL, "g_pdmR0DrvHlp", &pNew->pHlpR0);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync pNew->pvInstanceDataR0 = MMHyperR3ToRC(pVM, &pNew->achInstanceData[0]);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync rc = PDMR3LdrGetSymbolRC(pVM, NULL, "g_pdmRCDrvHlp", &pNew->pHlpRC);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Link with it with the driver above / LUN.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Invoke the constructor.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync rc = pDrv->pReg->pfnConstruct(pNew, pNew->pCfg, 0 /*fFlags*/);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync Assert(pNew->IBase.pfnQueryInterface(&pNew->IBase, PDMIBASE_IID) == &pNew->IBase);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync /* Success! */
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync Log(("PDM: Attached driver %p:'%s'/%d to LUN#%d on device '%s'/%d, pDrvAbove=%p:'%s'/%d\n",
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync pLun->pDevIns ? pLun->pDevIns->pReg->szName : pLun->pUsbIns->pReg->szName,
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync pLun->pDevIns ? pLun->pDevIns->iInstance : pLun->pUsbIns->iInstance,
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync pDrvAbove, pDrvAbove ? pDrvAbove->pReg->szName : "", pDrvAbove ? pDrvAbove->iInstance : -1));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync Log(("PDM: Attached driver %p:'%s'/%d, pDrvAbove=%p:'%s'/%d\n",
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync pDrvAbove, pDrvAbove ? pDrvAbove->pReg->szName : "", pDrvAbove ? pDrvAbove->iInstance : -1));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync pdmR3DrvDestroyChain(pNew, PDM_TACH_FLAGS_NO_CALLBACKS);
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgFailed(("Failed to allocate %d bytes for instantiating driver '%s'\n", cb, pszName));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgFailed(("Failed to create Config node! rc=%Rrc\n", rc));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgFailed(("Too many instances of driver '%s', max is %u\n", pszName, pDrv->pReg->cMaxInstances));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgFailed(("Driver '%s' wasn't found!\n", pszName));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgFailed(("Query for string value of \"Driver\" -> %Rrc\n", rc));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Detaches a driver from whatever it's attached to.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * This will of course lead to the destruction of the driver and all drivers below it in the chain.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @returns VINF_SUCCESS
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @param pDrvIns The driver instance to detach.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsyncint pdmR3DrvDetach(PPDMDRVINS pDrvIns, uint32_t fFlags)
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync LogFlow(("pdmR3DrvDetach: pDrvIns=%p '%s'/%d\n", pDrvIns, pDrvIns->pReg->szName, pDrvIns->iInstance));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Check that we're not doing this recursively, that could have unwanted sideeffects!
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgFailed(("Recursive detach! '%s'/%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Check that we actually can detach this instance.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * The requirement is that the driver/device above has a detach method.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync : !pDrvIns->Internal.s.pLun->pDevIns->pReg->pfnDetach)
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync AssertMsgFailed(("Cannot detach driver instance because the driver/device above doesn't support it!\n"));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Join paths with pdmR3DrvDestroyChain.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Destroys a driver chain starting with the specified driver.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * This is used when unplugging a device at run time.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @param pDrvIns Pointer to the driver instance to start with.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * @param fFlags PDM_TACH_FLAGS_NOT_HOT_PLUG, PDM_TACH_FLAGS_NO_CALLBACKS
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsyncvoid pdmR3DrvDestroyChain(PPDMDRVINS pDrvIns, uint32_t fFlags)
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Detach the bottommost driver until we've detached pDrvIns.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync /* find the driver to detach. */
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync LogFlow(("pdmR3DrvDestroyChain: pCur=%p '%s'/%d\n", pCur, pCur->pReg->szName, pCur->iInstance));
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync * Unlink it and notify parent.
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync /* driver parent */
ae41886ba231ade1b868dd32ff24ee49813ebbabvboxsync if (!(fFlags & PDM_TACH_FLAGS_NO_CALLBACKS) && pParent->pReg->pfnDetach)
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync /* device parent */
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync if (!(fFlags & PDM_TACH_FLAGS_NO_CALLBACKS) && pLun->pDevIns->pReg->pfnDetach)
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync pLun->pDevIns->pReg->pfnDetach(pLun->pDevIns, pLun->iLun, fFlags);
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync * Call destructor.
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync * Free all resources allocated by the driver.
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync /* Queues. */
b377a71756cce9f39d25b561f72bfa33ce8a39devboxsync /* Timers. */
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync /* SSM data units. */
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync /* PDM threads. */
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync /* Finally, the driver it self. */
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync ASMMemFill32(pCur, RT_OFFSETOF(PDMDRVINS, achInstanceData[pCur->pReg->cbInstance]), 0xdeadd0d0);
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync/** @name Driver Helpers
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync/** @interface_method_impl{PDMDRVHLP,pfnAttach} */
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsyncstatic DECLCALLBACK(int) pdmR3DrvHlp_Attach(PPDMDRVINS pDrvIns, uint32_t fFlags, PPDMIBASE *ppBaseInterface)
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync LogFlow(("pdmR3DrvHlp_Attach: caller='%s'/%d: fFlags=%#x\n", pDrvIns->pReg->szName, pDrvIns->iInstance, fFlags));
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync Assert(!(fFlags & ~(PDM_TACH_FLAGS_NOT_HOT_PLUG)));
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync * Check that there isn't anything attached already.
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync Assert(pDrvIns->Internal.s.pLun->pBottom == pDrvIns);
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync * Get the attached driver configuration.
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync PCFGMNODE pNode = CFGMR3GetChild(pDrvIns->Internal.s.pCfgHandle, "AttachedDriver");
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync rc = pdmR3DrvInstantiate(pVM, pNode, &pDrvIns->IBase, pDrvIns, pDrvIns->Internal.s.pLun, ppBaseInterface);
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync AssertMsgFailed(("Already got a driver attached. The driver should keep track of such things!\n"));
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync LogFlow(("pdmR3DrvHlp_Attach: caller='%s'/%d: return %Rrc\n",
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync/** @interface_method_impl{PDMDRVHLP,pfnDetach} */
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsyncstatic DECLCALLBACK(int) pdmR3DrvHlp_Detach(PPDMDRVINS pDrvIns, uint32_t fFlags)
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync LogFlow(("pdmR3DrvHlp_Detach: caller='%s'/%d: fFlags=%#x\n",
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync pDrvIns->pReg->szName, pDrvIns->iInstance, fFlags));
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync * Anything attached?
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync rc = pdmR3DrvDetach(pDrvIns->Internal.s.pDown, fFlags);
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync LogFlow(("pdmR3DrvHlp_Detach: caller='%s'/%d: returns %Rrc\n",
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync/** @interface_method_impl{PDMDRVHLP,pfnDetachSelf} */
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsyncstatic DECLCALLBACK(int) pdmR3DrvHlp_DetachSelf(PPDMDRVINS pDrvIns, uint32_t fFlags)
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync LogFlow(("pdmR3DrvHlp_DetachSelf: caller='%s'/%d: fFlags=%#x\n",
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync pDrvIns->pReg->szName, pDrvIns->iInstance, fFlags));
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync LogFlow(("pdmR3DrvHlp_Detach: returns %Rrc\n", rc)); /* pDrvIns is freed by now. */
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync/** @interface_method_impl{PDMDRVHLP,pfnMountPrepare} */
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsyncstatic DECLCALLBACK(int) pdmR3DrvHlp_MountPrepare(PPDMDRVINS pDrvIns, const char *pszFilename, const char *pszCoreDriver)
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync LogFlow(("pdmR3DrvHlp_MountPrepare: caller='%s'/%d: pszFilename=%p:{%s} pszCoreDriver=%p:{%s}\n",
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync pDrvIns->pReg->szName, pDrvIns->iInstance, pszFilename, pszFilename, pszCoreDriver, pszCoreDriver));
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync * Do the caller have anything attached below itself?
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync AssertMsgFailed(("Cannot prepare a mount when something's attached to you!\n"));
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync * We're asked to prepare, so we'll start off by nuking the
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync * attached configuration tree.
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync PCFGMNODE pNode = CFGMR3GetChild(pDrvIns->Internal.s.pCfgHandle, "AttachedDriver");
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync * If there is no core driver, we'll have to probe for it.
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync /** @todo implement image probing. */
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync * Construct the basic attached driver configuration.
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync int rc = CFGMR3InsertNode(pDrvIns->Internal.s.pCfgHandle, "AttachedDriver", &pNode);
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync rc = CFGMR3InsertString(pNode, "Driver", pszCoreDriver);
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync rc = CFGMR3InsertString(pCfg, "Path", pszFilename);
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync LogFlow(("pdmR3DrvHlp_MountPrepare: caller='%s'/%d: returns %Rrc (Driver=%s)\n",
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync pDrvIns->pReg->szName, pDrvIns->iInstance, rc, pszCoreDriver));
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync AssertMsgFailed(("Path string insert failed, rc=%Rrc\n", rc));
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync AssertMsgFailed(("Config node failed, rc=%Rrc\n", rc));
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync AssertMsgFailed(("Driver string insert failed, rc=%Rrc\n", rc));
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync AssertMsgFailed(("AttachedDriver node insert failed, rc=%Rrc\n", rc));
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync LogFlow(("pdmR3DrvHlp_MountPrepare: caller='%s'/%d: returns %Rrc\n",
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync/** @interface_method_impl{PDMDRVHLP,pfnAssertEMT} */
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsyncstatic DECLCALLBACK(bool) pdmR3DrvHlp_AssertEMT(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction)
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync return true;
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync RTStrPrintf(szMsg, sizeof(szMsg), "AssertEMT '%s'/%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance);
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync RTAssertMsg1Weak(szMsg, iLine, pszFile, pszFunction);
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync return false;
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync/** @interface_method_impl{PDMDRVHLP,pfnAssertOther} */
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsyncstatic DECLCALLBACK(bool) pdmR3DrvHlp_AssertOther(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction)
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync return true;
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync RTStrPrintf(szMsg, sizeof(szMsg), "AssertOther '%s'/%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance);
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync RTAssertMsg1Weak(szMsg, iLine, pszFile, pszFunction);
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync return false;
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync/** @interface_method_impl{PDMDRVHLP,pfnVMSetError} */
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsyncstatic DECLCALLBACK(int) pdmR3DrvHlp_VMSetError(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync int rc2 = VMSetErrorV(pDrvIns->Internal.s.pVMR3, rc, RT_SRC_POS_ARGS, pszFormat, args); Assert(rc2 == rc); NOREF(rc2);
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsync/** @interface_method_impl{PDMDRVHLP,pfnVMSetErrorV} */
bc0c1e33e433d1276ea1606ace81f61594ee3838vboxsyncstatic DECLCALLBACK(int) pdmR3DrvHlp_VMSetErrorV(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)
int rc2 = VMSetErrorV(pDrvIns->Internal.s.pVMR3, rc, RT_SRC_POS_ARGS, pszFormat, va); Assert(rc2 == rc); NOREF(rc2);
return rc;
static DECLCALLBACK(int) pdmR3DrvHlp_VMSetRuntimeError(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...)
return rc;
static DECLCALLBACK(int) pdmR3DrvHlp_VMSetRuntimeErrorV(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va)
return rc;
LogFlow(("pdmR3DrvHlp_VMState: caller='%s'/%d: returns %d (%s)\n", pDrvIns->pReg->szName, pDrvIns->iInstance,
return enmVMState;
LogFlow(("pdmR3DrvHlp_VMState: caller='%s'/%d: returns %RTbool)\n", pDrvIns->pReg->szName, pDrvIns->iInstance,
fRc));
return fRc;
static DECLCALLBACK(int) pdmR3DrvHlp_PDMQueueCreate(PPDMDRVINS pDrvIns, uint32_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
LogFlow(("pdmR3DrvHlp_PDMQueueCreate: caller='%s'/%d: cbItem=%d cItems=%d cMilliesInterval=%d pfnCallback=%p pszName=%p:{%s} ppQueue=%p\n",
pDrvIns->pReg->szName, pDrvIns->iInstance, cbItem, cItems, cMilliesInterval, pfnCallback, pszName, pszName, ppQueue, ppQueue));
int rc = PDMR3QueueCreateDriver(pVM, pDrvIns, cbItem, cItems, cMilliesInterval, pfnCallback, pszName, ppQueue);
LogFlow(("pdmR3DrvHlp_PDMQueueCreate: caller='%s'/%d: returns %Rrc *ppQueue=%p\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc, *ppQueue));
return rc;
static DECLCALLBACK(int) pdmR3DrvHlp_TMTimerCreate(PPDMDRVINS pDrvIns, TMCLOCK enmClock, PFNTMTIMERDRV pfnCallback, void *pvUser, uint32_t fFlags, const char *pszDesc, PPTMTIMERR3 ppTimer)
LogFlow(("pdmR3DrvHlp_TMTimerCreate: caller='%s'/%d: enmClock=%d pfnCallback=%p pvUser=%p fFlags=%#x pszDesc=%p:{%s} ppTimer=%p\n",
pDrvIns->pReg->szName, pDrvIns->iInstance, enmClock, pfnCallback, pvUser, fFlags, pszDesc, pszDesc, ppTimer));
int rc = TMR3TimerCreateDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, enmClock, pfnCallback, pvUser, fFlags, pszDesc, ppTimer);
LogFlow(("pdmR3DrvHlp_TMTimerCreate: caller='%s'/%d: returns %Rrc *ppTimer=%p\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc, *ppTimer));
return rc;
static DECLCALLBACK(int) pdmR3DrvHlp_SSMRegister(PPDMDRVINS pDrvIns, uint32_t uVersion, size_t cbGuess,
" pfnLivePrep=%p pfnLiveExec=%p pfnLiveVote=%p pfnSavePrep=%p pfnSaveExec=%p pfnSaveDone=%p pszLoadPrep=%p pfnLoadExec=%p pfnLoaddone=%p\n",
int rc = SSMR3RegisterDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, pDrvIns->pReg->szName, pDrvIns->iInstance,
LogFlow(("pdmR3DrvHlp_SSMRegister: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
return rc;
static DECLCALLBACK(int) pdmR3DrvHlp_SSMDeregister(PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance)
LogFlow(("pdmR3DrvHlp_SSMDeregister: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
return rc;
static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegister(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, const char *pszName, STAMUNIT enmUnit, const char *pszDesc)
/** @todo track the samples so they can be dumped & deregistered when the driver instance is destroyed.
static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegisterF(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
int rc = STAMR3RegisterV(pDrvIns->Internal.s.pVMR3, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, args);
static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegisterV(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
int rc = STAMR3RegisterV(pDrvIns->Internal.s.pVMR3, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, args);
return rc;
static DECLCALLBACK(int) pdmR3DrvHlp_SUPCallVMMR0Ex(PPDMDRVINS pDrvIns, unsigned uOperation, void *pvArg, unsigned cbArg)
int rc;
rc = SUPR3CallVMMR0Ex(pDrvIns->Internal.s.pVMR3->pVMR0, NIL_VMCPUID, uOperation, 0, (PSUPVMMR0REQHDR)pvArg);
LogFlow(("pdmR3DrvHlp_SUPCallVMMR0Ex: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
return rc;
static DECLCALLBACK(int) pdmR3DrvHlp_USBRegisterHub(PPDMDRVINS pDrvIns, uint32_t fVersions, uint32_t cPorts, PCPDMUSBHUBREG pUsbHubReg, PPCPDMUSBHUBHLP ppUsbHubHlp)
LogFlow(("pdmR3DrvHlp_USBRegisterHub: caller='%s'/%d: fVersions=%#x cPorts=%#x pUsbHubReg=%p ppUsbHubHlp=%p\n",
#ifdef VBOX_WITH_USB
int rc = pdmR3UsbRegisterHub(pDrvIns->Internal.s.pVMR3, pDrvIns, fVersions, cPorts, pUsbHubReg, ppUsbHubHlp);
LogFlow(("pdmR3DrvHlp_USBRegisterHub: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
return rc;
static DECLCALLBACK(int) pdmR3DrvHlp_SetAsyncNotification(PPDMDRVINS pDrvIns, PFNPDMDRVASYNCNOTIFY pfnAsyncNotify)
LogFlow(("pdmR3DrvHlp_SetAsyncNotification: caller='%s'/%d: pfnAsyncNotify=%p\n", pDrvIns->pReg->szName, pDrvIns->iInstance, pfnAsyncNotify));
AssertStmt(pDrvIns->Internal.s.fVMSuspended || pDrvIns->Internal.s.fVMReset, rc = VERR_WRONG_ORDER);
LogFlow(("pdmR3DrvHlp_SetAsyncNotification: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
return rc;
LogFlow(("pdmR3DrvHlp_AsyncNotificationCompleted: caller='%s'/%d:\n", pDrvIns->pReg->szName, pDrvIns->iInstance));
LogFlow(("pdmR3DrvHlp_AsyncNotificationCompleted: caller='%s'/%d: enmVMState=%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance, enmVMState));
static DECLCALLBACK(int) pdmR3DrvHlp_PDMThreadCreate(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
LogFlow(("pdmR3DrvHlp_PDMThreadCreate: caller='%s'/%d: ppThread=%p pvUser=%p pfnThread=%p pfnWakeup=%p cbStack=%#zx enmType=%d pszName=%p:{%s}\n",
pDrvIns->pReg->szName, pDrvIns->iInstance, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName, pszName));
int rc = pdmR3ThreadCreateDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
LogFlow(("pdmR3DrvHlp_PDMThreadCreate: caller='%s'/%d: returns %Rrc *ppThread=%RTthrd\n", pDrvIns->pReg->szName, pDrvIns->iInstance,
return rc;
static DECLCALLBACK(int) pdmR3DrvHlp_PDMAsyncCompletionTemplateCreate(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate,
const char *pszDesc)
LogFlow(("pdmR3DrvHlp_PDMAsyncCompletionTemplateCreate: caller='%s'/%d: ppTemplate=%p pfnCompleted=%p pszDesc=%p:{%s}\n",
int rc = PDMR3AsyncCompletionTemplateCreateDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, ppTemplate, pfnCompleted, pvTemplateUser, pszDesc);
LogFlow(("pdmR3DrvHlp_PDMAsyncCompletionTemplateCreate: caller='%s'/%d: returns %Rrc *ppThread=%p\n", pDrvIns->pReg->szName,
return rc;
static DECLCALLBACK(int) pdmR3DrvHlp_PDMLdrGetRCInterfaceSymbols(PPDMDRVINS pDrvIns, void *pvInterface, size_t cbInterface,
LogFlow(("pdmR3DrvHlp_PDMLdrGetRCInterfaceSymbols: caller='%s'/%d: pvInterface=%p cbInterface=%zu pszSymPrefix=%p:{%s} pszSymList=%p:{%s}\n",
pDrvIns->pReg->szName, pDrvIns->iInstance, pvInterface, cbInterface, pszSymPrefix, pszSymPrefix, pszSymList, pszSymList));
int rc;
AssertMsgFailed(("Invalid prefix '%s' for '%s'; must start with 'drv' and contain the driver name!\n",
LogFlow(("pdmR3DrvHlp_PDMLdrGetRCInterfaceSymbols: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName,
return rc;
static DECLCALLBACK(int) pdmR3DrvHlp_PDMLdrGetR0InterfaceSymbols(PPDMDRVINS pDrvIns, void *pvInterface, size_t cbInterface,
LogFlow(("pdmR3DrvHlp_PDMLdrGetR0InterfaceSymbols: caller='%s'/%d: pvInterface=%p cbInterface=%zu pszSymPrefix=%p:{%s} pszSymList=%p:{%s}\n",
pDrvIns->pReg->szName, pDrvIns->iInstance, pvInterface, cbInterface, pszSymPrefix, pszSymPrefix, pszSymList, pszSymList));
int rc;
AssertMsgFailed(("Invalid prefix '%s' for '%s'; must start with 'drv' and contain the driver name!\n",
LogFlow(("pdmR3DrvHlp_PDMLdrGetR0InterfaceSymbols: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName,
return rc;