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