1 | /* $Id: PDMDriver.cpp 45152 2013-03-23 20:36:23Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * PDM - Pluggable Device and Driver Manager, Driver parts.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2013 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 |
|
---|
19 | /*******************************************************************************
|
---|
20 | * Header Files *
|
---|
21 | *******************************************************************************/
|
---|
22 | #define LOG_GROUP LOG_GROUP_PDM_DRIVER
|
---|
23 | #include "PDMInternal.h"
|
---|
24 | #include <VBox/vmm/pdm.h>
|
---|
25 | #include <VBox/vmm/mm.h>
|
---|
26 | #include <VBox/vmm/cfgm.h>
|
---|
27 | #include <VBox/vmm/vmm.h>
|
---|
28 | #include <VBox/sup.h>
|
---|
29 | #include <VBox/vmm/vm.h>
|
---|
30 | #include <VBox/version.h>
|
---|
31 | #include <VBox/err.h>
|
---|
32 |
|
---|
33 | #include <VBox/log.h>
|
---|
34 | #include <iprt/assert.h>
|
---|
35 | #include <iprt/asm.h>
|
---|
36 | #include <iprt/ctype.h>
|
---|
37 | #include <iprt/mem.h>
|
---|
38 | #include <iprt/thread.h>
|
---|
39 | #include <iprt/path.h>
|
---|
40 | #include <iprt/string.h>
|
---|
41 |
|
---|
42 |
|
---|
43 | /*******************************************************************************
|
---|
44 | * Structures and Typedefs *
|
---|
45 | *******************************************************************************/
|
---|
46 | /**
|
---|
47 | * Internal callback structure pointer.
|
---|
48 | *
|
---|
49 | * The main purpose is to define the extra data we associate
|
---|
50 | * with PDMDRVREGCB so we can find the VM instance and so on.
|
---|
51 | */
|
---|
52 | typedef struct PDMDRVREGCBINT
|
---|
53 | {
|
---|
54 | /** The callback structure. */
|
---|
55 | PDMDRVREGCB Core;
|
---|
56 | /** A bit of padding. */
|
---|
57 | uint32_t u32[4];
|
---|
58 | /** VM Handle. */
|
---|
59 | PVM pVM;
|
---|
60 | /** Pointer to the configuration node the registrations should be
|
---|
61 | * associated with. Can be NULL. */
|
---|
62 | PCFGMNODE pCfgNode;
|
---|
63 | } PDMDRVREGCBINT, *PPDMDRVREGCBINT;
|
---|
64 | typedef const PDMDRVREGCBINT *PCPDMDRVREGCBINT;
|
---|
65 |
|
---|
66 |
|
---|
67 | /*******************************************************************************
|
---|
68 | * Internal Functions *
|
---|
69 | *******************************************************************************/
|
---|
70 | static DECLCALLBACK(int) pdmR3DrvRegister(PCPDMDRVREGCB pCallbacks, PCPDMDRVREG pReg);
|
---|
71 | static int pdmR3DrvLoad(PVM pVM, PPDMDRVREGCBINT pRegCB, const char *pszFilename, const char *pszName);
|
---|
72 |
|
---|
73 |
|
---|
74 | /**
|
---|
75 | * Register drivers in a statically linked environment.
|
---|
76 | *
|
---|
77 | * @returns VBox status code.
|
---|
78 | * @param pVM Pointer to the VM.
|
---|
79 | * @param pfnCallback Driver registration callback
|
---|
80 | */
|
---|
81 | VMMR3DECL(int) PDMR3DrvStaticRegistration(PVM pVM, FNPDMVBOXDRIVERSREGISTER pfnCallback)
|
---|
82 | {
|
---|
83 | /*
|
---|
84 | * The registration callbacks.
|
---|
85 | */
|
---|
86 | PDMDRVREGCBINT RegCB;
|
---|
87 | RegCB.Core.u32Version = PDM_DRVREG_CB_VERSION;
|
---|
88 | RegCB.Core.pfnRegister = pdmR3DrvRegister;
|
---|
89 | RegCB.pVM = pVM;
|
---|
90 | RegCB.pCfgNode = NULL;
|
---|
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 | /**
|
---|
101 | * This function will initialize the drivers for this VM instance.
|
---|
102 | *
|
---|
103 | * First of all this mean loading the builtin drivers and letting them
|
---|
104 | * register themselves. Beyond that any additional driver modules are
|
---|
105 | * loaded and called for registration.
|
---|
106 | *
|
---|
107 | * @returns VBox status code.
|
---|
108 | * @param pVM Pointer to the VM.
|
---|
109 | */
|
---|
110 | int pdmR3DrvInit(PVM pVM)
|
---|
111 | {
|
---|
112 | LogFlow(("pdmR3DrvInit:\n"));
|
---|
113 |
|
---|
114 | AssertRelease(!(RT_OFFSETOF(PDMDRVINS, achInstanceData) & 15));
|
---|
115 | PPDMDRVINS pDrvInsAssert; NOREF(pDrvInsAssert);
|
---|
116 | AssertCompile(sizeof(pDrvInsAssert->Internal.s) <= sizeof(pDrvInsAssert->Internal.padding));
|
---|
117 | AssertRelease(sizeof(pDrvInsAssert->Internal.s) <= sizeof(pDrvInsAssert->Internal.padding));
|
---|
118 |
|
---|
119 | /*
|
---|
120 | * The registration callbacks.
|
---|
121 | */
|
---|
122 | PDMDRVREGCBINT RegCB;
|
---|
123 | RegCB.Core.u32Version = PDM_DRVREG_CB_VERSION;
|
---|
124 | RegCB.Core.pfnRegister = pdmR3DrvRegister;
|
---|
125 | RegCB.pVM = pVM;
|
---|
126 | RegCB.pCfgNode = NULL;
|
---|
127 |
|
---|
128 | /*
|
---|
129 | * Load the builtin module
|
---|
130 | */
|
---|
131 | PCFGMNODE pDriversNode = CFGMR3GetChild(CFGMR3GetRoot(pVM), "PDM/Drivers");
|
---|
132 | bool fLoadBuiltin;
|
---|
133 | int rc = CFGMR3QueryBool(pDriversNode, "LoadBuiltin", &fLoadBuiltin);
|
---|
134 | if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT)
|
---|
135 | fLoadBuiltin = true;
|
---|
136 | else if (RT_FAILURE(rc))
|
---|
137 | {
|
---|
138 | AssertMsgFailed(("Configuration error: Querying boolean \"LoadBuiltin\" failed with %Rrc\n", rc));
|
---|
139 | return rc;
|
---|
140 | }
|
---|
141 | if (fLoadBuiltin)
|
---|
142 | {
|
---|
143 | /* make filename */
|
---|
144 | char *pszFilename = pdmR3FileR3("VBoxDD", true /*fShared*/);
|
---|
145 | if (!pszFilename)
|
---|
146 | return VERR_NO_TMP_MEMORY;
|
---|
147 | rc = pdmR3DrvLoad(pVM, &RegCB, pszFilename, "VBoxDD");
|
---|
148 | RTMemTmpFree(pszFilename);
|
---|
149 | if (RT_FAILURE(rc))
|
---|
150 | return rc;
|
---|
151 | }
|
---|
152 |
|
---|
153 | /*
|
---|
154 | * Load additional driver modules.
|
---|
155 | */
|
---|
156 | for (PCFGMNODE pCur = CFGMR3GetFirstChild(pDriversNode); pCur; pCur = CFGMR3GetNextChild(pCur))
|
---|
157 | {
|
---|
158 | /*
|
---|
159 | * Get the name and path.
|
---|
160 | */
|
---|
161 | char szName[PDMMOD_NAME_LEN];
|
---|
162 | rc = CFGMR3GetName(pCur, &szName[0], sizeof(szName));
|
---|
163 | if (rc == VERR_CFGM_NOT_ENOUGH_SPACE)
|
---|
164 | {
|
---|
165 | AssertMsgFailed(("configuration error: The module name is too long, cchName=%zu.\n", CFGMR3GetNameLen(pCur)));
|
---|
166 | return VERR_PDM_MODULE_NAME_TOO_LONG;
|
---|
167 | }
|
---|
168 | else if (RT_FAILURE(rc))
|
---|
169 | {
|
---|
170 | AssertMsgFailed(("CFGMR3GetName -> %Rrc.\n", rc));
|
---|
171 | return rc;
|
---|
172 | }
|
---|
173 |
|
---|
174 | /* the path is optional, if no path the module name + path is used. */
|
---|
175 | char szFilename[RTPATH_MAX];
|
---|
176 | rc = CFGMR3QueryString(pCur, "Path", &szFilename[0], sizeof(szFilename));
|
---|
177 | if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT)
|
---|
178 | strcpy(szFilename, szName);
|
---|
179 | else if (RT_FAILURE(rc))
|
---|
180 | {
|
---|
181 | AssertMsgFailed(("configuration error: Failure to query the module path, rc=%Rrc.\n", rc));
|
---|
182 | return rc;
|
---|
183 | }
|
---|
184 |
|
---|
185 | /* prepend path? */
|
---|
186 | if (!RTPathHavePath(szFilename))
|
---|
187 | {
|
---|
188 | char *psz = pdmR3FileR3(szFilename, false /*fShared*/);
|
---|
189 | if (!psz)
|
---|
190 | return VERR_NO_TMP_MEMORY;
|
---|
191 | size_t cch = strlen(psz) + 1;
|
---|
192 | if (cch > sizeof(szFilename))
|
---|
193 | {
|
---|
194 | RTMemTmpFree(psz);
|
---|
195 | AssertMsgFailed(("Filename too long! cch=%d '%s'\n", cch, psz));
|
---|
196 | return VERR_FILENAME_TOO_LONG;
|
---|
197 | }
|
---|
198 | memcpy(szFilename, psz, cch);
|
---|
199 | RTMemTmpFree(psz);
|
---|
200 | }
|
---|
201 |
|
---|
202 | /*
|
---|
203 | * Load the module and register it's drivers.
|
---|
204 | */
|
---|
205 | RegCB.pCfgNode = pCur;
|
---|
206 | rc = pdmR3DrvLoad(pVM, &RegCB, szFilename, szName);
|
---|
207 | if (RT_FAILURE(rc))
|
---|
208 | return rc;
|
---|
209 | }
|
---|
210 |
|
---|
211 | LogFlow(("pdmR3DrvInit: returns VINF_SUCCESS\n"));
|
---|
212 | return VINF_SUCCESS;
|
---|
213 | }
|
---|
214 |
|
---|
215 |
|
---|
216 | /**
|
---|
217 | * Loads one driver module and call the registration entry point.
|
---|
218 | *
|
---|
219 | * @returns VBox status code.
|
---|
220 | * @param pVM Pointer to the VM.
|
---|
221 | * @param pRegCB The registration callback stuff.
|
---|
222 | * @param pszFilename Module filename.
|
---|
223 | * @param pszName Module name.
|
---|
224 | */
|
---|
225 | static int pdmR3DrvLoad(PVM pVM, PPDMDRVREGCBINT pRegCB, const char *pszFilename, const char *pszName)
|
---|
226 | {
|
---|
227 | /*
|
---|
228 | * Load it.
|
---|
229 | */
|
---|
230 | int rc = pdmR3LoadR3U(pVM->pUVM, pszFilename, pszName);
|
---|
231 | if (RT_SUCCESS(rc))
|
---|
232 | {
|
---|
233 | /*
|
---|
234 | * Get the registration export and call it.
|
---|
235 | */
|
---|
236 | FNPDMVBOXDRIVERSREGISTER *pfnVBoxDriversRegister;
|
---|
237 | rc = PDMR3LdrGetSymbolR3(pVM, pszName, "VBoxDriversRegister", (void **)&pfnVBoxDriversRegister);
|
---|
238 | if (RT_SUCCESS(rc))
|
---|
239 | {
|
---|
240 | Log(("PDM: Calling VBoxDriversRegister (%p) of %s (%s)\n", pfnVBoxDriversRegister, pszName, pszFilename));
|
---|
241 | rc = pfnVBoxDriversRegister(&pRegCB->Core, VBOX_VERSION);
|
---|
242 | if (RT_SUCCESS(rc))
|
---|
243 | Log(("PDM: Successfully loaded driver module %s (%s).\n", pszName, pszFilename));
|
---|
244 | else
|
---|
245 | AssertMsgFailed(("VBoxDriversRegister failed with rc=%Rrc\n"));
|
---|
246 | }
|
---|
247 | else
|
---|
248 | {
|
---|
249 | AssertMsgFailed(("Failed to locate 'VBoxDriversRegister' in %s (%s) rc=%Rrc\n", pszName, pszFilename, rc));
|
---|
250 | if (rc == VERR_SYMBOL_NOT_FOUND)
|
---|
251 | rc = VERR_PDM_NO_REGISTRATION_EXPORT;
|
---|
252 | }
|
---|
253 | }
|
---|
254 | else
|
---|
255 | AssertMsgFailed(("Failed to load %s (%s) rc=%Rrc!\n", pszName, pszFilename, rc));
|
---|
256 | return rc;
|
---|
257 | }
|
---|
258 |
|
---|
259 |
|
---|
260 | /** @interface_method_impl{PDMDRVREGCB,pfnRegister} */
|
---|
261 | static DECLCALLBACK(int) pdmR3DrvRegister(PCPDMDRVREGCB pCallbacks, PCPDMDRVREG pReg)
|
---|
262 | {
|
---|
263 | /*
|
---|
264 | * Validate the registration structure.
|
---|
265 | */
|
---|
266 | AssertPtrReturn(pReg, VERR_INVALID_POINTER);
|
---|
267 | AssertMsgReturn(pReg->u32Version == PDM_DRVREG_VERSION,
|
---|
268 | ("%#x\n", pReg->u32Version),
|
---|
269 | VERR_PDM_UNKNOWN_DRVREG_VERSION);
|
---|
270 | AssertReturn(pReg->szName[0], VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
271 | AssertMsgReturn(RTStrEnd(pReg->szName, sizeof(pReg->szName)),
|
---|
272 | ("%.*s\n", sizeof(pReg->szName), pReg->szName),
|
---|
273 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
274 | AssertMsgReturn(pdmR3IsValidName(pReg->szName), ("%.*s\n", pReg->szName),
|
---|
275 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
276 | AssertMsgReturn( !(pReg->fFlags & PDM_DRVREG_FLAGS_R0)
|
---|
277 | || ( pReg->szR0Mod[0]
|
---|
278 | && RTStrEnd(pReg->szR0Mod, sizeof(pReg->szR0Mod))),
|
---|
279 | ("%s: %.*s\n", pReg->szName, sizeof(pReg->szR0Mod), pReg->szR0Mod),
|
---|
280 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
281 | AssertMsgReturn( !(pReg->fFlags & PDM_DRVREG_FLAGS_RC)
|
---|
282 | || ( pReg->szRCMod[0]
|
---|
283 | && RTStrEnd(pReg->szRCMod, sizeof(pReg->szRCMod))),
|
---|
284 | ("%s: %.*s\n", pReg->szName, sizeof(pReg->szRCMod), pReg->szRCMod),
|
---|
285 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
286 | AssertMsgReturn(VALID_PTR(pReg->pszDescription),
|
---|
287 | ("%s: %p\n", pReg->szName, pReg->pszDescription),
|
---|
288 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
289 | AssertMsgReturn(!(pReg->fFlags & ~(PDM_DRVREG_FLAGS_HOST_BITS_MASK | PDM_DRVREG_FLAGS_R0 | PDM_DRVREG_FLAGS_RC)),
|
---|
290 | ("%s: %#x\n", pReg->szName, pReg->fFlags),
|
---|
291 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
292 | AssertMsgReturn((pReg->fFlags & PDM_DRVREG_FLAGS_HOST_BITS_MASK) == PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
|
---|
293 | ("%s: %#x\n", pReg->szName, pReg->fFlags),
|
---|
294 | VERR_PDM_INVALID_DRIVER_HOST_BITS);
|
---|
295 | AssertMsgReturn(pReg->cMaxInstances > 0,
|
---|
296 | ("%s: %#x\n", pReg->szName, pReg->cMaxInstances),
|
---|
297 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
298 | AssertMsgReturn(pReg->cbInstance <= _1M,
|
---|
299 | ("%s: %#x\n", pReg->szName, pReg->cbInstance),
|
---|
300 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
301 | AssertMsgReturn(VALID_PTR(pReg->pfnConstruct),
|
---|
302 | ("%s: %p\n", pReg->szName, pReg->pfnConstruct),
|
---|
303 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
304 | AssertMsgReturn(VALID_PTR(pReg->pfnRelocate) || !(pReg->fFlags & PDM_DRVREG_FLAGS_RC),
|
---|
305 | ("%s: %#x\n", pReg->szName, pReg->cbInstance),
|
---|
306 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
307 | AssertMsgReturn(pReg->pfnSoftReset == NULL,
|
---|
308 | ("%s: %p\n", pReg->szName, pReg->pfnSoftReset),
|
---|
309 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
310 | AssertMsgReturn(pReg->u32VersionEnd == PDM_DRVREG_VERSION,
|
---|
311 | ("%s: #x\n", pReg->szName, pReg->u32VersionEnd),
|
---|
312 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
313 |
|
---|
314 | /*
|
---|
315 | * Check for duplicate and find FIFO entry at the same time.
|
---|
316 | */
|
---|
317 | PCPDMDRVREGCBINT pRegCB = (PCPDMDRVREGCBINT)pCallbacks;
|
---|
318 | PPDMDRV pDrvPrev = NULL;
|
---|
319 | PPDMDRV pDrv = pRegCB->pVM->pdm.s.pDrvs;
|
---|
320 | for (; pDrv; pDrvPrev = pDrv, pDrv = pDrv->pNext)
|
---|
321 | {
|
---|
322 | if (!strcmp(pDrv->pReg->szName, pReg->szName))
|
---|
323 | {
|
---|
324 | AssertMsgFailed(("Driver '%s' already exists\n", pReg->szName));
|
---|
325 | return VERR_PDM_DRIVER_NAME_CLASH;
|
---|
326 | }
|
---|
327 | }
|
---|
328 |
|
---|
329 | /*
|
---|
330 | * Allocate new driver structure and insert it into the list.
|
---|
331 | */
|
---|
332 | int rc;
|
---|
333 | pDrv = (PPDMDRV)MMR3HeapAlloc(pRegCB->pVM, MM_TAG_PDM_DRIVER, sizeof(*pDrv));
|
---|
334 | if (pDrv)
|
---|
335 | {
|
---|
336 | pDrv->pNext = NULL;
|
---|
337 | pDrv->cInstances = 0;
|
---|
338 | pDrv->iNextInstance = 0;
|
---|
339 | pDrv->pReg = pReg;
|
---|
340 | rc = CFGMR3QueryStringAllocDef( pRegCB->pCfgNode, "RCSearchPath", &pDrv->pszRCSearchPath, NULL);
|
---|
341 | if (RT_SUCCESS(rc))
|
---|
342 | rc = CFGMR3QueryStringAllocDef(pRegCB->pCfgNode, "R0SearchPath", &pDrv->pszR0SearchPath, NULL);
|
---|
343 | if (RT_SUCCESS(rc))
|
---|
344 | {
|
---|
345 | if (pDrvPrev)
|
---|
346 | pDrvPrev->pNext = pDrv;
|
---|
347 | else
|
---|
348 | pRegCB->pVM->pdm.s.pDrvs = pDrv;
|
---|
349 | Log(("PDM: Registered driver '%s'\n", pReg->szName));
|
---|
350 | return VINF_SUCCESS;
|
---|
351 | }
|
---|
352 | MMR3HeapFree(pDrv);
|
---|
353 | }
|
---|
354 | else
|
---|
355 | rc = VERR_NO_MEMORY;
|
---|
356 | return rc;
|
---|
357 | }
|
---|
358 |
|
---|
359 |
|
---|
360 | /**
|
---|
361 | * Lookups a driver structure by name.
|
---|
362 | * @internal
|
---|
363 | */
|
---|
364 | PPDMDRV pdmR3DrvLookup(PVM pVM, const char *pszName)
|
---|
365 | {
|
---|
366 | for (PPDMDRV pDrv = pVM->pdm.s.pDrvs; pDrv; pDrv = pDrv->pNext)
|
---|
367 | if (!strcmp(pDrv->pReg->szName, pszName))
|
---|
368 | return pDrv;
|
---|
369 | return NULL;
|
---|
370 | }
|
---|
371 |
|
---|
372 |
|
---|
373 | /**
|
---|
374 | * Transforms the driver chain as it's being instantiated.
|
---|
375 | *
|
---|
376 | * Worker for pdmR3DrvInstantiate.
|
---|
377 | *
|
---|
378 | * @returns VBox status code.
|
---|
379 | * @param pVM Pointer to the VM.
|
---|
380 | * @param pDrvAbove The driver above, NULL if top.
|
---|
381 | * @param pLun The LUN.
|
---|
382 | * @param ppNode The AttachedDriver node, replaced if any
|
---|
383 | * morphing took place.
|
---|
384 | */
|
---|
385 | static int pdmR3DrvMaybeTransformChain(PVM pVM, PPDMDRVINS pDrvAbove, PPDMLUN pLun, PCFGMNODE *ppNode)
|
---|
386 | {
|
---|
387 | /*
|
---|
388 | * The typical state of affairs is that there are no injections.
|
---|
389 | */
|
---|
390 | PCFGMNODE pCurTrans = CFGMR3GetFirstChild(CFGMR3GetChild(CFGMR3GetRoot(pVM), "PDM/DriverTransformations"));
|
---|
391 | if (!pCurTrans)
|
---|
392 | return VINF_SUCCESS;
|
---|
393 |
|
---|
394 | /*
|
---|
395 | * Gather the attributes used in the matching process.
|
---|
396 | */
|
---|
397 | const char *pszDevice = pLun->pDevIns
|
---|
398 | ? pLun->pDevIns->Internal.s.pDevR3->pReg->szName
|
---|
399 | : pLun->pUsbIns->Internal.s.pUsbDev->pReg->szName;
|
---|
400 | char szLun[32];
|
---|
401 | RTStrPrintf(szLun, sizeof(szLun), "%u", pLun->iLun);
|
---|
402 | const char *pszAbove = pDrvAbove ? pDrvAbove->Internal.s.pDrv->pReg->szName : "<top>";
|
---|
403 | char *pszThisDrv;
|
---|
404 | int rc = CFGMR3QueryStringAlloc(*ppNode, "Driver", &pszThisDrv);
|
---|
405 | AssertMsgRCReturn(rc, ("Query for string value of \"Driver\" -> %Rrc\n", rc),
|
---|
406 | rc == VERR_CFGM_VALUE_NOT_FOUND ? VERR_PDM_CFG_MISSING_DRIVER_NAME : rc);
|
---|
407 |
|
---|
408 | uint64_t uInjectTransformationAbove = 0;
|
---|
409 | if (pDrvAbove)
|
---|
410 | {
|
---|
411 | rc = CFGMR3QueryIntegerDef(CFGMR3GetParent(*ppNode), "InjectTransformationPtr", &uInjectTransformationAbove, 0);
|
---|
412 | AssertLogRelRCReturn(rc, rc);
|
---|
413 | }
|
---|
414 |
|
---|
415 |
|
---|
416 | /*
|
---|
417 | * Enumerate possible driver chain transformations.
|
---|
418 | */
|
---|
419 | unsigned cTransformations = 0;
|
---|
420 | for (; pCurTrans != NULL; pCurTrans = CFGMR3GetNextChild(pCurTrans))
|
---|
421 | {
|
---|
422 | char szCurTransNm[256];
|
---|
423 | rc = CFGMR3GetName(pCurTrans, szCurTransNm, sizeof(szCurTransNm));
|
---|
424 | AssertLogRelRCReturn(rc, rc);
|
---|
425 |
|
---|
426 | /* Match against the driver multi pattern. */
|
---|
427 | char *pszMultiPat;
|
---|
428 | rc = CFGMR3QueryStringAllocDef(pCurTrans, "Driver", &pszMultiPat, "*");
|
---|
429 | AssertLogRelRCReturn(rc, rc);
|
---|
430 | bool fMatch = RTStrSimplePatternMultiMatch(pszMultiPat, RTSTR_MAX, pszDevice, RTSTR_MAX, NULL);
|
---|
431 | MMR3HeapFree(pszMultiPat);
|
---|
432 | if (!fMatch)
|
---|
433 | continue;
|
---|
434 |
|
---|
435 | /* Match against the lun multi pattern. */
|
---|
436 | rc = CFGMR3QueryStringAllocDef(pCurTrans, "LUN", &pszMultiPat, "*");
|
---|
437 | AssertLogRelRCReturn(rc, rc);
|
---|
438 | fMatch = RTStrSimplePatternMultiMatch(pszMultiPat, RTSTR_MAX, szLun, RTSTR_MAX, NULL);
|
---|
439 | MMR3HeapFree(pszMultiPat);
|
---|
440 | if (!fMatch)
|
---|
441 | continue;
|
---|
442 |
|
---|
443 | /* Match against the below-driver multi pattern. */
|
---|
444 | rc = CFGMR3QueryStringAllocDef(pCurTrans, "BelowDriver", &pszMultiPat, "*");
|
---|
445 | AssertLogRelRCReturn(rc, rc);
|
---|
446 | fMatch = RTStrSimplePatternMultiMatch(pszMultiPat, RTSTR_MAX, pszAbove, RTSTR_MAX, NULL);
|
---|
447 | MMR3HeapFree(pszMultiPat);
|
---|
448 | if (!fMatch)
|
---|
449 | continue;
|
---|
450 |
|
---|
451 | /* Match against the above-driver multi pattern. */
|
---|
452 | rc = CFGMR3QueryStringAlloc(pCurTrans, "AboveDriver", &pszMultiPat);
|
---|
453 | if (rc == VERR_CFGM_VALUE_NOT_FOUND)
|
---|
454 | rc = VINF_SUCCESS;
|
---|
455 | else
|
---|
456 | {
|
---|
457 | AssertLogRelRCReturn(rc, rc);
|
---|
458 | fMatch = RTStrSimplePatternMultiMatch(pszMultiPat, RTSTR_MAX, pszThisDrv, RTSTR_MAX, NULL);
|
---|
459 | MMR3HeapFree(pszMultiPat);
|
---|
460 | if (!fMatch)
|
---|
461 | continue;
|
---|
462 | if (uInjectTransformationAbove == (uintptr_t)pCurTrans)
|
---|
463 | continue;
|
---|
464 | }
|
---|
465 |
|
---|
466 | /*
|
---|
467 | * We've got a match! Now, what are we supposed to do?
|
---|
468 | */
|
---|
469 | char szAction[16];
|
---|
470 | rc = CFGMR3QueryStringDef(pCurTrans, "Action", szAction, sizeof(szAction), "inject");
|
---|
471 | AssertLogRelRCReturn(rc, rc);
|
---|
472 | AssertLogRelMsgReturn( !strcmp(szAction, "inject")
|
---|
473 | || !strcmp(szAction, "mergeconfig")
|
---|
474 | || !strcmp(szAction, "remove")
|
---|
475 | || !strcmp(szAction, "removetree")
|
---|
476 | || !strcmp(szAction, "replace")
|
---|
477 | || !strcmp(szAction, "replacetree")
|
---|
478 | ,
|
---|
479 | ("Action='%s', valid values are 'inject', 'mergeconfig', 'replace', 'replacetree', 'remove', 'removetree'.\n", szAction),
|
---|
480 | VERR_PDM_MISCONFIGURED_DRV_TRANSFORMATION);
|
---|
481 | LogRel(("Applying '%s' to '%s'::[%s]...'%s': %s\n", szCurTransNm, pszDevice, szLun, pszThisDrv, szAction));
|
---|
482 | CFGMR3Dump(*ppNode);
|
---|
483 | CFGMR3Dump(pCurTrans);
|
---|
484 |
|
---|
485 | /* Get the attached driver to inject. */
|
---|
486 | PCFGMNODE pTransAttDrv = NULL;
|
---|
487 | if (!strcmp(szAction, "inject") || !strcmp(szAction, "replace") || !strcmp(szAction, "replacetree"))
|
---|
488 | {
|
---|
489 | pTransAttDrv = CFGMR3GetChild(pCurTrans, "AttachedDriver");
|
---|
490 | AssertLogRelMsgReturn(pTransAttDrv,
|
---|
491 | ("An %s transformation requires an AttachedDriver child node!\n", szAction),
|
---|
492 | VERR_PDM_MISCONFIGURED_DRV_TRANSFORMATION);
|
---|
493 | }
|
---|
494 |
|
---|
495 |
|
---|
496 | /*
|
---|
497 | * Remove the node.
|
---|
498 | */
|
---|
499 | if (!strcmp(szAction, "remove") || !strcmp(szAction, "removetree"))
|
---|
500 | {
|
---|
501 | PCFGMNODE pBelowThis = CFGMR3GetChild(*ppNode, "AttachedDriver");
|
---|
502 | if (!pBelowThis || !strcmp(szAction, "removetree"))
|
---|
503 | {
|
---|
504 | CFGMR3RemoveNode(*ppNode);
|
---|
505 | *ppNode = NULL;
|
---|
506 | }
|
---|
507 | else
|
---|
508 | {
|
---|
509 | PCFGMNODE pBelowThisCopy;
|
---|
510 | rc = CFGMR3DuplicateSubTree(pBelowThis, &pBelowThisCopy);
|
---|
511 | AssertLogRelRCReturn(rc, rc);
|
---|
512 |
|
---|
513 | rc = CFGMR3ReplaceSubTree(*ppNode, pBelowThisCopy);
|
---|
514 | if (RT_FAILURE(rc))
|
---|
515 | {
|
---|
516 | CFGMR3RemoveNode(pBelowThis);
|
---|
517 | AssertLogRelReturn(("rc=%Rrc\n", rc), rc);
|
---|
518 | }
|
---|
519 | }
|
---|
520 | }
|
---|
521 | /*
|
---|
522 | * Replace the driver about to be instantiated.
|
---|
523 | */
|
---|
524 | else if (!strcmp(szAction, "replace") || !strcmp(szAction, "replacetree"))
|
---|
525 | {
|
---|
526 | PCFGMNODE pTransCopy;
|
---|
527 | rc = CFGMR3DuplicateSubTree(pTransAttDrv, &pTransCopy);
|
---|
528 | AssertLogRelRCReturn(rc, rc);
|
---|
529 |
|
---|
530 | PCFGMNODE pBelowThis = CFGMR3GetChild(*ppNode, "AttachedDriver");
|
---|
531 | if (!pBelowThis || !strcmp(szAction, "replacetree"))
|
---|
532 | rc = VINF_SUCCESS;
|
---|
533 | else
|
---|
534 | {
|
---|
535 | PCFGMNODE pBelowThisCopy;
|
---|
536 | rc = CFGMR3DuplicateSubTree(pBelowThis, &pBelowThisCopy);
|
---|
537 | if (RT_SUCCESS(rc))
|
---|
538 | {
|
---|
539 | rc = CFGMR3InsertSubTree(pTransCopy, "AttachedDriver", pBelowThisCopy, NULL);
|
---|
540 | AssertLogRelRC(rc);
|
---|
541 | if (RT_FAILURE(rc))
|
---|
542 | CFGMR3RemoveNode(pBelowThisCopy);
|
---|
543 | }
|
---|
544 | }
|
---|
545 | if (RT_SUCCESS(rc))
|
---|
546 | rc = CFGMR3ReplaceSubTree(*ppNode, pTransCopy);
|
---|
547 | if (RT_FAILURE(rc))
|
---|
548 | CFGMR3RemoveNode(pTransCopy);
|
---|
549 | }
|
---|
550 | /*
|
---|
551 | * Inject a driver before the driver about to be instantiated.
|
---|
552 | */
|
---|
553 | else if (!strcmp(szAction, "inject"))
|
---|
554 | {
|
---|
555 | PCFGMNODE pTransCopy;
|
---|
556 | rc = CFGMR3DuplicateSubTree(pTransAttDrv, &pTransCopy);
|
---|
557 | AssertLogRelRCReturn(rc, rc);
|
---|
558 |
|
---|
559 | PCFGMNODE pThisCopy;
|
---|
560 | rc = CFGMR3DuplicateSubTree(*ppNode, &pThisCopy);
|
---|
561 | if (RT_SUCCESS(rc))
|
---|
562 | {
|
---|
563 | rc = CFGMR3InsertSubTree(pTransCopy, "AttachedDriver", pThisCopy, NULL);
|
---|
564 | if (RT_SUCCESS(rc))
|
---|
565 | {
|
---|
566 | rc = CFGMR3InsertInteger(pTransCopy, "InjectTransformationPtr", (uintptr_t)pCurTrans);
|
---|
567 | AssertLogRelRC(rc);
|
---|
568 | rc = CFGMR3InsertString(pTransCopy, "InjectTransformationNm", szCurTransNm);
|
---|
569 | AssertLogRelRC(rc);
|
---|
570 | if (RT_SUCCESS(rc))
|
---|
571 | rc = CFGMR3ReplaceSubTree(*ppNode, pTransCopy);
|
---|
572 | }
|
---|
573 | else
|
---|
574 | {
|
---|
575 | AssertLogRelRC(rc);
|
---|
576 | CFGMR3RemoveNode(pThisCopy);
|
---|
577 | }
|
---|
578 | }
|
---|
579 | if (RT_FAILURE(rc))
|
---|
580 | CFGMR3RemoveNode(pTransCopy);
|
---|
581 | }
|
---|
582 | /*
|
---|
583 | * Merge the Config node of the transformation with the one of the
|
---|
584 | * current driver.
|
---|
585 | */
|
---|
586 | else if (!strcmp(szAction, "mergeconfig"))
|
---|
587 | {
|
---|
588 | PCFGMNODE pTransConfig = CFGMR3GetChild(pCurTrans, "Config");
|
---|
589 | AssertLogRelReturn(pTransConfig, VERR_PDM_MISCONFIGURED_DRV_TRANSFORMATION);
|
---|
590 |
|
---|
591 | PCFGMNODE pDrvConfig = CFGMR3GetChild(*ppNode, "Config");
|
---|
592 | if (*ppNode)
|
---|
593 | CFGMR3InsertNode(*ppNode, "Config", &pDrvConfig);
|
---|
594 | AssertLogRelReturn(pDrvConfig, VERR_PDM_CANNOT_TRANSFORM_REMOVED_DRIVER);
|
---|
595 |
|
---|
596 | rc = CFGMR3CopyTree(pDrvConfig, pTransConfig, CFGM_COPY_FLAGS_REPLACE_VALUES | CFGM_COPY_FLAGS_MERGE_KEYS);
|
---|
597 | AssertLogRelRCReturn(rc, rc);
|
---|
598 | }
|
---|
599 | else
|
---|
600 | AssertFailed();
|
---|
601 |
|
---|
602 | cTransformations++;
|
---|
603 | if (*ppNode)
|
---|
604 | CFGMR3Dump(*ppNode);
|
---|
605 | else
|
---|
606 | LogRel(("The transformation removed the driver.\n"));
|
---|
607 | }
|
---|
608 |
|
---|
609 | /*
|
---|
610 | * Note what happened in the release log.
|
---|
611 | */
|
---|
612 | if (cTransformations > 0)
|
---|
613 | LogRel(("Transformations done. Applied %u driver transformations.\n", cTransformations));
|
---|
614 |
|
---|
615 | return rc;
|
---|
616 | }
|
---|
617 |
|
---|
618 |
|
---|
619 | /**
|
---|
620 | * Instantiate a driver.
|
---|
621 | *
|
---|
622 | * @returns VBox status code, including informational statuses.
|
---|
623 | *
|
---|
624 | * @param pVM Pointer to the VM.
|
---|
625 | * @param pNode The CFGM node for the driver.
|
---|
626 | * @param pBaseInterface The base interface.
|
---|
627 | * @param pDrvAbove The driver above it. NULL if it's the top-most
|
---|
628 | * driver.
|
---|
629 | * @param pLun The LUN the driver is being attached to. NULL
|
---|
630 | * if we're instantiating a driver chain before
|
---|
631 | * attaching it - untested.
|
---|
632 | * @param ppBaseInterface Where to return the pointer to the base
|
---|
633 | * interface of the newly created driver.
|
---|
634 | *
|
---|
635 | * @remarks Recursive calls to this function is normal as the drivers will
|
---|
636 | * attach to anything below them during the pfnContruct call.
|
---|
637 | *
|
---|
638 | * @todo Need to extend this interface a bit so that the driver
|
---|
639 | * transformation feature can attach drivers to unconfigured LUNs and
|
---|
640 | * at the end of chains.
|
---|
641 | */
|
---|
642 | int pdmR3DrvInstantiate(PVM pVM, PCFGMNODE pNode, PPDMIBASE pBaseInterface, PPDMDRVINS pDrvAbove,
|
---|
643 | PPDMLUN pLun, PPDMIBASE *ppBaseInterface)
|
---|
644 | {
|
---|
645 | Assert(!pDrvAbove || !pDrvAbove->Internal.s.pDown);
|
---|
646 | Assert(!pDrvAbove || !pDrvAbove->pDownBase);
|
---|
647 |
|
---|
648 | Assert(pBaseInterface->pfnQueryInterface(pBaseInterface, PDMIBASE_IID) == pBaseInterface);
|
---|
649 |
|
---|
650 | /*
|
---|
651 | * Do driver chain injections
|
---|
652 | */
|
---|
653 | int rc = pdmR3DrvMaybeTransformChain(pVM, pDrvAbove, pLun, &pNode);
|
---|
654 | if (RT_FAILURE(rc))
|
---|
655 | return rc;
|
---|
656 | if (!pNode)
|
---|
657 | return VERR_PDM_NO_ATTACHED_DRIVER;
|
---|
658 |
|
---|
659 | /*
|
---|
660 | * Find the driver.
|
---|
661 | */
|
---|
662 | char *pszName;
|
---|
663 | rc = CFGMR3QueryStringAlloc(pNode, "Driver", &pszName);
|
---|
664 | if (RT_SUCCESS(rc))
|
---|
665 | {
|
---|
666 | PPDMDRV pDrv = pdmR3DrvLookup(pVM, pszName);
|
---|
667 | if ( pDrv
|
---|
668 | && pDrv->cInstances < pDrv->pReg->cMaxInstances)
|
---|
669 | {
|
---|
670 | /* config node */
|
---|
671 | PCFGMNODE pConfigNode = CFGMR3GetChild(pNode, "Config");
|
---|
672 | if (!pConfigNode)
|
---|
673 | rc = CFGMR3InsertNode(pNode, "Config", &pConfigNode);
|
---|
674 | if (RT_SUCCESS(rc))
|
---|
675 | {
|
---|
676 | CFGMR3SetRestrictedRoot(pConfigNode);
|
---|
677 |
|
---|
678 | /*
|
---|
679 | * Allocate the driver instance.
|
---|
680 | */
|
---|
681 | size_t cb = RT_OFFSETOF(PDMDRVINS, achInstanceData[pDrv->pReg->cbInstance]);
|
---|
682 | cb = RT_ALIGN_Z(cb, 16);
|
---|
683 | bool const fHyperHeap = !!(pDrv->pReg->fFlags & (PDM_DRVREG_FLAGS_R0 | PDM_DRVREG_FLAGS_RC));
|
---|
684 | PPDMDRVINS pNew;
|
---|
685 | if (fHyperHeap)
|
---|
686 | rc = MMHyperAlloc(pVM, cb, 64, MM_TAG_PDM_DRIVER, (void **)&pNew);
|
---|
687 | else
|
---|
688 | rc = MMR3HeapAllocZEx(pVM, MM_TAG_PDM_DRIVER, cb, (void **)&pNew);
|
---|
689 | if (pNew)
|
---|
690 | {
|
---|
691 | /*
|
---|
692 | * Initialize the instance structure (declaration order).
|
---|
693 | */
|
---|
694 | pNew->u32Version = PDM_DRVINS_VERSION;
|
---|
695 | pNew->iInstance = pDrv->iNextInstance;
|
---|
696 | pNew->Internal.s.pUp = pDrvAbove ? pDrvAbove : NULL;
|
---|
697 | //pNew->Internal.s.pDown = NULL;
|
---|
698 | pNew->Internal.s.pLun = pLun;
|
---|
699 | pNew->Internal.s.pDrv = pDrv;
|
---|
700 | pNew->Internal.s.pVMR3 = pVM;
|
---|
701 | pNew->Internal.s.pVMR0 = pDrv->pReg->fFlags & PDM_DRVREG_FLAGS_R0 ? pVM->pVMR0 : NIL_RTR0PTR;
|
---|
702 | pNew->Internal.s.pVMRC = pDrv->pReg->fFlags & PDM_DRVREG_FLAGS_RC ? pVM->pVMRC : NIL_RTRCPTR;
|
---|
703 | //pNew->Internal.s.fDetaching = false;
|
---|
704 | pNew->Internal.s.fVMSuspended = true;
|
---|
705 | //pNew->Internal.s.fVMReset = false;
|
---|
706 | pNew->Internal.s.fHyperHeap = fHyperHeap;
|
---|
707 | //pNew->Internal.s.pfnAsyncNotify = NULL;
|
---|
708 | pNew->Internal.s.pCfgHandle = pNode;
|
---|
709 | pNew->pReg = pDrv->pReg;
|
---|
710 | pNew->pCfg = pConfigNode;
|
---|
711 | pNew->pUpBase = pBaseInterface;
|
---|
712 | Assert(!pDrvAbove || pBaseInterface == &pDrvAbove->IBase);
|
---|
713 | //pNew->pDownBase = NULL;
|
---|
714 | //pNew->IBase.pfnQueryInterface = NULL;
|
---|
715 | //pNew->fTracing = 0;
|
---|
716 | pNew->idTracing = ++pVM->pdm.s.idTracingOther;
|
---|
717 | pNew->pHlpR3 = &g_pdmR3DrvHlp;
|
---|
718 | pNew->pvInstanceDataR3 = &pNew->achInstanceData[0];
|
---|
719 | if (pDrv->pReg->fFlags & PDM_DRVREG_FLAGS_R0)
|
---|
720 | {
|
---|
721 | pNew->pvInstanceDataR0 = MMHyperR3ToR0(pVM, &pNew->achInstanceData[0]);
|
---|
722 | rc = PDMR3LdrGetSymbolR0(pVM, NULL, "g_pdmR0DrvHlp", &pNew->pHlpR0);
|
---|
723 | AssertReleaseRCReturn(rc, rc);
|
---|
724 |
|
---|
725 | }
|
---|
726 | if (pDrv->pReg->fFlags & PDM_DRVREG_FLAGS_RC)
|
---|
727 | {
|
---|
728 | pNew->pvInstanceDataR0 = MMHyperR3ToRC(pVM, &pNew->achInstanceData[0]);
|
---|
729 | rc = PDMR3LdrGetSymbolRC(pVM, NULL, "g_pdmRCDrvHlp", &pNew->pHlpRC);
|
---|
730 | AssertReleaseRCReturn(rc, rc);
|
---|
731 | }
|
---|
732 |
|
---|
733 | pDrv->iNextInstance++;
|
---|
734 | pDrv->cInstances++;
|
---|
735 |
|
---|
736 | /*
|
---|
737 | * Link with it with the driver above / LUN.
|
---|
738 | */
|
---|
739 | if (pDrvAbove)
|
---|
740 | {
|
---|
741 | pDrvAbove->pDownBase = &pNew->IBase;
|
---|
742 | pDrvAbove->Internal.s.pDown = pNew;
|
---|
743 | }
|
---|
744 | else if (pLun)
|
---|
745 | pLun->pTop = pNew;
|
---|
746 | if (pLun)
|
---|
747 | pLun->pBottom = pNew;
|
---|
748 |
|
---|
749 | /*
|
---|
750 | * Invoke the constructor.
|
---|
751 | */
|
---|
752 | rc = pDrv->pReg->pfnConstruct(pNew, pNew->pCfg, 0 /*fFlags*/);
|
---|
753 | if (RT_SUCCESS(rc))
|
---|
754 | {
|
---|
755 | AssertPtr(pNew->IBase.pfnQueryInterface);
|
---|
756 | Assert(pNew->IBase.pfnQueryInterface(&pNew->IBase, PDMIBASE_IID) == &pNew->IBase);
|
---|
757 |
|
---|
758 | /* Success! */
|
---|
759 | *ppBaseInterface = &pNew->IBase;
|
---|
760 | if (pLun)
|
---|
761 | Log(("PDM: Attached driver %p:'%s'/%d to LUN#%d on device '%s'/%d, pDrvAbove=%p:'%s'/%d\n",
|
---|
762 | pNew, pDrv->pReg->szName, pNew->iInstance,
|
---|
763 | pLun->iLun,
|
---|
764 | pLun->pDevIns ? pLun->pDevIns->pReg->szName : pLun->pUsbIns->pReg->szName,
|
---|
765 | pLun->pDevIns ? pLun->pDevIns->iInstance : pLun->pUsbIns->iInstance,
|
---|
766 | pDrvAbove, pDrvAbove ? pDrvAbove->pReg->szName : "", pDrvAbove ? pDrvAbove->iInstance : UINT32_MAX));
|
---|
767 | else
|
---|
768 | Log(("PDM: Attached driver %p:'%s'/%d, pDrvAbove=%p:'%s'/%d\n",
|
---|
769 | pNew, pDrv->pReg->szName, pNew->iInstance,
|
---|
770 | pDrvAbove, pDrvAbove ? pDrvAbove->pReg->szName : "", pDrvAbove ? pDrvAbove->iInstance : UINT32_MAX));
|
---|
771 | }
|
---|
772 | else
|
---|
773 | {
|
---|
774 | pdmR3DrvDestroyChain(pNew, PDM_TACH_FLAGS_NO_CALLBACKS);
|
---|
775 | if (rc == VERR_VERSION_MISMATCH)
|
---|
776 | rc = VERR_PDM_DRIVER_VERSION_MISMATCH;
|
---|
777 | }
|
---|
778 | }
|
---|
779 | else
|
---|
780 | {
|
---|
781 | AssertMsgFailed(("Failed to allocate %d bytes for instantiating driver '%s'\n", cb, pszName));
|
---|
782 | rc = VERR_NO_MEMORY;
|
---|
783 | }
|
---|
784 | }
|
---|
785 | else
|
---|
786 | AssertMsgFailed(("Failed to create Config node! rc=%Rrc\n", rc));
|
---|
787 | }
|
---|
788 | else if (pDrv)
|
---|
789 | {
|
---|
790 | AssertMsgFailed(("Too many instances of driver '%s', max is %u\n", pszName, pDrv->pReg->cMaxInstances));
|
---|
791 | rc = VERR_PDM_TOO_MANY_DRIVER_INSTANCES;
|
---|
792 | }
|
---|
793 | else
|
---|
794 | {
|
---|
795 | AssertMsgFailed(("Driver '%s' wasn't found!\n", pszName));
|
---|
796 | rc = VERR_PDM_DRIVER_NOT_FOUND;
|
---|
797 | }
|
---|
798 | MMR3HeapFree(pszName);
|
---|
799 | }
|
---|
800 | else
|
---|
801 | {
|
---|
802 | if (rc == VERR_CFGM_VALUE_NOT_FOUND)
|
---|
803 | rc = VERR_PDM_CFG_MISSING_DRIVER_NAME;
|
---|
804 | else
|
---|
805 | AssertMsgFailed(("Query for string value of \"Driver\" -> %Rrc\n", rc));
|
---|
806 | }
|
---|
807 | return rc;
|
---|
808 | }
|
---|
809 |
|
---|
810 |
|
---|
811 | /**
|
---|
812 | * Detaches a driver from whatever it's attached to.
|
---|
813 | * This will of course lead to the destruction of the driver and all drivers below it in the chain.
|
---|
814 | *
|
---|
815 | * @returns VINF_SUCCESS
|
---|
816 | * @param pDrvIns The driver instance to detach.
|
---|
817 | * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
|
---|
818 | */
|
---|
819 | int pdmR3DrvDetach(PPDMDRVINS pDrvIns, uint32_t fFlags)
|
---|
820 | {
|
---|
821 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
822 | LogFlow(("pdmR3DrvDetach: pDrvIns=%p '%s'/%d\n", pDrvIns, pDrvIns->pReg->szName, pDrvIns->iInstance));
|
---|
823 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
824 |
|
---|
825 | /*
|
---|
826 | * Check that we're not doing this recursively, that could have unwanted sideeffects!
|
---|
827 | */
|
---|
828 | if (pDrvIns->Internal.s.fDetaching)
|
---|
829 | {
|
---|
830 | AssertMsgFailed(("Recursive detach! '%s'/%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance));
|
---|
831 | return VINF_SUCCESS; }
|
---|
832 |
|
---|
833 | /*
|
---|
834 | * Check that we actually can detach this instance.
|
---|
835 | * The requirement is that the driver/device above has a detach method.
|
---|
836 | */
|
---|
837 | if ( pDrvIns->Internal.s.pUp
|
---|
838 | ? !pDrvIns->Internal.s.pUp->pReg->pfnDetach
|
---|
839 | : pDrvIns->Internal.s.pLun->pDevIns
|
---|
840 | ? !pDrvIns->Internal.s.pLun->pDevIns->pReg->pfnDetach
|
---|
841 | : !pDrvIns->Internal.s.pLun->pUsbIns->pReg->pfnDriverDetach
|
---|
842 | )
|
---|
843 | {
|
---|
844 | AssertMsgFailed(("Cannot detach driver instance because the driver/device above doesn't support it!\n"));
|
---|
845 | return VERR_PDM_DRIVER_DETACH_NOT_POSSIBLE;
|
---|
846 | }
|
---|
847 |
|
---|
848 | /*
|
---|
849 | * Join paths with pdmR3DrvDestroyChain.
|
---|
850 | */
|
---|
851 | pdmR3DrvDestroyChain(pDrvIns, fFlags);
|
---|
852 | return VINF_SUCCESS;
|
---|
853 | }
|
---|
854 |
|
---|
855 |
|
---|
856 | /**
|
---|
857 | * Destroys a driver chain starting with the specified driver.
|
---|
858 | *
|
---|
859 | * This is used when unplugging a device at run time.
|
---|
860 | *
|
---|
861 | * @param pDrvIns Pointer to the driver instance to start with.
|
---|
862 | * @param fFlags PDM_TACH_FLAGS_NOT_HOT_PLUG, PDM_TACH_FLAGS_NO_CALLBACKS
|
---|
863 | * or 0.
|
---|
864 | */
|
---|
865 | void pdmR3DrvDestroyChain(PPDMDRVINS pDrvIns, uint32_t fFlags)
|
---|
866 | {
|
---|
867 | PVM pVM = pDrvIns->Internal.s.pVMR3;
|
---|
868 | VM_ASSERT_EMT(pVM);
|
---|
869 |
|
---|
870 | /*
|
---|
871 | * Detach the bottommost driver until we've detached pDrvIns.
|
---|
872 | */
|
---|
873 | pDrvIns->Internal.s.fDetaching = true;
|
---|
874 | PPDMDRVINS pCur;
|
---|
875 | do
|
---|
876 | {
|
---|
877 | /* find the driver to detach. */
|
---|
878 | pCur = pDrvIns;
|
---|
879 | while (pCur->Internal.s.pDown)
|
---|
880 | pCur = pCur->Internal.s.pDown;
|
---|
881 | LogFlow(("pdmR3DrvDestroyChain: pCur=%p '%s'/%d\n", pCur, pCur->pReg->szName, pCur->iInstance));
|
---|
882 |
|
---|
883 | /*
|
---|
884 | * Unlink it and notify parent.
|
---|
885 | */
|
---|
886 | pCur->Internal.s.fDetaching = true;
|
---|
887 |
|
---|
888 | PPDMLUN pLun = pCur->Internal.s.pLun;
|
---|
889 | Assert(pLun->pBottom == pCur);
|
---|
890 | pLun->pBottom = pCur->Internal.s.pUp;
|
---|
891 |
|
---|
892 | if (pCur->Internal.s.pUp)
|
---|
893 | {
|
---|
894 | /* driver parent */
|
---|
895 | PPDMDRVINS pParent = pCur->Internal.s.pUp;
|
---|
896 | pCur->Internal.s.pUp = NULL;
|
---|
897 | pParent->Internal.s.pDown = NULL;
|
---|
898 |
|
---|
899 | if (!(fFlags & PDM_TACH_FLAGS_NO_CALLBACKS) && pParent->pReg->pfnDetach)
|
---|
900 | pParent->pReg->pfnDetach(pParent, fFlags);
|
---|
901 |
|
---|
902 | pParent->pDownBase = NULL;
|
---|
903 | }
|
---|
904 | else
|
---|
905 | {
|
---|
906 | /* device parent */
|
---|
907 | Assert(pLun->pTop == pCur);
|
---|
908 | pLun->pTop = NULL;
|
---|
909 | if (!(fFlags & PDM_TACH_FLAGS_NO_CALLBACKS))
|
---|
910 | {
|
---|
911 | if (pLun->pDevIns)
|
---|
912 | {
|
---|
913 | if (pLun->pDevIns->pReg->pfnDetach)
|
---|
914 | {
|
---|
915 | PDMCritSectEnter(pLun->pDevIns->pCritSectRoR3, VERR_IGNORED);
|
---|
916 | pLun->pDevIns->pReg->pfnDetach(pLun->pDevIns, pLun->iLun, fFlags);
|
---|
917 | PDMCritSectLeave(pLun->pDevIns->pCritSectRoR3);
|
---|
918 | }
|
---|
919 | }
|
---|
920 | else
|
---|
921 | {
|
---|
922 | if (pLun->pUsbIns->pReg->pfnDriverDetach)
|
---|
923 | {
|
---|
924 | /** @todo USB device locking? */
|
---|
925 | /** @todo add flags to pfnDriverDetach. */
|
---|
926 | pLun->pUsbIns->pReg->pfnDriverDetach(pLun->pUsbIns, pLun->iLun);
|
---|
927 | }
|
---|
928 | }
|
---|
929 | }
|
---|
930 | }
|
---|
931 |
|
---|
932 | /*
|
---|
933 | * Call destructor.
|
---|
934 | */
|
---|
935 | pCur->pUpBase = NULL;
|
---|
936 | if (pCur->pReg->pfnDestruct)
|
---|
937 | pCur->pReg->pfnDestruct(pCur);
|
---|
938 | pCur->Internal.s.pDrv->cInstances--;
|
---|
939 |
|
---|
940 | /*
|
---|
941 | * Free all resources allocated by the driver.
|
---|
942 | */
|
---|
943 | /* Queues. */
|
---|
944 | int rc = PDMR3QueueDestroyDriver(pVM, pCur);
|
---|
945 | AssertRC(rc);
|
---|
946 |
|
---|
947 | /* Timers. */
|
---|
948 | rc = TMR3TimerDestroyDriver(pVM, pCur);
|
---|
949 | AssertRC(rc);
|
---|
950 |
|
---|
951 | /* SSM data units. */
|
---|
952 | rc = SSMR3DeregisterDriver(pVM, pCur, NULL, 0);
|
---|
953 | AssertRC(rc);
|
---|
954 |
|
---|
955 | /* PDM threads. */
|
---|
956 | rc = pdmR3ThreadDestroyDriver(pVM, pCur);
|
---|
957 | AssertRC(rc);
|
---|
958 |
|
---|
959 | /* Info handlers. */
|
---|
960 | rc = DBGFR3InfoDeregisterDriver(pVM, pCur, NULL);
|
---|
961 | AssertRC(rc);
|
---|
962 |
|
---|
963 | /* PDM critsects. */
|
---|
964 | rc = pdmR3CritSectBothDeleteDriver(pVM, pCur);
|
---|
965 | AssertRC(rc);
|
---|
966 |
|
---|
967 | /* Block caches. */
|
---|
968 | PDMR3BlkCacheReleaseDriver(pVM, pCur);
|
---|
969 |
|
---|
970 | #ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
|
---|
971 | /* Completion templates.*/
|
---|
972 | pdmR3AsyncCompletionTemplateDestroyDriver(pVM, pCur);
|
---|
973 | #endif
|
---|
974 |
|
---|
975 | /* Finally, the driver it self. */
|
---|
976 | bool fHyperHeap = pCur->Internal.s.fHyperHeap;
|
---|
977 | ASMMemFill32(pCur, RT_OFFSETOF(PDMDRVINS, achInstanceData[pCur->pReg->cbInstance]), 0xdeadd0d0);
|
---|
978 | if (fHyperHeap)
|
---|
979 | MMHyperFree(pVM, pCur);
|
---|
980 | else
|
---|
981 | MMR3HeapFree(pCur);
|
---|
982 |
|
---|
983 | } while (pCur != pDrvIns);
|
---|
984 | }
|
---|
985 |
|
---|
986 |
|
---|
987 |
|
---|
988 |
|
---|
989 | /** @name Driver Helpers
|
---|
990 | * @{
|
---|
991 | */
|
---|
992 |
|
---|
993 | /** @interface_method_impl{PDMDRVHLP,pfnAttach} */
|
---|
994 | static DECLCALLBACK(int) pdmR3DrvHlp_Attach(PPDMDRVINS pDrvIns, uint32_t fFlags, PPDMIBASE *ppBaseInterface)
|
---|
995 | {
|
---|
996 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
997 | PVM pVM = pDrvIns->Internal.s.pVMR3;
|
---|
998 | VM_ASSERT_EMT(pVM);
|
---|
999 | LogFlow(("pdmR3DrvHlp_Attach: caller='%s'/%d: fFlags=%#x\n", pDrvIns->pReg->szName, pDrvIns->iInstance, fFlags));
|
---|
1000 | Assert(!(fFlags & ~(PDM_TACH_FLAGS_NOT_HOT_PLUG)));
|
---|
1001 |
|
---|
1002 | /*
|
---|
1003 | * Check that there isn't anything attached already.
|
---|
1004 | */
|
---|
1005 | int rc;
|
---|
1006 | if (!pDrvIns->Internal.s.pDown)
|
---|
1007 | {
|
---|
1008 | Assert(pDrvIns->Internal.s.pLun->pBottom == pDrvIns);
|
---|
1009 |
|
---|
1010 | /*
|
---|
1011 | * Get the attached driver configuration.
|
---|
1012 | */
|
---|
1013 | PCFGMNODE pNode = CFGMR3GetChild(pDrvIns->Internal.s.pCfgHandle, "AttachedDriver");
|
---|
1014 | if (pNode)
|
---|
1015 | rc = pdmR3DrvInstantiate(pVM, pNode, &pDrvIns->IBase, pDrvIns, pDrvIns->Internal.s.pLun, ppBaseInterface);
|
---|
1016 | else
|
---|
1017 | rc = VERR_PDM_NO_ATTACHED_DRIVER;
|
---|
1018 | }
|
---|
1019 | else
|
---|
1020 | {
|
---|
1021 | AssertMsgFailed(("Already got a driver attached. The driver should keep track of such things!\n"));
|
---|
1022 | rc = VERR_PDM_DRIVER_ALREADY_ATTACHED;
|
---|
1023 | }
|
---|
1024 |
|
---|
1025 | LogFlow(("pdmR3DrvHlp_Attach: caller='%s'/%d: return %Rrc\n",
|
---|
1026 | pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
1027 | return rc;
|
---|
1028 | }
|
---|
1029 |
|
---|
1030 |
|
---|
1031 | /** @interface_method_impl{PDMDRVHLP,pfnDetach} */
|
---|
1032 | static DECLCALLBACK(int) pdmR3DrvHlp_Detach(PPDMDRVINS pDrvIns, uint32_t fFlags)
|
---|
1033 | {
|
---|
1034 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1035 | LogFlow(("pdmR3DrvHlp_Detach: caller='%s'/%d: fFlags=%#x\n",
|
---|
1036 | pDrvIns->pReg->szName, pDrvIns->iInstance, fFlags));
|
---|
1037 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1038 |
|
---|
1039 | /*
|
---|
1040 | * Anything attached?
|
---|
1041 | */
|
---|
1042 | int rc;
|
---|
1043 | if (pDrvIns->Internal.s.pDown)
|
---|
1044 | rc = pdmR3DrvDetach(pDrvIns->Internal.s.pDown, fFlags);
|
---|
1045 | else
|
---|
1046 | {
|
---|
1047 | AssertMsgFailed(("Nothing attached!\n"));
|
---|
1048 | rc = VERR_PDM_NO_DRIVER_ATTACHED;
|
---|
1049 | }
|
---|
1050 |
|
---|
1051 | LogFlow(("pdmR3DrvHlp_Detach: caller='%s'/%d: returns %Rrc\n",
|
---|
1052 | pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
1053 | return rc;
|
---|
1054 | }
|
---|
1055 |
|
---|
1056 |
|
---|
1057 | /** @interface_method_impl{PDMDRVHLP,pfnDetachSelf} */
|
---|
1058 | static DECLCALLBACK(int) pdmR3DrvHlp_DetachSelf(PPDMDRVINS pDrvIns, uint32_t fFlags)
|
---|
1059 | {
|
---|
1060 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1061 | LogFlow(("pdmR3DrvHlp_DetachSelf: caller='%s'/%d: fFlags=%#x\n",
|
---|
1062 | pDrvIns->pReg->szName, pDrvIns->iInstance, fFlags));
|
---|
1063 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1064 |
|
---|
1065 | int rc = pdmR3DrvDetach(pDrvIns, fFlags);
|
---|
1066 |
|
---|
1067 | LogFlow(("pdmR3DrvHlp_Detach: returns %Rrc\n", rc)); /* pDrvIns is freed by now. */
|
---|
1068 | return rc;
|
---|
1069 | }
|
---|
1070 |
|
---|
1071 |
|
---|
1072 | /** @interface_method_impl{PDMDRVHLP,pfnMountPrepare} */
|
---|
1073 | static DECLCALLBACK(int) pdmR3DrvHlp_MountPrepare(PPDMDRVINS pDrvIns, const char *pszFilename, const char *pszCoreDriver)
|
---|
1074 | {
|
---|
1075 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1076 | LogFlow(("pdmR3DrvHlp_MountPrepare: caller='%s'/%d: pszFilename=%p:{%s} pszCoreDriver=%p:{%s}\n",
|
---|
1077 | pDrvIns->pReg->szName, pDrvIns->iInstance, pszFilename, pszFilename, pszCoreDriver, pszCoreDriver));
|
---|
1078 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1079 |
|
---|
1080 | /*
|
---|
1081 | * Do the caller have anything attached below itself?
|
---|
1082 | */
|
---|
1083 | if (pDrvIns->Internal.s.pDown)
|
---|
1084 | {
|
---|
1085 | AssertMsgFailed(("Cannot prepare a mount when something's attached to you!\n"));
|
---|
1086 | return VERR_PDM_DRIVER_ALREADY_ATTACHED;
|
---|
1087 | }
|
---|
1088 |
|
---|
1089 | /*
|
---|
1090 | * We're asked to prepare, so we'll start off by nuking the
|
---|
1091 | * attached configuration tree.
|
---|
1092 | */
|
---|
1093 | PCFGMNODE pNode = CFGMR3GetChild(pDrvIns->Internal.s.pCfgHandle, "AttachedDriver");
|
---|
1094 | if (pNode)
|
---|
1095 | CFGMR3RemoveNode(pNode);
|
---|
1096 |
|
---|
1097 | /*
|
---|
1098 | * If there is no core driver, we'll have to probe for it.
|
---|
1099 | */
|
---|
1100 | if (!pszCoreDriver)
|
---|
1101 | {
|
---|
1102 | /** @todo implement image probing. */
|
---|
1103 | AssertReleaseMsgFailed(("Not implemented!\n"));
|
---|
1104 | return VERR_NOT_IMPLEMENTED;
|
---|
1105 | }
|
---|
1106 |
|
---|
1107 | /*
|
---|
1108 | * Construct the basic attached driver configuration.
|
---|
1109 | */
|
---|
1110 | int rc = CFGMR3InsertNode(pDrvIns->Internal.s.pCfgHandle, "AttachedDriver", &pNode);
|
---|
1111 | if (RT_SUCCESS(rc))
|
---|
1112 | {
|
---|
1113 | rc = CFGMR3InsertString(pNode, "Driver", pszCoreDriver);
|
---|
1114 | if (RT_SUCCESS(rc))
|
---|
1115 | {
|
---|
1116 | PCFGMNODE pCfg;
|
---|
1117 | rc = CFGMR3InsertNode(pNode, "Config", &pCfg);
|
---|
1118 | if (RT_SUCCESS(rc))
|
---|
1119 | {
|
---|
1120 | rc = CFGMR3InsertString(pCfg, "Path", pszFilename);
|
---|
1121 | if (RT_SUCCESS(rc))
|
---|
1122 | {
|
---|
1123 | LogFlow(("pdmR3DrvHlp_MountPrepare: caller='%s'/%d: returns %Rrc (Driver=%s)\n",
|
---|
1124 | pDrvIns->pReg->szName, pDrvIns->iInstance, rc, pszCoreDriver));
|
---|
1125 | return rc;
|
---|
1126 | }
|
---|
1127 | else
|
---|
1128 | AssertMsgFailed(("Path string insert failed, rc=%Rrc\n", rc));
|
---|
1129 | }
|
---|
1130 | else
|
---|
1131 | AssertMsgFailed(("Config node failed, rc=%Rrc\n", rc));
|
---|
1132 | }
|
---|
1133 | else
|
---|
1134 | AssertMsgFailed(("Driver string insert failed, rc=%Rrc\n", rc));
|
---|
1135 | CFGMR3RemoveNode(pNode);
|
---|
1136 | }
|
---|
1137 | else
|
---|
1138 | AssertMsgFailed(("AttachedDriver node insert failed, rc=%Rrc\n", rc));
|
---|
1139 |
|
---|
1140 | LogFlow(("pdmR3DrvHlp_MountPrepare: caller='%s'/%d: returns %Rrc\n",
|
---|
1141 | pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
1142 | return rc;
|
---|
1143 | }
|
---|
1144 |
|
---|
1145 |
|
---|
1146 | /** @interface_method_impl{PDMDRVHLP,pfnAssertEMT} */
|
---|
1147 | static DECLCALLBACK(bool) pdmR3DrvHlp_AssertEMT(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction)
|
---|
1148 | {
|
---|
1149 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1150 | if (VM_IS_EMT(pDrvIns->Internal.s.pVMR3))
|
---|
1151 | return true;
|
---|
1152 |
|
---|
1153 | char szMsg[100];
|
---|
1154 | RTStrPrintf(szMsg, sizeof(szMsg), "AssertEMT '%s'/%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance);
|
---|
1155 | RTAssertMsg1Weak(szMsg, iLine, pszFile, pszFunction);
|
---|
1156 | AssertBreakpoint();
|
---|
1157 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1158 | return false;
|
---|
1159 | }
|
---|
1160 |
|
---|
1161 |
|
---|
1162 | /** @interface_method_impl{PDMDRVHLP,pfnAssertOther} */
|
---|
1163 | static DECLCALLBACK(bool) pdmR3DrvHlp_AssertOther(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction)
|
---|
1164 | {
|
---|
1165 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1166 | if (!VM_IS_EMT(pDrvIns->Internal.s.pVMR3))
|
---|
1167 | return true;
|
---|
1168 |
|
---|
1169 | char szMsg[100];
|
---|
1170 | RTStrPrintf(szMsg, sizeof(szMsg), "AssertOther '%s'/%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance);
|
---|
1171 | RTAssertMsg1Weak(szMsg, iLine, pszFile, pszFunction);
|
---|
1172 | AssertBreakpoint();
|
---|
1173 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1174 | return false;
|
---|
1175 | }
|
---|
1176 |
|
---|
1177 |
|
---|
1178 | /** @interface_method_impl{PDMDRVHLP,pfnVMSetError} */
|
---|
1179 | static DECLCALLBACK(int) pdmR3DrvHlp_VMSetError(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)
|
---|
1180 | {
|
---|
1181 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1182 | va_list args;
|
---|
1183 | va_start(args, pszFormat);
|
---|
1184 | int rc2 = VMSetErrorV(pDrvIns->Internal.s.pVMR3, rc, RT_SRC_POS_ARGS, pszFormat, args); Assert(rc2 == rc); NOREF(rc2);
|
---|
1185 | va_end(args);
|
---|
1186 | return rc;
|
---|
1187 | }
|
---|
1188 |
|
---|
1189 |
|
---|
1190 | /** @interface_method_impl{PDMDRVHLP,pfnVMSetErrorV} */
|
---|
1191 | static DECLCALLBACK(int) pdmR3DrvHlp_VMSetErrorV(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)
|
---|
1192 | {
|
---|
1193 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1194 | int rc2 = VMSetErrorV(pDrvIns->Internal.s.pVMR3, rc, RT_SRC_POS_ARGS, pszFormat, va); Assert(rc2 == rc); NOREF(rc2);
|
---|
1195 | return rc;
|
---|
1196 | }
|
---|
1197 |
|
---|
1198 |
|
---|
1199 | /** @interface_method_impl{PDMDRVHLP,pfnVMSetRuntimeError} */
|
---|
1200 | static DECLCALLBACK(int) pdmR3DrvHlp_VMSetRuntimeError(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...)
|
---|
1201 | {
|
---|
1202 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1203 | va_list args;
|
---|
1204 | va_start(args, pszFormat);
|
---|
1205 | int rc = VMSetRuntimeErrorV(pDrvIns->Internal.s.pVMR3, fFlags, pszErrorId, pszFormat, args);
|
---|
1206 | va_end(args);
|
---|
1207 | return rc;
|
---|
1208 | }
|
---|
1209 |
|
---|
1210 |
|
---|
1211 | /** @interface_method_impl{PDMDRVHLP,pfnVMSetRuntimeErrorV} */
|
---|
1212 | static DECLCALLBACK(int) pdmR3DrvHlp_VMSetRuntimeErrorV(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va)
|
---|
1213 | {
|
---|
1214 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1215 | int rc = VMSetRuntimeErrorV(pDrvIns->Internal.s.pVMR3, fFlags, pszErrorId, pszFormat, va);
|
---|
1216 | return rc;
|
---|
1217 | }
|
---|
1218 |
|
---|
1219 |
|
---|
1220 | /** @interface_method_impl{PDMDEVHLPR3,pfnVMState} */
|
---|
1221 | static DECLCALLBACK(VMSTATE) pdmR3DrvHlp_VMState(PPDMDRVINS pDrvIns)
|
---|
1222 | {
|
---|
1223 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1224 |
|
---|
1225 | VMSTATE enmVMState = VMR3GetState(pDrvIns->Internal.s.pVMR3);
|
---|
1226 |
|
---|
1227 | LogFlow(("pdmR3DrvHlp_VMState: caller='%s'/%d: returns %d (%s)\n", pDrvIns->pReg->szName, pDrvIns->iInstance,
|
---|
1228 | enmVMState, VMR3GetStateName(enmVMState)));
|
---|
1229 | return enmVMState;
|
---|
1230 | }
|
---|
1231 |
|
---|
1232 |
|
---|
1233 | /** @interface_method_impl{PDMDEVHLPR3,pfnVMTeleportedAndNotFullyResumedYet} */
|
---|
1234 | static DECLCALLBACK(bool) pdmR3DrvHlp_VMTeleportedAndNotFullyResumedYet(PPDMDRVINS pDrvIns)
|
---|
1235 | {
|
---|
1236 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1237 |
|
---|
1238 | bool fRc = VMR3TeleportedAndNotFullyResumedYet(pDrvIns->Internal.s.pVMR3);
|
---|
1239 |
|
---|
1240 | LogFlow(("pdmR3DrvHlp_VMState: caller='%s'/%d: returns %RTbool)\n", pDrvIns->pReg->szName, pDrvIns->iInstance,
|
---|
1241 | fRc));
|
---|
1242 | return fRc;
|
---|
1243 | }
|
---|
1244 |
|
---|
1245 |
|
---|
1246 | /** @interface_method_impl{PDMDEVHLPR3,pfnGetSupDrvSession} */
|
---|
1247 | static DECLCALLBACK(PSUPDRVSESSION) pdmR3DrvHlp_GetSupDrvSession(PPDMDRVINS pDrvIns)
|
---|
1248 | {
|
---|
1249 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1250 |
|
---|
1251 | PSUPDRVSESSION pSession = pDrvIns->Internal.s.pVMR3->pSession;
|
---|
1252 | LogFlow(("pdmR3DrvHlp_GetSupDrvSession: caller='%s'/%d: returns %p)\n", pDrvIns->pReg->szName, pDrvIns->iInstance,
|
---|
1253 | pSession));
|
---|
1254 | return pSession;
|
---|
1255 | }
|
---|
1256 |
|
---|
1257 |
|
---|
1258 | /** @interface_method_impl{PDMDRVHLP,pfnQueueCreate} */
|
---|
1259 | static DECLCALLBACK(int) pdmR3DrvHlp_QueueCreate(PPDMDRVINS pDrvIns, uint32_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
|
---|
1260 | PFNPDMQUEUEDRV pfnCallback, const char *pszName, PPDMQUEUE *ppQueue)
|
---|
1261 | {
|
---|
1262 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1263 | LogFlow(("pdmR3DrvHlp_PDMQueueCreate: caller='%s'/%d: cbItem=%d cItems=%d cMilliesInterval=%d pfnCallback=%p pszName=%p:{%s} ppQueue=%p\n",
|
---|
1264 | pDrvIns->pReg->szName, pDrvIns->iInstance, cbItem, cItems, cMilliesInterval, pfnCallback, pszName, pszName, ppQueue, ppQueue));
|
---|
1265 | PVM pVM = pDrvIns->Internal.s.pVMR3;
|
---|
1266 | VM_ASSERT_EMT(pVM);
|
---|
1267 |
|
---|
1268 | if (pDrvIns->iInstance > 0)
|
---|
1269 | {
|
---|
1270 | pszName = MMR3HeapAPrintf(pVM, MM_TAG_PDM_DRIVER_DESC, "%s_%u", pszName, pDrvIns->iInstance);
|
---|
1271 | AssertLogRelReturn(pszName, VERR_NO_MEMORY);
|
---|
1272 | }
|
---|
1273 |
|
---|
1274 | int rc = PDMR3QueueCreateDriver(pVM, pDrvIns, cbItem, cItems, cMilliesInterval, pfnCallback, pszName, ppQueue);
|
---|
1275 |
|
---|
1276 | LogFlow(("pdmR3DrvHlp_PDMQueueCreate: caller='%s'/%d: returns %Rrc *ppQueue=%p\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc, *ppQueue));
|
---|
1277 | return rc;
|
---|
1278 | }
|
---|
1279 |
|
---|
1280 |
|
---|
1281 | /** @interface_method_impl{PDMDRVHLP,pfnTMGetVirtualFreq} */
|
---|
1282 | static DECLCALLBACK(uint64_t) pdmR3DrvHlp_TMGetVirtualFreq(PPDMDRVINS pDrvIns)
|
---|
1283 | {
|
---|
1284 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1285 |
|
---|
1286 | return TMVirtualGetFreq(pDrvIns->Internal.s.pVMR3);
|
---|
1287 | }
|
---|
1288 |
|
---|
1289 |
|
---|
1290 | /** @interface_method_impl{PDMDRVHLP,pfnTMGetVirtualTime} */
|
---|
1291 | static DECLCALLBACK(uint64_t) pdmR3DrvHlp_TMGetVirtualTime(PPDMDRVINS pDrvIns)
|
---|
1292 | {
|
---|
1293 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1294 |
|
---|
1295 | return TMVirtualGet(pDrvIns->Internal.s.pVMR3);
|
---|
1296 | }
|
---|
1297 |
|
---|
1298 |
|
---|
1299 | /** @interface_method_impl{PDMDRVHLP,pfnTMTimerCreate} */
|
---|
1300 | static DECLCALLBACK(int) pdmR3DrvHlp_TMTimerCreate(PPDMDRVINS pDrvIns, TMCLOCK enmClock, PFNTMTIMERDRV pfnCallback, void *pvUser, uint32_t fFlags, const char *pszDesc, PPTMTIMERR3 ppTimer)
|
---|
1301 | {
|
---|
1302 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1303 | LogFlow(("pdmR3DrvHlp_TMTimerCreate: caller='%s'/%d: enmClock=%d pfnCallback=%p pvUser=%p fFlags=%#x pszDesc=%p:{%s} ppTimer=%p\n",
|
---|
1304 | pDrvIns->pReg->szName, pDrvIns->iInstance, enmClock, pfnCallback, pvUser, fFlags, pszDesc, pszDesc, ppTimer));
|
---|
1305 |
|
---|
1306 | int rc = TMR3TimerCreateDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, enmClock, pfnCallback, pvUser, fFlags, pszDesc, ppTimer);
|
---|
1307 |
|
---|
1308 | LogFlow(("pdmR3DrvHlp_TMTimerCreate: caller='%s'/%d: returns %Rrc *ppTimer=%p\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc, *ppTimer));
|
---|
1309 | return rc;
|
---|
1310 | }
|
---|
1311 |
|
---|
1312 |
|
---|
1313 |
|
---|
1314 | /** @interface_method_impl{PDMDRVHLP,pfnSSMRegister} */
|
---|
1315 | static DECLCALLBACK(int) pdmR3DrvHlp_SSMRegister(PPDMDRVINS pDrvIns, uint32_t uVersion, size_t cbGuess,
|
---|
1316 | PFNSSMDRVLIVEPREP pfnLivePrep, PFNSSMDRVLIVEEXEC pfnLiveExec, PFNSSMDRVLIVEVOTE pfnLiveVote,
|
---|
1317 | PFNSSMDRVSAVEPREP pfnSavePrep, PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVSAVEDONE pfnSaveDone,
|
---|
1318 | PFNSSMDRVLOADPREP pfnLoadPrep, PFNSSMDRVLOADEXEC pfnLoadExec, PFNSSMDRVLOADDONE pfnLoadDone)
|
---|
1319 | {
|
---|
1320 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1321 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1322 | LogFlow(("pdmR3DrvHlp_SSMRegister: caller='%s'/%d: uVersion=#x cbGuess=%#x \n"
|
---|
1323 | " pfnLivePrep=%p pfnLiveExec=%p pfnLiveVote=%p pfnSavePrep=%p pfnSaveExec=%p pfnSaveDone=%p pszLoadPrep=%p pfnLoadExec=%p pfnLoaddone=%p\n",
|
---|
1324 | pDrvIns->pReg->szName, pDrvIns->iInstance, uVersion, cbGuess,
|
---|
1325 | pfnLivePrep, pfnLiveExec, pfnLiveVote,
|
---|
1326 | pfnSavePrep, pfnSaveExec, pfnSaveDone, pfnLoadPrep, pfnLoadExec, pfnLoadDone));
|
---|
1327 |
|
---|
1328 | int rc = SSMR3RegisterDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, pDrvIns->pReg->szName, pDrvIns->iInstance,
|
---|
1329 | uVersion, cbGuess,
|
---|
1330 | pfnLivePrep, pfnLiveExec, pfnLiveVote,
|
---|
1331 | pfnSavePrep, pfnSaveExec, pfnSaveDone,
|
---|
1332 | pfnLoadPrep, pfnLoadExec, pfnLoadDone);
|
---|
1333 |
|
---|
1334 | LogFlow(("pdmR3DrvHlp_SSMRegister: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
1335 | return rc;
|
---|
1336 | }
|
---|
1337 |
|
---|
1338 |
|
---|
1339 | /** @interface_method_impl{PDMDRVHLP,pfnSSMDeregister} */
|
---|
1340 | static DECLCALLBACK(int) pdmR3DrvHlp_SSMDeregister(PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance)
|
---|
1341 | {
|
---|
1342 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1343 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1344 | LogFlow(("pdmR3DrvHlp_SSMDeregister: caller='%s'/%d: pszName=%p:{%s} u32Instance=%#x\n",
|
---|
1345 | pDrvIns->pReg->szName, pDrvIns->iInstance, pszName, pszName, u32Instance));
|
---|
1346 |
|
---|
1347 | int rc = SSMR3DeregisterDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, pszName, u32Instance);
|
---|
1348 |
|
---|
1349 | LogFlow(("pdmR3DrvHlp_SSMDeregister: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
1350 | return rc;
|
---|
1351 | }
|
---|
1352 |
|
---|
1353 |
|
---|
1354 | /** @interface_method_impl{PDMDEVHLP,pfnDBGFInfoRegister} */
|
---|
1355 | static DECLCALLBACK(int) pdmR3DrvHlp_DBGFInfoRegister(PPDMDRVINS pDrvIns, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDRV pfnHandler)
|
---|
1356 | {
|
---|
1357 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1358 | LogFlow(("pdmR3DrvHlp_DBGFInfoRegister: caller='%s'/%d: pszName=%p:{%s} pszDesc=%p:{%s} pfnHandler=%p\n",
|
---|
1359 | pDrvIns->pReg->szName, pDrvIns->iInstance, pszName, pszName, pszDesc, pszDesc, pfnHandler));
|
---|
1360 |
|
---|
1361 | int rc = DBGFR3InfoRegisterDriver(pDrvIns->Internal.s.pVMR3, pszName, pszDesc, pfnHandler, pDrvIns);
|
---|
1362 |
|
---|
1363 | LogFlow(("pdmR3DrvHlp_DBGFInfoRegister: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
1364 | return rc;
|
---|
1365 | }
|
---|
1366 |
|
---|
1367 |
|
---|
1368 | /** @interface_method_impl{PDMDEVHLP,pfnDBGFInfoDeregister} */
|
---|
1369 | static DECLCALLBACK(int) pdmR3DrvHlp_DBGFInfoDeregister(PPDMDRVINS pDrvIns, const char *pszName)
|
---|
1370 | {
|
---|
1371 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1372 | LogFlow(("pdmR3DrvHlp_DBGFInfoDeregister: caller='%s'/%d: pszName=%p:{%s} pszDesc=%p:{%s} pfnHandler=%p\n",
|
---|
1373 | pDrvIns->pReg->szName, pDrvIns->iInstance, pszName));
|
---|
1374 |
|
---|
1375 | int rc = DBGFR3InfoDeregisterDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, pszName);
|
---|
1376 |
|
---|
1377 | LogFlow(("pdmR3DrvHlp_DBGFInfoDeregister: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
1378 |
|
---|
1379 | return rc;
|
---|
1380 | }
|
---|
1381 |
|
---|
1382 |
|
---|
1383 | /** @interface_method_impl{PDMDRVHLP,pfnSTAMRegister} */
|
---|
1384 | static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegister(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, const char *pszName, STAMUNIT enmUnit, const char *pszDesc)
|
---|
1385 | {
|
---|
1386 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1387 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1388 |
|
---|
1389 | STAM_REG(pDrvIns->Internal.s.pVMR3, pvSample, enmType, pszName, enmUnit, pszDesc);
|
---|
1390 | /** @todo track the samples so they can be dumped & deregistered when the driver instance is destroyed.
|
---|
1391 | * For now we just have to be careful not to use this call for drivers which can be unloaded. */
|
---|
1392 | }
|
---|
1393 |
|
---|
1394 |
|
---|
1395 | /** @interface_method_impl{PDMDRVHLP,pfnSTAMRegisterF} */
|
---|
1396 | static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegisterF(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
|
---|
1397 | STAMUNIT enmUnit, const char *pszDesc, const char *pszName, ...)
|
---|
1398 | {
|
---|
1399 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1400 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1401 |
|
---|
1402 | va_list args;
|
---|
1403 | va_start(args, pszName);
|
---|
1404 | int rc = STAMR3RegisterV(pDrvIns->Internal.s.pVMR3, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, args);
|
---|
1405 | va_end(args);
|
---|
1406 | AssertRC(rc);
|
---|
1407 | }
|
---|
1408 |
|
---|
1409 |
|
---|
1410 | /** @interface_method_impl{PDMDRVHLP,pfnSTAMRegisterV} */
|
---|
1411 | static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegisterV(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
|
---|
1412 | STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list args)
|
---|
1413 | {
|
---|
1414 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1415 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1416 |
|
---|
1417 | int rc = STAMR3RegisterV(pDrvIns->Internal.s.pVMR3, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, args);
|
---|
1418 | AssertRC(rc);
|
---|
1419 | }
|
---|
1420 |
|
---|
1421 |
|
---|
1422 | /** @interface_method_impl{PDMDRVHLP,pfnSTAMDeregister} */
|
---|
1423 | static DECLCALLBACK(int) pdmR3DrvHlp_STAMDeregister(PPDMDRVINS pDrvIns, void *pvSample)
|
---|
1424 | {
|
---|
1425 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1426 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1427 |
|
---|
1428 | int rc = STAMR3DeregisterU(pDrvIns->Internal.s.pVMR3->pUVM, pvSample);
|
---|
1429 | AssertRC(rc);
|
---|
1430 | return rc;
|
---|
1431 | }
|
---|
1432 |
|
---|
1433 |
|
---|
1434 | /** @interface_method_impl{PDMDRVHLP,pfnSUPCallVMMR0Ex} */
|
---|
1435 | static DECLCALLBACK(int) pdmR3DrvHlp_SUPCallVMMR0Ex(PPDMDRVINS pDrvIns, unsigned uOperation, void *pvArg, unsigned cbArg)
|
---|
1436 | {
|
---|
1437 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1438 | LogFlow(("pdmR3DrvHlp_SSMCallVMMR0Ex: caller='%s'/%d: uOperation=%u pvArg=%p cbArg=%d\n",
|
---|
1439 | pDrvIns->pReg->szName, pDrvIns->iInstance, uOperation, pvArg, cbArg));
|
---|
1440 | int rc;
|
---|
1441 | if ( uOperation >= VMMR0_DO_SRV_START
|
---|
1442 | && uOperation < VMMR0_DO_SRV_END)
|
---|
1443 | rc = SUPR3CallVMMR0Ex(pDrvIns->Internal.s.pVMR3->pVMR0, NIL_VMCPUID, uOperation, 0, (PSUPVMMR0REQHDR)pvArg);
|
---|
1444 | else
|
---|
1445 | {
|
---|
1446 | AssertMsgFailed(("Invalid uOperation=%u\n", uOperation));
|
---|
1447 | rc = VERR_INVALID_PARAMETER;
|
---|
1448 | }
|
---|
1449 |
|
---|
1450 | LogFlow(("pdmR3DrvHlp_SUPCallVMMR0Ex: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
1451 | return rc;
|
---|
1452 | }
|
---|
1453 |
|
---|
1454 |
|
---|
1455 | /** @interface_method_impl{PDMDRVHLP,pfnUSBRegisterHub} */
|
---|
1456 | static DECLCALLBACK(int) pdmR3DrvHlp_USBRegisterHub(PPDMDRVINS pDrvIns, uint32_t fVersions, uint32_t cPorts, PCPDMUSBHUBREG pUsbHubReg, PPCPDMUSBHUBHLP ppUsbHubHlp)
|
---|
1457 | {
|
---|
1458 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1459 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1460 | LogFlow(("pdmR3DrvHlp_USBRegisterHub: caller='%s'/%d: fVersions=%#x cPorts=%#x pUsbHubReg=%p ppUsbHubHlp=%p\n",
|
---|
1461 | pDrvIns->pReg->szName, pDrvIns->iInstance, fVersions, cPorts, pUsbHubReg, ppUsbHubHlp));
|
---|
1462 |
|
---|
1463 | #ifdef VBOX_WITH_USB
|
---|
1464 | int rc = pdmR3UsbRegisterHub(pDrvIns->Internal.s.pVMR3, pDrvIns, fVersions, cPorts, pUsbHubReg, ppUsbHubHlp);
|
---|
1465 | #else
|
---|
1466 | int rc = VERR_NOT_SUPPORTED;
|
---|
1467 | #endif
|
---|
1468 |
|
---|
1469 | LogFlow(("pdmR3DrvHlp_USBRegisterHub: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
1470 | return rc;
|
---|
1471 | }
|
---|
1472 |
|
---|
1473 |
|
---|
1474 | /** @interface_method_impl{PDMDRVHLP,pfnSetAsyncNotification} */
|
---|
1475 | static DECLCALLBACK(int) pdmR3DrvHlp_SetAsyncNotification(PPDMDRVINS pDrvIns, PFNPDMDRVASYNCNOTIFY pfnAsyncNotify)
|
---|
1476 | {
|
---|
1477 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1478 | VM_ASSERT_EMT0(pDrvIns->Internal.s.pVMR3);
|
---|
1479 | LogFlow(("pdmR3DrvHlp_SetAsyncNotification: caller='%s'/%d: pfnAsyncNotify=%p\n", pDrvIns->pReg->szName, pDrvIns->iInstance, pfnAsyncNotify));
|
---|
1480 |
|
---|
1481 | int rc = VINF_SUCCESS;
|
---|
1482 | AssertStmt(pfnAsyncNotify, rc = VERR_INVALID_PARAMETER);
|
---|
1483 | AssertStmt(!pDrvIns->Internal.s.pfnAsyncNotify, rc = VERR_WRONG_ORDER);
|
---|
1484 | AssertStmt(pDrvIns->Internal.s.fVMSuspended || pDrvIns->Internal.s.fVMReset, rc = VERR_WRONG_ORDER);
|
---|
1485 | VMSTATE enmVMState = VMR3GetState(pDrvIns->Internal.s.pVMR3);
|
---|
1486 | AssertStmt( enmVMState == VMSTATE_SUSPENDING
|
---|
1487 | || enmVMState == VMSTATE_SUSPENDING_EXT_LS
|
---|
1488 | || enmVMState == VMSTATE_SUSPENDING_LS
|
---|
1489 | || enmVMState == VMSTATE_RESETTING
|
---|
1490 | || enmVMState == VMSTATE_RESETTING_LS
|
---|
1491 | || enmVMState == VMSTATE_POWERING_OFF
|
---|
1492 | || enmVMState == VMSTATE_POWERING_OFF_LS,
|
---|
1493 | rc = VERR_INVALID_STATE);
|
---|
1494 |
|
---|
1495 | if (RT_SUCCESS(rc))
|
---|
1496 | pDrvIns->Internal.s.pfnAsyncNotify = pfnAsyncNotify;
|
---|
1497 |
|
---|
1498 | LogFlow(("pdmR3DrvHlp_SetAsyncNotification: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
1499 | return rc;
|
---|
1500 | }
|
---|
1501 |
|
---|
1502 |
|
---|
1503 | /** @interface_method_impl{PDMDRVHLP,pfnAsyncNotificationCompleted} */
|
---|
1504 | static DECLCALLBACK(void) pdmR3DrvHlp_AsyncNotificationCompleted(PPDMDRVINS pDrvIns)
|
---|
1505 | {
|
---|
1506 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1507 | PVM pVM = pDrvIns->Internal.s.pVMR3;
|
---|
1508 |
|
---|
1509 | VMSTATE enmVMState = VMR3GetState(pVM);
|
---|
1510 | if ( enmVMState == VMSTATE_SUSPENDING
|
---|
1511 | || enmVMState == VMSTATE_SUSPENDING_EXT_LS
|
---|
1512 | || enmVMState == VMSTATE_SUSPENDING_LS
|
---|
1513 | || enmVMState == VMSTATE_RESETTING
|
---|
1514 | || enmVMState == VMSTATE_RESETTING_LS
|
---|
1515 | || enmVMState == VMSTATE_POWERING_OFF
|
---|
1516 | || enmVMState == VMSTATE_POWERING_OFF_LS)
|
---|
1517 | {
|
---|
1518 | LogFlow(("pdmR3DrvHlp_AsyncNotificationCompleted: caller='%s'/%d:\n", pDrvIns->pReg->szName, pDrvIns->iInstance));
|
---|
1519 | VMR3AsyncPdmNotificationWakeupU(pVM->pUVM);
|
---|
1520 | }
|
---|
1521 | else
|
---|
1522 | LogFlow(("pdmR3DrvHlp_AsyncNotificationCompleted: caller='%s'/%d: enmVMState=%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance, enmVMState));
|
---|
1523 | }
|
---|
1524 |
|
---|
1525 |
|
---|
1526 | /** @interface_method_impl{PDMDRVHLP,pfnThreadCreate} */
|
---|
1527 | static DECLCALLBACK(int) pdmR3DrvHlp_ThreadCreate(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
|
---|
1528 | PFNPDMTHREADWAKEUPDRV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)
|
---|
1529 | {
|
---|
1530 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1531 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1532 | LogFlow(("pdmR3DrvHlp_ThreadCreate: caller='%s'/%d: ppThread=%p pvUser=%p pfnThread=%p pfnWakeup=%p cbStack=%#zx enmType=%d pszName=%p:{%s}\n",
|
---|
1533 | pDrvIns->pReg->szName, pDrvIns->iInstance, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName, pszName));
|
---|
1534 |
|
---|
1535 | int rc = pdmR3ThreadCreateDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
|
---|
1536 |
|
---|
1537 | LogFlow(("pdmR3DrvHlp_ThreadCreate: caller='%s'/%d: returns %Rrc *ppThread=%RTthrd\n", pDrvIns->pReg->szName, pDrvIns->iInstance,
|
---|
1538 | rc, *ppThread));
|
---|
1539 | return rc;
|
---|
1540 | }
|
---|
1541 |
|
---|
1542 |
|
---|
1543 | /** @interface_method_impl{PDMDRVHLP,pfnAsyncCompletionTemplateCreate} */
|
---|
1544 | static DECLCALLBACK(int) pdmR3DrvHlp_AsyncCompletionTemplateCreate(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate,
|
---|
1545 | PFNPDMASYNCCOMPLETEDRV pfnCompleted, void *pvTemplateUser,
|
---|
1546 | const char *pszDesc)
|
---|
1547 | {
|
---|
1548 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1549 | LogFlow(("pdmR3DrvHlp_AsyncCompletionTemplateCreate: caller='%s'/%d: ppTemplate=%p pfnCompleted=%p pszDesc=%p:{%s}\n",
|
---|
1550 | pDrvIns->pReg->szName, pDrvIns->iInstance, ppTemplate, pfnCompleted, pszDesc, pszDesc));
|
---|
1551 |
|
---|
1552 | int rc = pdmR3AsyncCompletionTemplateCreateDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, ppTemplate, pfnCompleted, pvTemplateUser, pszDesc);
|
---|
1553 |
|
---|
1554 | LogFlow(("pdmR3DrvHlp_AsyncCompletionTemplateCreate: caller='%s'/%d: returns %Rrc *ppThread=%p\n", pDrvIns->pReg->szName,
|
---|
1555 | pDrvIns->iInstance, rc, *ppTemplate));
|
---|
1556 | return rc;
|
---|
1557 | }
|
---|
1558 |
|
---|
1559 |
|
---|
1560 | #ifdef VBOX_WITH_NETSHAPER
|
---|
1561 | /** @interface_method_impl{PDMDRVHLP,pfnNetShaperAttach} */
|
---|
1562 | static DECLCALLBACK(int) pdmR3DrvHlp_NetShaperAttach(PPDMDRVINS pDrvIns, const char *pszBwGroup, PPDMNSFILTER pFilter)
|
---|
1563 | {
|
---|
1564 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1565 | LogFlow(("pdmR3DrvHlp_NetShaperAttach: caller='%s'/%d: pFilter=%p pszBwGroup=%p:{%s}\n",
|
---|
1566 | pDrvIns->pReg->szName, pDrvIns->iInstance, pFilter, pszBwGroup, pszBwGroup));
|
---|
1567 |
|
---|
1568 | int rc = PDMR3NsAttach(pDrvIns->Internal.s.pVMR3->pUVM, pDrvIns, pszBwGroup, pFilter);
|
---|
1569 |
|
---|
1570 | LogFlow(("pdmR3DrvHlp_NetShaperAttach: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName,
|
---|
1571 | pDrvIns->iInstance, rc));
|
---|
1572 | return rc;
|
---|
1573 | }
|
---|
1574 |
|
---|
1575 |
|
---|
1576 | /** @interface_method_impl{PDMDRVHLP,pfnNetShaperDetach} */
|
---|
1577 | static DECLCALLBACK(int) pdmR3DrvHlp_NetShaperDetach(PPDMDRVINS pDrvIns, PPDMNSFILTER pFilter)
|
---|
1578 | {
|
---|
1579 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1580 | LogFlow(("pdmR3DrvHlp_NetShaperDetach: caller='%s'/%d: pFilter=%p\n",
|
---|
1581 | pDrvIns->pReg->szName, pDrvIns->iInstance, pFilter));
|
---|
1582 |
|
---|
1583 | int rc = PDMR3NsDetach(pDrvIns->Internal.s.pVMR3->pUVM, pDrvIns, pFilter);
|
---|
1584 |
|
---|
1585 | LogFlow(("pdmR3DrvHlp_NetShaperDetach: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName,
|
---|
1586 | pDrvIns->iInstance, rc));
|
---|
1587 | return rc;
|
---|
1588 | }
|
---|
1589 | #endif /* VBOX_WITH_NETSHAPER */
|
---|
1590 |
|
---|
1591 |
|
---|
1592 | /** @interface_method_impl{PDMDRVHLP,pfnLdrGetRCInterfaceSymbols} */
|
---|
1593 | static DECLCALLBACK(int) pdmR3DrvHlp_LdrGetRCInterfaceSymbols(PPDMDRVINS pDrvIns, void *pvInterface, size_t cbInterface,
|
---|
1594 | const char *pszSymPrefix, const char *pszSymList)
|
---|
1595 | {
|
---|
1596 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1597 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1598 | LogFlow(("pdmR3DrvHlp_LdrGetRCInterfaceSymbols: caller='%s'/%d: pvInterface=%p cbInterface=%zu pszSymPrefix=%p:{%s} pszSymList=%p:{%s}\n",
|
---|
1599 | pDrvIns->pReg->szName, pDrvIns->iInstance, pvInterface, cbInterface, pszSymPrefix, pszSymPrefix, pszSymList, pszSymList));
|
---|
1600 |
|
---|
1601 | int rc;
|
---|
1602 | if ( strncmp(pszSymPrefix, "drv", 3) == 0
|
---|
1603 | && RTStrIStr(pszSymPrefix + 3, pDrvIns->pReg->szName) != NULL)
|
---|
1604 | {
|
---|
1605 | if (pDrvIns->pReg->fFlags & PDM_DRVREG_FLAGS_RC)
|
---|
1606 | rc = PDMR3LdrGetInterfaceSymbols(pDrvIns->Internal.s.pVMR3,
|
---|
1607 | pvInterface, cbInterface,
|
---|
1608 | pDrvIns->pReg->szRCMod, pDrvIns->Internal.s.pDrv->pszRCSearchPath,
|
---|
1609 | pszSymPrefix, pszSymList,
|
---|
1610 | false /*fRing0OrRC*/);
|
---|
1611 | else
|
---|
1612 | {
|
---|
1613 | AssertMsgFailed(("Not a raw-mode enabled driver\n"));
|
---|
1614 | rc = VERR_PERMISSION_DENIED;
|
---|
1615 | }
|
---|
1616 | }
|
---|
1617 | else
|
---|
1618 | {
|
---|
1619 | AssertMsgFailed(("Invalid prefix '%s' for '%s'; must start with 'drv' and contain the driver name!\n",
|
---|
1620 | pszSymPrefix, pDrvIns->pReg->szName));
|
---|
1621 | rc = VERR_INVALID_NAME;
|
---|
1622 | }
|
---|
1623 |
|
---|
1624 | LogFlow(("pdmR3DrvHlp_LdrGetRCInterfaceSymbols: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName,
|
---|
1625 | pDrvIns->iInstance, rc));
|
---|
1626 | return rc;
|
---|
1627 | }
|
---|
1628 |
|
---|
1629 |
|
---|
1630 | /** @interface_method_impl{PDMDRVHLP,pfnLdrGetR0InterfaceSymbols} */
|
---|
1631 | static DECLCALLBACK(int) pdmR3DrvHlp_LdrGetR0InterfaceSymbols(PPDMDRVINS pDrvIns, void *pvInterface, size_t cbInterface,
|
---|
1632 | const char *pszSymPrefix, const char *pszSymList)
|
---|
1633 | {
|
---|
1634 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1635 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1636 | LogFlow(("pdmR3DrvHlp_LdrGetR0InterfaceSymbols: caller='%s'/%d: pvInterface=%p cbInterface=%zu pszSymPrefix=%p:{%s} pszSymList=%p:{%s}\n",
|
---|
1637 | pDrvIns->pReg->szName, pDrvIns->iInstance, pvInterface, cbInterface, pszSymPrefix, pszSymPrefix, pszSymList, pszSymList));
|
---|
1638 |
|
---|
1639 | int rc;
|
---|
1640 | if ( strncmp(pszSymPrefix, "drv", 3) == 0
|
---|
1641 | && RTStrIStr(pszSymPrefix + 3, pDrvIns->pReg->szName) != NULL)
|
---|
1642 | {
|
---|
1643 | if (pDrvIns->pReg->fFlags & PDM_DRVREG_FLAGS_R0)
|
---|
1644 | rc = PDMR3LdrGetInterfaceSymbols(pDrvIns->Internal.s.pVMR3,
|
---|
1645 | pvInterface, cbInterface,
|
---|
1646 | pDrvIns->pReg->szR0Mod, pDrvIns->Internal.s.pDrv->pszR0SearchPath,
|
---|
1647 | pszSymPrefix, pszSymList,
|
---|
1648 | true /*fRing0OrRC*/);
|
---|
1649 | else
|
---|
1650 | {
|
---|
1651 | AssertMsgFailed(("Not a ring-0 enabled driver\n"));
|
---|
1652 | rc = VERR_PERMISSION_DENIED;
|
---|
1653 | }
|
---|
1654 | }
|
---|
1655 | else
|
---|
1656 | {
|
---|
1657 | AssertMsgFailed(("Invalid prefix '%s' for '%s'; must start with 'drv' and contain the driver name!\n",
|
---|
1658 | pszSymPrefix, pDrvIns->pReg->szName));
|
---|
1659 | rc = VERR_INVALID_NAME;
|
---|
1660 | }
|
---|
1661 |
|
---|
1662 | LogFlow(("pdmR3DrvHlp_LdrGetR0InterfaceSymbols: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName,
|
---|
1663 | pDrvIns->iInstance, rc));
|
---|
1664 | return rc;
|
---|
1665 | }
|
---|
1666 |
|
---|
1667 |
|
---|
1668 | /** @interface_method_impl{PDMDRVHLP,pfnCritSectInit} */
|
---|
1669 | static DECLCALLBACK(int) pdmR3DrvHlp_CritSectInit(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect,
|
---|
1670 | RT_SRC_POS_DECL, const char *pszName)
|
---|
1671 | {
|
---|
1672 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1673 | PVM pVM = pDrvIns->Internal.s.pVMR3;
|
---|
1674 | VM_ASSERT_EMT(pVM);
|
---|
1675 | LogFlow(("pdmR3DrvHlp_CritSectInit: caller='%s'/%d: pCritSect=%p pszName=%s\n",
|
---|
1676 | pDrvIns->pReg->szName, pDrvIns->iInstance, pCritSect, pszName));
|
---|
1677 |
|
---|
1678 | int rc = pdmR3CritSectInitDriver(pVM, pDrvIns, pCritSect, RT_SRC_POS_ARGS, "%s_%u", pszName, pDrvIns->iInstance);
|
---|
1679 |
|
---|
1680 | LogFlow(("pdmR3DrvHlp_CritSectInit: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName,
|
---|
1681 | pDrvIns->iInstance, rc));
|
---|
1682 | return rc;
|
---|
1683 | }
|
---|
1684 |
|
---|
1685 |
|
---|
1686 | /** @interface_method_impl{PDMDRVHLP,pfnCallR0} */
|
---|
1687 | static DECLCALLBACK(int) pdmR3DrvHlp_CallR0(PPDMDRVINS pDrvIns, uint32_t uOperation, uint64_t u64Arg)
|
---|
1688 | {
|
---|
1689 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1690 | PVM pVM = pDrvIns->Internal.s.pVMR3;
|
---|
1691 | LogFlow(("pdmR3DrvHlp_CallR0: caller='%s'/%d: uOperation=%#x u64Arg=%#RX64\n",
|
---|
1692 | pDrvIns->pReg->szName, pDrvIns->iInstance, uOperation, u64Arg));
|
---|
1693 |
|
---|
1694 | /*
|
---|
1695 | * Lazy resolve the ring-0 entry point.
|
---|
1696 | */
|
---|
1697 | int rc = VINF_SUCCESS;
|
---|
1698 | PFNPDMDRVREQHANDLERR0 pfnReqHandlerR0 = pDrvIns->Internal.s.pfnReqHandlerR0;
|
---|
1699 | if (RT_UNLIKELY(pfnReqHandlerR0 == NIL_RTR0PTR))
|
---|
1700 | {
|
---|
1701 | if (pDrvIns->pReg->fFlags & PDM_DRVREG_FLAGS_R0)
|
---|
1702 | {
|
---|
1703 | char szSymbol[ sizeof("drvR0") + sizeof(pDrvIns->pReg->szName) + sizeof("ReqHandler")];
|
---|
1704 | strcat(strcat(strcpy(szSymbol, "drvR0"), pDrvIns->pReg->szName), "ReqHandler");
|
---|
1705 | szSymbol[sizeof("drvR0") - 1] = RT_C_TO_UPPER(szSymbol[sizeof("drvR0") - 1]);
|
---|
1706 |
|
---|
1707 | rc = PDMR3LdrGetSymbolR0Lazy(pVM, pDrvIns->pReg->szR0Mod, pDrvIns->Internal.s.pDrv->pszR0SearchPath, szSymbol,
|
---|
1708 | &pfnReqHandlerR0);
|
---|
1709 | if (RT_SUCCESS(rc))
|
---|
1710 | pDrvIns->Internal.s.pfnReqHandlerR0 = pfnReqHandlerR0;
|
---|
1711 | else
|
---|
1712 | pfnReqHandlerR0 = NIL_RTR0PTR;
|
---|
1713 | }
|
---|
1714 | else
|
---|
1715 | rc = VERR_ACCESS_DENIED;
|
---|
1716 | }
|
---|
1717 | if (RT_LIKELY(pfnReqHandlerR0 != NIL_RTR0PTR))
|
---|
1718 | {
|
---|
1719 | /*
|
---|
1720 | * Make the ring-0 call.
|
---|
1721 | */
|
---|
1722 | PDMDRIVERCALLREQHANDLERREQ Req;
|
---|
1723 | Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
|
---|
1724 | Req.Hdr.cbReq = sizeof(Req);
|
---|
1725 | Req.pDrvInsR0 = PDMDRVINS_2_R0PTR(pDrvIns);
|
---|
1726 | Req.uOperation = uOperation;
|
---|
1727 | Req.u32Alignment = 0;
|
---|
1728 | Req.u64Arg = u64Arg;
|
---|
1729 | rc = SUPR3CallVMMR0Ex(pVM->pVMR0, NIL_VMCPUID, VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER, 0, &Req.Hdr);
|
---|
1730 | }
|
---|
1731 |
|
---|
1732 | LogFlow(("pdmR3DrvHlp_CallR0: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName,
|
---|
1733 | pDrvIns->iInstance, rc));
|
---|
1734 | return rc;
|
---|
1735 | }
|
---|
1736 |
|
---|
1737 |
|
---|
1738 | /** @interface_method_impl{PDMDRVHLP,pfnFTSetCheckpoint} */
|
---|
1739 | static DECLCALLBACK(int) pdmR3DrvHlp_FTSetCheckpoint(PPDMDRVINS pDrvIns, FTMCHECKPOINTTYPE enmType)
|
---|
1740 | {
|
---|
1741 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1742 | return FTMSetCheckpoint(pDrvIns->Internal.s.pVMR3, enmType);
|
---|
1743 | }
|
---|
1744 |
|
---|
1745 |
|
---|
1746 | /** @interface_method_impl{PDMDRVHLP,pfnBlkCacheRetain} */
|
---|
1747 | static DECLCALLBACK(int) pdmR3DrvHlp_BlkCacheRetain(PPDMDRVINS pDrvIns, PPPDMBLKCACHE ppBlkCache,
|
---|
1748 | PFNPDMBLKCACHEXFERCOMPLETEDRV pfnXferComplete,
|
---|
1749 | PFNPDMBLKCACHEXFERENQUEUEDRV pfnXferEnqueue,
|
---|
1750 | PFNPDMBLKCACHEXFERENQUEUEDISCARDDRV pfnXferEnqueueDiscard,
|
---|
1751 | const char *pcszId)
|
---|
1752 | {
|
---|
1753 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1754 | return PDMR3BlkCacheRetainDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, ppBlkCache,
|
---|
1755 | pfnXferComplete, pfnXferEnqueue, pfnXferEnqueueDiscard, pcszId);
|
---|
1756 | }
|
---|
1757 |
|
---|
1758 |
|
---|
1759 | /**
|
---|
1760 | * The driver helper structure.
|
---|
1761 | */
|
---|
1762 | const PDMDRVHLPR3 g_pdmR3DrvHlp =
|
---|
1763 | {
|
---|
1764 | PDM_DRVHLPR3_VERSION,
|
---|
1765 | pdmR3DrvHlp_Attach,
|
---|
1766 | pdmR3DrvHlp_Detach,
|
---|
1767 | pdmR3DrvHlp_DetachSelf,
|
---|
1768 | pdmR3DrvHlp_MountPrepare,
|
---|
1769 | pdmR3DrvHlp_AssertEMT,
|
---|
1770 | pdmR3DrvHlp_AssertOther,
|
---|
1771 | pdmR3DrvHlp_VMSetError,
|
---|
1772 | pdmR3DrvHlp_VMSetErrorV,
|
---|
1773 | pdmR3DrvHlp_VMSetRuntimeError,
|
---|
1774 | pdmR3DrvHlp_VMSetRuntimeErrorV,
|
---|
1775 | pdmR3DrvHlp_VMState,
|
---|
1776 | pdmR3DrvHlp_VMTeleportedAndNotFullyResumedYet,
|
---|
1777 | pdmR3DrvHlp_GetSupDrvSession,
|
---|
1778 | pdmR3DrvHlp_QueueCreate,
|
---|
1779 | pdmR3DrvHlp_TMGetVirtualFreq,
|
---|
1780 | pdmR3DrvHlp_TMGetVirtualTime,
|
---|
1781 | pdmR3DrvHlp_TMTimerCreate,
|
---|
1782 | pdmR3DrvHlp_SSMRegister,
|
---|
1783 | pdmR3DrvHlp_SSMDeregister,
|
---|
1784 | pdmR3DrvHlp_DBGFInfoRegister,
|
---|
1785 | pdmR3DrvHlp_DBGFInfoDeregister,
|
---|
1786 | pdmR3DrvHlp_STAMRegister,
|
---|
1787 | pdmR3DrvHlp_STAMRegisterF,
|
---|
1788 | pdmR3DrvHlp_STAMRegisterV,
|
---|
1789 | pdmR3DrvHlp_STAMDeregister,
|
---|
1790 | pdmR3DrvHlp_SUPCallVMMR0Ex,
|
---|
1791 | pdmR3DrvHlp_USBRegisterHub,
|
---|
1792 | pdmR3DrvHlp_SetAsyncNotification,
|
---|
1793 | pdmR3DrvHlp_AsyncNotificationCompleted,
|
---|
1794 | pdmR3DrvHlp_ThreadCreate,
|
---|
1795 | pdmR3DrvHlp_AsyncCompletionTemplateCreate,
|
---|
1796 | #ifdef VBOX_WITH_NETSHAPER
|
---|
1797 | pdmR3DrvHlp_NetShaperAttach,
|
---|
1798 | pdmR3DrvHlp_NetShaperDetach,
|
---|
1799 | #endif /* VBOX_WITH_NETSHAPER */
|
---|
1800 | pdmR3DrvHlp_LdrGetRCInterfaceSymbols,
|
---|
1801 | pdmR3DrvHlp_LdrGetR0InterfaceSymbols,
|
---|
1802 | pdmR3DrvHlp_CritSectInit,
|
---|
1803 | pdmR3DrvHlp_CallR0,
|
---|
1804 | pdmR3DrvHlp_FTSetCheckpoint,
|
---|
1805 | pdmR3DrvHlp_BlkCacheRetain,
|
---|
1806 | PDM_DRVHLPR3_VERSION /* u32TheEnd */
|
---|
1807 | };
|
---|
1808 |
|
---|
1809 | /** @} */
|
---|