summaryrefslogtreecommitdiff
path: root/src/VBox/VMM/VMMR3/PDMDriver.cpp
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2022-02-05 19:03:08 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2022-02-05 19:03:08 +0000
commit3e8646c1ded46328b99dba1176f1174ef8d89ee8 (patch)
tree66d280c3a46914f0eba3bd75fdab94fc4545ef5d /src/VBox/VMM/VMMR3/PDMDriver.cpp
parentd00b1193f2493e784a090bcd590ee23a21de5797 (diff)
downloadVirtualBox-svn-3e8646c1ded46328b99dba1176f1174ef8d89ee8.tar.gz
VMM/PDMQueue: Rewrote the queue code to not use the hyper heap and be a bit safer. Added a testcase (driverless). bugref:10093
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@93609 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/VMM/VMMR3/PDMDriver.cpp')
-rw-r--r--src/VBox/VMM/VMMR3/PDMDriver.cpp24
1 files changed, 5 insertions, 19 deletions
diff --git a/src/VBox/VMM/VMMR3/PDMDriver.cpp b/src/VBox/VMM/VMMR3/PDMDriver.cpp
index cd7a261e5b2..53f4ffee02c 100644
--- a/src/VBox/VMM/VMMR3/PDMDriver.cpp
+++ b/src/VBox/VMM/VMMR3/PDMDriver.cpp
@@ -1254,17 +1254,6 @@ static DECLCALLBACK(PSUPDRVSESSION) pdmR3DrvHlp_GetSupDrvSession(PPDMDRVINS pDrv
}
-/**
- * Conversion from handle to queue pointer (temporary).
- */
-DECLINLINE(PPDMQUEUE) pdmR3DrvHlp_QueueToPtr(PPDMDRVINS pDrvIns, PDMQUEUEHANDLE hQueue)
-{
- PDMDRV_ASSERT_DRVINS(pDrvIns);
- RT_NOREF(pDrvIns);
- return (PPDMQUEUE)hQueue;
-}
-
-
/** @interface_method_impl{PDMDRVHLPR3,pfnQueueCreate} */
static DECLCALLBACK(int) pdmR3DrvHlp_QueueCreate(PPDMDRVINS pDrvIns, uint32_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
PFNPDMQUEUEDRV pfnCallback, const char *pszName, PDMQUEUEHANDLE *phQueue)
@@ -1281,9 +1270,7 @@ static DECLCALLBACK(int) pdmR3DrvHlp_QueueCreate(PPDMDRVINS pDrvIns, uint32_t cb
AssertLogRelReturn(pszName, VERR_NO_MEMORY);
}
- PPDMQUEUE pQueue = NULL;
- int rc = PDMR3QueueCreateDriver(pVM, pDrvIns, cbItem, cItems, cMilliesInterval, pfnCallback, pszName, &pQueue);
- *phQueue = (PDMQUEUEHANDLE)pQueue;
+ int rc = PDMR3QueueCreateDriver(pVM, pDrvIns, cbItem, cItems, cMilliesInterval, pfnCallback, pszName, phQueue);
LogFlow(("pdmR3DrvHlp_PDMQueueCreate: caller='%s'/%d: returns %Rrc *phQueue=%p\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc, *phQueue));
return rc;
@@ -1293,25 +1280,24 @@ static DECLCALLBACK(int) pdmR3DrvHlp_QueueCreate(PPDMDRVINS pDrvIns, uint32_t cb
/** @interface_method_impl{PDMDRVHLPR3,pfnQueueAlloc} */
static DECLCALLBACK(PPDMQUEUEITEMCORE) pdmR3DrvHlp_QueueAlloc(PPDMDRVINS pDrvIns, PDMQUEUEHANDLE hQueue)
{
- return PDMQueueAlloc(pdmR3DrvHlp_QueueToPtr(pDrvIns, hQueue));
+ return PDMQueueAlloc(pDrvIns->Internal.s.pVMR3, hQueue, pDrvIns);
}
/** @interface_method_impl{PDMDRVHLPR3,pfnQueueInsert} */
-static DECLCALLBACK(void) pdmR3DrvHlp_QueueInsert(PPDMDRVINS pDrvIns, PDMQUEUEHANDLE hQueue, PPDMQUEUEITEMCORE pItem)
+static DECLCALLBACK(int) pdmR3DrvHlp_QueueInsert(PPDMDRVINS pDrvIns, PDMQUEUEHANDLE hQueue, PPDMQUEUEITEMCORE pItem)
{
- return PDMQueueInsert(pdmR3DrvHlp_QueueToPtr(pDrvIns, hQueue), pItem);
+ return PDMQueueInsert(pDrvIns->Internal.s.pVMR3, hQueue, pDrvIns, pItem);
}
/** @interface_method_impl{PDMDRVHLPR3,pfnQueueFlushIfNecessary} */
static DECLCALLBACK(bool) pdmR3DrvHlp_QueueFlushIfNecessary(PPDMDRVINS pDrvIns, PDMQUEUEHANDLE hQueue)
{
- return PDMQueueFlushIfNecessary(pdmR3DrvHlp_QueueToPtr(pDrvIns, hQueue));
+ return PDMQueueFlushIfNecessary(pDrvIns->Internal.s.pVMR3, hQueue, pDrvIns) == VINF_SUCCESS;
}
-
/** @interface_method_impl{PDMDRVHLPR3,pfnTMGetVirtualFreq} */
static DECLCALLBACK(uint64_t) pdmR3DrvHlp_TMGetVirtualFreq(PPDMDRVINS pDrvIns)
{