PDMDriver.cpp revision 437689b883dcb51ae51ab732143cad8bee25456b
/* $Id$ */
/** @file
* PDM - Pluggable Device and Driver Manager, Driver parts.
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_PDM_DRIVER
#include "PDMInternal.h"
/*******************************************************************************
* Structures and Typedefs *
*******************************************************************************/
/**
* Internal callback structure pointer.
*
* The main purpose is to define the extra data we associate
* with PDMDRVREGCB so we can find the VM instance and so on.
*/
typedef struct PDMDRVREGCBINT
{
/** The callback structure. */
/** A bit of padding. */
/** VM Handle. */
typedef const PDMDRVREGCBINT *PCPDMDRVREGCBINT;
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
/** @def PDMDRV_ASSERT_DRVINS
* Asserts the validity of the driver instance.
*/
#ifdef VBOX_STRICT
# define PDMDRV_ASSERT_DRVINS(pDrvIns) \
do { \
} while (0)
#else
# define PDMDRV_ASSERT_DRVINS(pDrvIns) do { } while (0)
#endif
/** @} */
static int pdmR3DrvLoad(PVM pVM, PPDMDRVREGCBINT pRegCB, const char *pszFilename, const char *pszName);
/**
* Register external drivers
*
* @returns VBox status code.
* @param pVM The VM to operate on.
* @param pfnCallback Driver registration callback
*/
{
/*
* The registration callbacks.
*/
if (RT_FAILURE(rc))
AssertMsgFailed(("VBoxDriversRegister failed with rc=%Rrc\n"));
return rc;
}
/**
* This function will initialize the drivers for this VM instance.
*
* First of all this mean loading the builtin drivers and letting them
* register themselves. Beyond that any additional driver modules are
* loaded and called for registration.
*
* @returns VBox status code.
* @param pVM VM Handle.
*/
{
LogFlow(("pdmR3DrvInit:\n"));
/*
* The registration callbacks.
*/
/*
* Load the builtin module
*/
bool fLoadBuiltin;
fLoadBuiltin = true;
else if (RT_FAILURE(rc))
{
return rc;
}
if (fLoadBuiltin)
{
/* make filename */
if (!pszFilename)
return VERR_NO_TMP_MEMORY;
if (RT_FAILURE(rc))
return rc;
}
/*
* Load additional driver modules.
*/
{
/*
* Get the name and path.
*/
char szName[PDMMOD_NAME_LEN];
if (rc == VERR_CFGM_NOT_ENOUGH_SPACE)
{
AssertMsgFailed(("configuration error: The module name is too long, cchName=%zu.\n", CFGMR3GetNameLen(pCur)));
return VERR_PDM_MODULE_NAME_TOO_LONG;
}
else if (RT_FAILURE(rc))
{
return rc;
}
/* the path is optional, if no path the module name + path is used. */
char szFilename[RTPATH_MAX];
else if (RT_FAILURE(rc))
{
return rc;
}
/* prepend path? */
if (!RTPathHavePath(szFilename))
{
if (!psz)
return VERR_NO_TMP_MEMORY;
if (cch > sizeof(szFilename))
{
return VERR_FILENAME_TOO_LONG;
}
}
/*
* Load the module and register it's drivers.
*/
if (RT_FAILURE(rc))
return rc;
}
LogFlow(("pdmR3DrvInit: returns VINF_SUCCESS\n"));
return VINF_SUCCESS;
}
/**
* Loads one driver module and call the registration entry point.
*
* @returns VBox status code.
* @param pVM VM handle.
* @param pRegCB The registration callback stuff.
* @param pszFilename Module filename.
* @param pszName Module name.
*/
static int pdmR3DrvLoad(PVM pVM, PPDMDRVREGCBINT pRegCB, const char *pszFilename, const char *pszName)
{
/*
* Load it.
*/
if (RT_SUCCESS(rc))
{
/*
* Get the registration export and call it.
*/
if (RT_SUCCESS(rc))
{
Log(("PDM: Calling VBoxDriversRegister (%p) of %s (%s)\n", pfnVBoxDriversRegister, pszName, pszFilename));
if (RT_SUCCESS(rc))
else
AssertMsgFailed(("VBoxDriversRegister failed with rc=%Rrc\n"));
}
else
{
AssertMsgFailed(("Failed to locate 'VBoxDriversRegister' in %s (%s) rc=%Rrc\n", pszName, pszFilename, rc));
if (rc == VERR_SYMBOL_NOT_FOUND)
}
}
else
return rc;
}
/** @interface_method_impl{PDMDRVREGCB,pfnRegister} */
{
/*
* Validate the registration structure.
*/
AssertMsgReturn(!(pReg->fFlags & ~(PDM_DRVREG_FLAGS_HOST_BITS_MASK | PDM_DRVREG_FLAGS_R0 | PDM_DRVREG_FLAGS_RC)),
AssertMsgReturn((pReg->fFlags & PDM_DRVREG_FLAGS_HOST_BITS_MASK) == PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
/*
* Check for duplicate and find FIFO entry at the same time.
*/
{
{
return VERR_PDM_DRIVER_NAME_CLASH;
}
}
/*
* Allocate new driver structure and insert it into the list.
*/
if (pDrv)
{
pDrv->cInstances = 0;
pDrv->iNextInstance = 0;
if (pDrvPrev)
else
return VINF_SUCCESS;
}
return VERR_NO_MEMORY;
}
/**
* Lookups a driver structure by name.
* @internal
*/
{
return pDrv;
return NULL;
}
/**
* Instantiate a driver.
*
* @returns VBox status code, including informational statuses.
*
* @param pVM The VM handle.
* @param pNode The CFGM node for the driver.
* @param pBaseInterface The base interface.
* @param pDrvAbove The driver above it. NULL if it's the top-most
* driver.
* @param pLun The LUN the driver is being attached to. NULL
* if we're instantiating a driver chain before
* attaching it - untested.
* @param ppBaseInterface Where to return the pointer to the base
* interface of the newly created driver.
*
* @remarks Recursive calls to this function is normal as the drivers will
* attach to anything below them during the pfnContruct call.
*/
{
/*
* Find the driver.
*/
char *pszName;
if (RT_SUCCESS(rc))
{
if ( pDrv
{
/* config node */
if (!pConfigNode)
if (RT_SUCCESS(rc))
{
/*
* Allocate the driver instance.
*/
if (fHyperHeap)
else
if (pNew)
{
/*
* Initialize the instance structure (declaration order).
*/
//pNew->Internal.s.pDown = NULL;
//pNew->Internal.s.fDetaching = false;
//pNew->Internal.s.fVMReset = false;
//pNew->Internal.s.pfnAsyncNotify = NULL;
//pNew->pDownBase = NULL;
//pNew->IBase.pfnQueryInterface = NULL;
{
}
{
}
pDrv->iNextInstance++;
pDrv->cInstances++;
/*
* Link with it with the driver above / LUN.
*/
if (pDrvAbove)
{
}
else if (pLun)
if (pLun)
/*
* Invoke the constructor.
*/
if (RT_SUCCESS(rc))
{
/* Success! */
if (pLun)
Log(("PDM: Attached driver %p:'%s'/%d to LUN#%d on device '%s'/%d, pDrvAbove=%p:'%s'/%d\n",
else
Log(("PDM: Attached driver %p:'%s'/%d, pDrvAbove=%p:'%s'/%d\n",
}
else
}
else
{
rc = VERR_NO_MEMORY;
}
}
else
}
else if (pDrv)
{
AssertMsgFailed(("Too many instances of driver '%s', max is %u\n", pszName, pDrv->pReg->cMaxInstances));
}
else
{
}
}
else
{
if (rc == VERR_CFGM_VALUE_NOT_FOUND)
}
return rc;
}
/**
* Detaches a driver from whatever it's attached to.
* This will of course lead to the destruction of the driver and all drivers below it in the chain.
*
* @returns VINF_SUCCESS
* @param pDrvIns The driver instance to detach.
* @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
*/
{
LogFlow(("pdmR3DrvDetach: pDrvIns=%p '%s'/%d\n", pDrvIns, pDrvIns->pReg->szName, pDrvIns->iInstance));
/*
* Check that we're not doing this recursively, that could have unwanted sideeffects!
*/
{
return VINF_SUCCESS; }
/*
* Check that we actually can detach this instance.
*/
{
AssertMsgFailed(("Cannot detach driver instance because the driver/device above doesn't support it!\n"));
}
/*
* Join paths with pdmR3DrvDestroyChain.
*/
return VINF_SUCCESS;
}
/**
* Destroys a driver chain starting with the specified driver.
*
* This is used when unplugging a device at run time.
*
* @param pDrvIns Pointer to the driver instance to start with.
* @param fFlags PDM_TACH_FLAGS_NOT_HOT_PLUG, PDM_TACH_FLAGS_NO_CALLBACKS
* or 0.
*/
{
/*
* Detach the bottommost driver until we've detached pDrvIns.
*/
do
{
/* find the driver to detach. */
/*
* Unlink it and notify parent.
*/
{
/* driver parent */
}
else
{
/* device parent */
}
/*
* Call destructor.
*/
/*
* Free all resources allocated by the driver.
*/
/* Queues. */
/* Timers. */
/* SSM data units. */
/* PDM threads. */
/* Finally, the driver it self. */
if (fHyperHeap)
else
}
/** @name Driver Helpers
* @{
*/
/** @interface_method_impl{PDMDRVHLP,pfnAttach} */
static DECLCALLBACK(int) pdmR3DrvHlp_Attach(PPDMDRVINS pDrvIns, uint32_t fFlags, PPDMIBASE *ppBaseInterface)
{
LogFlow(("pdmR3DrvHlp_Attach: caller='%s'/%d: fFlags=%#x\n", pDrvIns->pReg->szName, pDrvIns->iInstance, fFlags));
/*
* Check that there isn't anything attached already.
*/
int rc;
{
/*
* Get the attached driver configuration.
*/
if (pNode)
rc = pdmR3DrvInstantiate(pVM, pNode, &pDrvIns->IBase, pDrvIns, pDrvIns->Internal.s.pLun, ppBaseInterface);
else
}
else
{
AssertMsgFailed(("Already got a driver attached. The driver should keep track of such things!\n"));
}
LogFlow(("pdmR3DrvHlp_Attach: caller='%s'/%d: return %Rrc\n",
return rc;
}
/** @interface_method_impl{PDMDRVHLP,pfnDetach} */
{
LogFlow(("pdmR3DrvHlp_Detach: caller='%s'/%d: fFlags=%#x\n",
/*
* Anything attached?
*/
int rc;
else
{
AssertMsgFailed(("Nothing attached!\n"));
}
LogFlow(("pdmR3DrvHlp_Detach: caller='%s'/%d: returns %Rrc\n",
return rc;
}
/** @interface_method_impl{PDMDRVHLP,pfnDetachSelf} */
{
LogFlow(("pdmR3DrvHlp_DetachSelf: caller='%s'/%d: fFlags=%#x\n",
return rc;
}
/** @interface_method_impl{PDMDRVHLP,pfnMountPrepare} */
static DECLCALLBACK(int) pdmR3DrvHlp_MountPrepare(PPDMDRVINS pDrvIns, const char *pszFilename, const char *pszCoreDriver)
{
LogFlow(("pdmR3DrvHlp_MountPrepare: caller='%s'/%d: pszFilename=%p:{%s} pszCoreDriver=%p:{%s}\n",
pDrvIns->pReg->szName, pDrvIns->iInstance, pszFilename, pszFilename, pszCoreDriver, pszCoreDriver));
/*
* Do the caller have anything attached below itself?
*/
{
AssertMsgFailed(("Cannot prepare a mount when something's attached to you!\n"));
return VERR_PDM_DRIVER_ALREADY_ATTACHED;
}
/*
* We're asked to prepare, so we'll start off by nuking the
* attached configuration tree.
*/
if (pNode)
/*
* If there is no core driver, we'll have to probe for it.
*/
if (!pszCoreDriver)
{
/** @todo implement image probing. */
AssertReleaseMsgFailed(("Not implemented!\n"));
return VERR_NOT_IMPLEMENTED;
}
/*
* Construct the basic attached driver configuration.
*/
if (RT_SUCCESS(rc))
{
if (RT_SUCCESS(rc))
{
if (RT_SUCCESS(rc))
{
if (RT_SUCCESS(rc))
{
LogFlow(("pdmR3DrvHlp_MountPrepare: caller='%s'/%d: returns %Rrc (Driver=%s)\n",
return rc;
}
else
}
else
}
else
}
else
LogFlow(("pdmR3DrvHlp_MountPrepare: caller='%s'/%d: returns %Rrc\n",
return rc;
}
/** @interface_method_impl{PDMDRVHLP,pfnAssertEMT} */
static DECLCALLBACK(bool) pdmR3DrvHlp_AssertEMT(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction)
{
return true;
char szMsg[100];
RTStrPrintf(szMsg, sizeof(szMsg), "AssertEMT '%s'/%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance);
return false;
}
/** @interface_method_impl{PDMDRVHLP,pfnAssertOther} */
static DECLCALLBACK(bool) pdmR3DrvHlp_AssertOther(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction)
{
return true;
char szMsg[100];
RTStrPrintf(szMsg, sizeof(szMsg), "AssertOther '%s'/%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance);
return false;
}
/** @interface_method_impl{PDMDRVHLP,pfnVMSetError} */
static DECLCALLBACK(int) pdmR3DrvHlp_VMSetError(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)
{
int rc2 = VMSetErrorV(pDrvIns->Internal.s.pVMR3, rc, RT_SRC_POS_ARGS, pszFormat, args); Assert(rc2 == rc); NOREF(rc2);
return rc;
}
/** @interface_method_impl{PDMDRVHLP,pfnVMSetErrorV} */
static 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;
}
/** @interface_method_impl{PDMDRVHLP,pfnVMSetRuntimeError} */
static DECLCALLBACK(int) pdmR3DrvHlp_VMSetRuntimeError(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...)
{
return rc;
}
/** @interface_method_impl{PDMDRVHLP,pfnVMSetRuntimeErrorV} */
static DECLCALLBACK(int) pdmR3DrvHlp_VMSetRuntimeErrorV(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va)
{
return rc;
}
/** @interface_method_impl{PDMDEVHLPR3,pfnVMState} */
{
LogFlow(("pdmR3DrvHlp_VMState: caller='%s'/%d: returns %d (%s)\n", pDrvIns->pReg->szName, pDrvIns->iInstance,
return enmVMState;
}
/** @interface_method_impl{PDMDEVHLPR3,pfnVMTeleportedAndNotFullyResumedYet} */
{
LogFlow(("pdmR3DrvHlp_VMState: caller='%s'/%d: returns %RTbool)\n", pDrvIns->pReg->szName, pDrvIns->iInstance,
fRc));
return fRc;
}
/** @interface_method_impl{PDMDRVHLP,pfnPDMQueueCreate} */
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;
}
/** @interface_method_impl{PDMDRVHLP,pfnTMGetVirtualFreq} */
{
}
/** @interface_method_impl{PDMDRVHLP,pfnTMGetVirtualTime} */
{
}
/** @interface_method_impl{PDMDRVHLP,pfnTMTimerCreate} */
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;
}
/** @interface_method_impl{PDMDRVHLP,pfnSSMRegister} */
static DECLCALLBACK(int) pdmR3DrvHlp_SSMRegister(PPDMDRVINS pDrvIns, uint32_t uVersion, size_t cbGuess,
{
LogFlow(("pdmR3DrvHlp_SSMRegister: caller='%s'/%d: uVersion=#x cbGuess=%#x \n"
" 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;
}
/** @interface_method_impl{PDMDRVHLP,pfnSSMDeregister} */
static DECLCALLBACK(int) pdmR3DrvHlp_SSMDeregister(PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance)
{
LogFlow(("pdmR3DrvHlp_SSMDeregister: caller='%s'/%d: pszName=%p:{%s} u32Instance=%#x\n",
LogFlow(("pdmR3DrvHlp_SSMDeregister: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
return rc;
}
/** @interface_method_impl{PDMDRVHLP,pfnSTAMRegister} */
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.
* For now we just have to be careful not to use this call for drivers which can be unloaded. */
}
/** @interface_method_impl{PDMDRVHLP,pfnSTAMRegisterF} */
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);
}
/** @interface_method_impl{PDMDRVHLP,pfnSTAMRegisterV} */
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);
}
/** @interface_method_impl{PDMDRVHLP,pfnSTAMDeregister} */
{
return rc;
}
/** @interface_method_impl{PDMDRVHLP,pfnSUPCallVMMR0Ex} */
static DECLCALLBACK(int) pdmR3DrvHlp_SUPCallVMMR0Ex(PPDMDRVINS pDrvIns, unsigned uOperation, void *pvArg, unsigned cbArg)
{
LogFlow(("pdmR3DrvHlp_SSMCallVMMR0Ex: caller='%s'/%d: uOperation=%u pvArg=%p cbArg=%d\n",
int rc;
if ( uOperation >= VMMR0_DO_SRV_START
&& uOperation < VMMR0_DO_SRV_END)
rc = SUPR3CallVMMR0Ex(pDrvIns->Internal.s.pVMR3->pVMR0, NIL_VMCPUID, uOperation, 0, (PSUPVMMR0REQHDR)pvArg);
else
{
}
LogFlow(("pdmR3DrvHlp_SUPCallVMMR0Ex: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
return rc;
}
/** @interface_method_impl{PDMDRVHLP,pfnUSBRegisterHub} */
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);
#else
int rc = VERR_NOT_SUPPORTED;
#endif
LogFlow(("pdmR3DrvHlp_USBRegisterHub: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
return rc;
}
/** @interface_method_impl{PDMDRVHLP,pfnSetAsyncNotification} */
static DECLCALLBACK(int) pdmR3DrvHlp_SetAsyncNotification(PPDMDRVINS pDrvIns, PFNPDMDRVASYNCNOTIFY pfnAsyncNotify)
{
LogFlow(("pdmR3DrvHlp_SetAsyncNotification: caller='%s'/%d: pfnAsyncNotify=%p\n", pDrvIns->pReg->szName, pDrvIns->iInstance, pfnAsyncNotify));
int rc = VINF_SUCCESS;
AssertStmt(pDrvIns->Internal.s.fVMSuspended || pDrvIns->Internal.s.fVMReset, rc = VERR_WRONG_ORDER);
|| enmVMState == VMSTATE_RESETTING
rc = VERR_INVALID_STATE);
if (RT_SUCCESS(rc))
LogFlow(("pdmR3DrvHlp_SetAsyncNotification: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
return rc;
}
/** @interface_method_impl{PDMDRVHLP,pfnAsyncNotificationCompleted} */
{
if ( enmVMState == VMSTATE_SUSPENDING
|| enmVMState == VMSTATE_RESETTING
{
LogFlow(("pdmR3DrvHlp_AsyncNotificationCompleted: caller='%s'/%d:\n", pDrvIns->pReg->szName, pDrvIns->iInstance));
}
else
LogFlow(("pdmR3DrvHlp_AsyncNotificationCompleted: caller='%s'/%d: enmVMState=%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance, enmVMState));
}
/** @interface_method_impl{PDMDRVHLP,pfnPDMThreadCreate} */
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;
}
/** @interface_method_impl{PDMDRVHLP,pfnPDMAsyncCompletionTemplateCreate} */
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;
}
/** @interface_method_impl{PDMDRVHLP,pfnPDMLdrGetRCInterfaceSymbols} */
static DECLCALLBACK(int) pdmR3DrvHlp_PDMLdrGetRCInterfaceSymbols(PPDMDRVINS pDrvIns, void *pvInterface, size_t cbInterface,
const char *pszSymPrefix, const char *pszSymList)
{
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;
{
false /*fRing0OrRC*/);
else
{
AssertMsgFailed(("Not a raw-mode enabled driver\n"));
}
}
else
{
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;
}
/** @interface_method_impl{PDMDRVHLP,pfnPDMLdrGetR0InterfaceSymbols} */
static DECLCALLBACK(int) pdmR3DrvHlp_PDMLdrGetR0InterfaceSymbols(PPDMDRVINS pDrvIns, void *pvInterface, size_t cbInterface,
const char *pszSymPrefix, const char *pszSymList)
{
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;
{
true /*fRing0OrRC*/);
else
{
AssertMsgFailed(("Not a ring-0 enabled driver\n"));
}
}
else
{
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;
}
/**
* The driver helper structure.
*/
const PDMDRVHLPR3 g_pdmR3DrvHlp =
{
PDM_DRVHLPR3_VERSION /* u32TheEnd */
};
/** @} */