1 | /* $Id: PDMDriver.cpp 34222 2010-11-21 22:10:56Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * PDM - Pluggable Device and Driver Manager, Driver parts.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2010 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/pdm.h>
|
---|
25 | #include <VBox/mm.h>
|
---|
26 | #include <VBox/cfgm.h>
|
---|
27 | #include <VBox/vmm.h>
|
---|
28 | #include <VBox/sup.h>
|
---|
29 | #include <VBox/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 | } PDMDRVREGCBINT, *PPDMDRVREGCBINT;
|
---|
61 | typedef const PDMDRVREGCBINT *PCPDMDRVREGCBINT;
|
---|
62 |
|
---|
63 |
|
---|
64 | /*******************************************************************************
|
---|
65 | * Internal Functions *
|
---|
66 | *******************************************************************************/
|
---|
67 | static DECLCALLBACK(int) pdmR3DrvRegister(PCPDMDRVREGCB pCallbacks, PCPDMDRVREG pReg);
|
---|
68 | static int pdmR3DrvLoad(PVM pVM, PPDMDRVREGCBINT pRegCB, const char *pszFilename, const char *pszName);
|
---|
69 |
|
---|
70 |
|
---|
71 |
|
---|
72 | /**
|
---|
73 | * Register external drivers
|
---|
74 | *
|
---|
75 | * @returns VBox status code.
|
---|
76 | * @param pVM The VM to operate on.
|
---|
77 | * @param pfnCallback Driver registration callback
|
---|
78 | */
|
---|
79 | VMMR3DECL(int) PDMR3RegisterDrivers(PVM pVM, FNPDMVBOXDRIVERSREGISTER pfnCallback)
|
---|
80 | {
|
---|
81 | /*
|
---|
82 | * The registration callbacks.
|
---|
83 | */
|
---|
84 | PDMDRVREGCBINT RegCB;
|
---|
85 | RegCB.Core.u32Version = PDM_DRVREG_CB_VERSION;
|
---|
86 | RegCB.Core.pfnRegister = pdmR3DrvRegister;
|
---|
87 | RegCB.pVM = pVM;
|
---|
88 |
|
---|
89 | int rc = pfnCallback(&RegCB.Core, VBOX_VERSION);
|
---|
90 | if (RT_FAILURE(rc))
|
---|
91 | AssertMsgFailed(("VBoxDriversRegister failed with rc=%Rrc\n"));
|
---|
92 |
|
---|
93 | return rc;
|
---|
94 | }
|
---|
95 |
|
---|
96 | /**
|
---|
97 | * This function will initialize the drivers for this VM instance.
|
---|
98 | *
|
---|
99 | * First of all this mean loading the builtin drivers and letting them
|
---|
100 | * register themselves. Beyond that any additional driver modules are
|
---|
101 | * loaded and called for registration.
|
---|
102 | *
|
---|
103 | * @returns VBox status code.
|
---|
104 | * @param pVM VM Handle.
|
---|
105 | */
|
---|
106 | int pdmR3DrvInit(PVM pVM)
|
---|
107 | {
|
---|
108 | LogFlow(("pdmR3DrvInit:\n"));
|
---|
109 |
|
---|
110 | AssertRelease(!(RT_OFFSETOF(PDMDRVINS, achInstanceData) & 15));
|
---|
111 | PPDMDRVINS pDrvInsAssert; NOREF(pDrvInsAssert);
|
---|
112 | AssertCompile(sizeof(pDrvInsAssert->Internal.s) <= sizeof(pDrvInsAssert->Internal.padding));
|
---|
113 | AssertRelease(sizeof(pDrvInsAssert->Internal.s) <= sizeof(pDrvInsAssert->Internal.padding));
|
---|
114 |
|
---|
115 | /*
|
---|
116 | * The registration callbacks.
|
---|
117 | */
|
---|
118 | PDMDRVREGCBINT RegCB;
|
---|
119 | RegCB.Core.u32Version = PDM_DRVREG_CB_VERSION;
|
---|
120 | RegCB.Core.pfnRegister = pdmR3DrvRegister;
|
---|
121 | RegCB.pVM = pVM;
|
---|
122 |
|
---|
123 | /*
|
---|
124 | * Load the builtin module
|
---|
125 | */
|
---|
126 | PCFGMNODE pDriversNode = CFGMR3GetChild(CFGMR3GetRoot(pVM), "PDM/Drivers");
|
---|
127 | bool fLoadBuiltin;
|
---|
128 | int rc = CFGMR3QueryBool(pDriversNode, "LoadBuiltin", &fLoadBuiltin);
|
---|
129 | if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT)
|
---|
130 | fLoadBuiltin = true;
|
---|
131 | else if (RT_FAILURE(rc))
|
---|
132 | {
|
---|
133 | AssertMsgFailed(("Configuration error: Querying boolean \"LoadBuiltin\" failed with %Rrc\n", rc));
|
---|
134 | return rc;
|
---|
135 | }
|
---|
136 | if (fLoadBuiltin)
|
---|
137 | {
|
---|
138 | /* make filename */
|
---|
139 | char *pszFilename = pdmR3FileR3("VBoxDD", /*fShared=*/true);
|
---|
140 | if (!pszFilename)
|
---|
141 | return VERR_NO_TMP_MEMORY;
|
---|
142 | rc = pdmR3DrvLoad(pVM, &RegCB, pszFilename, "VBoxDD");
|
---|
143 | RTMemTmpFree(pszFilename);
|
---|
144 | if (RT_FAILURE(rc))
|
---|
145 | return rc;
|
---|
146 | }
|
---|
147 |
|
---|
148 | /*
|
---|
149 | * Load additional driver modules.
|
---|
150 | */
|
---|
151 | for (PCFGMNODE pCur = CFGMR3GetFirstChild(pDriversNode); pCur; pCur = CFGMR3GetNextChild(pCur))
|
---|
152 | {
|
---|
153 | /*
|
---|
154 | * Get the name and path.
|
---|
155 | */
|
---|
156 | char szName[PDMMOD_NAME_LEN];
|
---|
157 | rc = CFGMR3GetName(pCur, &szName[0], sizeof(szName));
|
---|
158 | if (rc == VERR_CFGM_NOT_ENOUGH_SPACE)
|
---|
159 | {
|
---|
160 | AssertMsgFailed(("configuration error: The module name is too long, cchName=%zu.\n", CFGMR3GetNameLen(pCur)));
|
---|
161 | return VERR_PDM_MODULE_NAME_TOO_LONG;
|
---|
162 | }
|
---|
163 | else if (RT_FAILURE(rc))
|
---|
164 | {
|
---|
165 | AssertMsgFailed(("CFGMR3GetName -> %Rrc.\n", rc));
|
---|
166 | return rc;
|
---|
167 | }
|
---|
168 |
|
---|
169 | /* the path is optional, if no path the module name + path is used. */
|
---|
170 | char szFilename[RTPATH_MAX];
|
---|
171 | rc = CFGMR3QueryString(pCur, "Path", &szFilename[0], sizeof(szFilename));
|
---|
172 | if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT)
|
---|
173 | strcpy(szFilename, szName);
|
---|
174 | else if (RT_FAILURE(rc))
|
---|
175 | {
|
---|
176 | AssertMsgFailed(("configuration error: Failure to query the module path, rc=%Rrc.\n", rc));
|
---|
177 | return rc;
|
---|
178 | }
|
---|
179 |
|
---|
180 | /* prepend path? */
|
---|
181 | if (!RTPathHavePath(szFilename))
|
---|
182 | {
|
---|
183 | char *psz = pdmR3FileR3(szFilename);
|
---|
184 | if (!psz)
|
---|
185 | return VERR_NO_TMP_MEMORY;
|
---|
186 | size_t cch = strlen(psz) + 1;
|
---|
187 | if (cch > sizeof(szFilename))
|
---|
188 | {
|
---|
189 | RTMemTmpFree(psz);
|
---|
190 | AssertMsgFailed(("Filename too long! cch=%d '%s'\n", cch, psz));
|
---|
191 | return VERR_FILENAME_TOO_LONG;
|
---|
192 | }
|
---|
193 | memcpy(szFilename, psz, cch);
|
---|
194 | RTMemTmpFree(psz);
|
---|
195 | }
|
---|
196 |
|
---|
197 | /*
|
---|
198 | * Load the module and register it's drivers.
|
---|
199 | */
|
---|
200 | rc = pdmR3DrvLoad(pVM, &RegCB, szFilename, szName);
|
---|
201 | if (RT_FAILURE(rc))
|
---|
202 | return rc;
|
---|
203 | }
|
---|
204 |
|
---|
205 | LogFlow(("pdmR3DrvInit: returns VINF_SUCCESS\n"));
|
---|
206 | return VINF_SUCCESS;
|
---|
207 | }
|
---|
208 |
|
---|
209 |
|
---|
210 | /**
|
---|
211 | * Loads one driver module and call the registration entry point.
|
---|
212 | *
|
---|
213 | * @returns VBox status code.
|
---|
214 | * @param pVM VM handle.
|
---|
215 | * @param pRegCB The registration callback stuff.
|
---|
216 | * @param pszFilename Module filename.
|
---|
217 | * @param pszName Module name.
|
---|
218 | */
|
---|
219 | static int pdmR3DrvLoad(PVM pVM, PPDMDRVREGCBINT pRegCB, const char *pszFilename, const char *pszName)
|
---|
220 | {
|
---|
221 | /*
|
---|
222 | * Load it.
|
---|
223 | */
|
---|
224 | int rc = pdmR3LoadR3U(pVM->pUVM, pszFilename, pszName);
|
---|
225 | if (RT_SUCCESS(rc))
|
---|
226 | {
|
---|
227 | /*
|
---|
228 | * Get the registration export and call it.
|
---|
229 | */
|
---|
230 | FNPDMVBOXDRIVERSREGISTER *pfnVBoxDriversRegister;
|
---|
231 | rc = PDMR3LdrGetSymbolR3(pVM, pszName, "VBoxDriversRegister", (void **)&pfnVBoxDriversRegister);
|
---|
232 | if (RT_SUCCESS(rc))
|
---|
233 | {
|
---|
234 | Log(("PDM: Calling VBoxDriversRegister (%p) of %s (%s)\n", pfnVBoxDriversRegister, pszName, pszFilename));
|
---|
235 | rc = pfnVBoxDriversRegister(&pRegCB->Core, VBOX_VERSION);
|
---|
236 | if (RT_SUCCESS(rc))
|
---|
237 | Log(("PDM: Successfully loaded driver module %s (%s).\n", pszName, pszFilename));
|
---|
238 | else
|
---|
239 | AssertMsgFailed(("VBoxDriversRegister failed with rc=%Rrc\n"));
|
---|
240 | }
|
---|
241 | else
|
---|
242 | {
|
---|
243 | AssertMsgFailed(("Failed to locate 'VBoxDriversRegister' in %s (%s) rc=%Rrc\n", pszName, pszFilename, rc));
|
---|
244 | if (rc == VERR_SYMBOL_NOT_FOUND)
|
---|
245 | rc = VERR_PDM_NO_REGISTRATION_EXPORT;
|
---|
246 | }
|
---|
247 | }
|
---|
248 | else
|
---|
249 | AssertMsgFailed(("Failed to load %s (%s) rc=%Rrc!\n", pszName, pszFilename, rc));
|
---|
250 | return rc;
|
---|
251 | }
|
---|
252 |
|
---|
253 |
|
---|
254 | /** @interface_method_impl{PDMDRVREGCB,pfnRegister} */
|
---|
255 | static DECLCALLBACK(int) pdmR3DrvRegister(PCPDMDRVREGCB pCallbacks, PCPDMDRVREG pReg)
|
---|
256 | {
|
---|
257 | /*
|
---|
258 | * Validate the registration structure.
|
---|
259 | */
|
---|
260 | AssertPtrReturn(pReg, VERR_INVALID_POINTER);
|
---|
261 | AssertMsgReturn(pReg->u32Version == PDM_DRVREG_VERSION,
|
---|
262 | ("%#x\n", pReg->u32Version),
|
---|
263 | VERR_PDM_UNKNOWN_DRVREG_VERSION);
|
---|
264 | AssertReturn(pReg->szName[0], VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
265 | AssertMsgReturn(RTStrEnd(pReg->szName, sizeof(pReg->szName)),
|
---|
266 | (".*s\n", sizeof(pReg->szName), pReg->szName),
|
---|
267 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
268 | AssertMsgReturn( !(pReg->fFlags & PDM_DRVREG_FLAGS_R0)
|
---|
269 | || ( pReg->szR0Mod[0]
|
---|
270 | && RTStrEnd(pReg->szR0Mod, sizeof(pReg->szR0Mod))),
|
---|
271 | ("%s: %.*s\n", pReg->szName, sizeof(pReg->szR0Mod), pReg->szR0Mod),
|
---|
272 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
273 | AssertMsgReturn( !(pReg->fFlags & PDM_DRVREG_FLAGS_RC)
|
---|
274 | || ( pReg->szRCMod[0]
|
---|
275 | && RTStrEnd(pReg->szRCMod, sizeof(pReg->szRCMod))),
|
---|
276 | ("%s: %.*s\n", pReg->szName, sizeof(pReg->szRCMod), pReg->szRCMod),
|
---|
277 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
278 | AssertMsgReturn(VALID_PTR(pReg->pszDescription),
|
---|
279 | ("%s: %p\n", pReg->szName, pReg->pszDescription),
|
---|
280 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
281 | AssertMsgReturn(!(pReg->fFlags & ~(PDM_DRVREG_FLAGS_HOST_BITS_MASK | PDM_DRVREG_FLAGS_R0 | PDM_DRVREG_FLAGS_RC)),
|
---|
282 | ("%s: %#x\n", pReg->szName, pReg->fFlags),
|
---|
283 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
284 | AssertMsgReturn((pReg->fFlags & PDM_DRVREG_FLAGS_HOST_BITS_MASK) == PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
|
---|
285 | ("%s: %#x\n", pReg->szName, pReg->fFlags),
|
---|
286 | VERR_PDM_INVALID_DRIVER_HOST_BITS);
|
---|
287 | AssertMsgReturn(pReg->cMaxInstances > 0,
|
---|
288 | ("%s: %#x\n", pReg->szName, pReg->cMaxInstances),
|
---|
289 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
290 | AssertMsgReturn(pReg->cbInstance <= _1M,
|
---|
291 | ("%s: %#x\n", pReg->szName, pReg->cbInstance),
|
---|
292 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
293 | AssertMsgReturn(VALID_PTR(pReg->pfnConstruct),
|
---|
294 | ("%s: %p\n", pReg->szName, pReg->pfnConstruct),
|
---|
295 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
296 | AssertMsgReturn(VALID_PTR(pReg->pfnRelocate) || !(pReg->fFlags & PDM_DRVREG_FLAGS_RC),
|
---|
297 | ("%s: %#x\n", pReg->szName, pReg->cbInstance),
|
---|
298 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
299 | AssertMsgReturn(pReg->pfnSoftReset == NULL,
|
---|
300 | ("%s: %p\n", pReg->szName, pReg->pfnSoftReset),
|
---|
301 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
302 | AssertMsgReturn(pReg->u32VersionEnd == PDM_DRVREG_VERSION,
|
---|
303 | ("%s: #x\n", pReg->szName, pReg->u32VersionEnd),
|
---|
304 | VERR_PDM_INVALID_DRIVER_REGISTRATION);
|
---|
305 |
|
---|
306 | /*
|
---|
307 | * Check for duplicate and find FIFO entry at the same time.
|
---|
308 | */
|
---|
309 | PCPDMDRVREGCBINT pRegCB = (PCPDMDRVREGCBINT)pCallbacks;
|
---|
310 | PPDMDRV pDrvPrev = NULL;
|
---|
311 | PPDMDRV pDrv = pRegCB->pVM->pdm.s.pDrvs;
|
---|
312 | for (; pDrv; pDrvPrev = pDrv, pDrv = pDrv->pNext)
|
---|
313 | {
|
---|
314 | if (!strcmp(pDrv->pReg->szName, pReg->szName))
|
---|
315 | {
|
---|
316 | AssertMsgFailed(("Driver '%s' already exists\n", pReg->szName));
|
---|
317 | return VERR_PDM_DRIVER_NAME_CLASH;
|
---|
318 | }
|
---|
319 | }
|
---|
320 |
|
---|
321 | /*
|
---|
322 | * Allocate new driver structure and insert it into the list.
|
---|
323 | */
|
---|
324 | pDrv = (PPDMDRV)MMR3HeapAlloc(pRegCB->pVM, MM_TAG_PDM_DRIVER, sizeof(*pDrv));
|
---|
325 | if (pDrv)
|
---|
326 | {
|
---|
327 | pDrv->pNext = NULL;
|
---|
328 | pDrv->cInstances = 0;
|
---|
329 | pDrv->iNextInstance = 0;
|
---|
330 | pDrv->pReg = pReg;
|
---|
331 |
|
---|
332 | if (pDrvPrev)
|
---|
333 | pDrvPrev->pNext = pDrv;
|
---|
334 | else
|
---|
335 | pRegCB->pVM->pdm.s.pDrvs = pDrv;
|
---|
336 | Log(("PDM: Registered driver '%s'\n", pReg->szName));
|
---|
337 | return VINF_SUCCESS;
|
---|
338 | }
|
---|
339 | return VERR_NO_MEMORY;
|
---|
340 | }
|
---|
341 |
|
---|
342 |
|
---|
343 | /**
|
---|
344 | * Lookups a driver structure by name.
|
---|
345 | * @internal
|
---|
346 | */
|
---|
347 | PPDMDRV pdmR3DrvLookup(PVM pVM, const char *pszName)
|
---|
348 | {
|
---|
349 | for (PPDMDRV pDrv = pVM->pdm.s.pDrvs; pDrv; pDrv = pDrv->pNext)
|
---|
350 | if (!strcmp(pDrv->pReg->szName, pszName))
|
---|
351 | return pDrv;
|
---|
352 | return NULL;
|
---|
353 | }
|
---|
354 |
|
---|
355 |
|
---|
356 | /**
|
---|
357 | * Instantiate a driver.
|
---|
358 | *
|
---|
359 | * @returns VBox status code, including informational statuses.
|
---|
360 | *
|
---|
361 | * @param pVM The VM handle.
|
---|
362 | * @param pNode The CFGM node for the driver.
|
---|
363 | * @param pBaseInterface The base interface.
|
---|
364 | * @param pDrvAbove The driver above it. NULL if it's the top-most
|
---|
365 | * driver.
|
---|
366 | * @param pLun The LUN the driver is being attached to. NULL
|
---|
367 | * if we're instantiating a driver chain before
|
---|
368 | * attaching it - untested.
|
---|
369 | * @param ppBaseInterface Where to return the pointer to the base
|
---|
370 | * interface of the newly created driver.
|
---|
371 | *
|
---|
372 | * @remarks Recursive calls to this function is normal as the drivers will
|
---|
373 | * attach to anything below them during the pfnContruct call.
|
---|
374 | */
|
---|
375 | int pdmR3DrvInstantiate(PVM pVM, PCFGMNODE pNode, PPDMIBASE pBaseInterface, PPDMDRVINS pDrvAbove,
|
---|
376 | PPDMLUN pLun, PPDMIBASE *ppBaseInterface)
|
---|
377 | {
|
---|
378 | Assert(!pDrvAbove || !pDrvAbove->Internal.s.pDown);
|
---|
379 | Assert(!pDrvAbove || !pDrvAbove->pDownBase);
|
---|
380 |
|
---|
381 | Assert(pBaseInterface->pfnQueryInterface(pBaseInterface, PDMIBASE_IID) == pBaseInterface);
|
---|
382 |
|
---|
383 | /*
|
---|
384 | * Find the driver.
|
---|
385 | */
|
---|
386 | char *pszName;
|
---|
387 | int rc = CFGMR3QueryStringAlloc(pNode, "Driver", &pszName);
|
---|
388 | if (RT_SUCCESS(rc))
|
---|
389 | {
|
---|
390 | PPDMDRV pDrv = pdmR3DrvLookup(pVM, pszName);
|
---|
391 | MMR3HeapFree(pszName);
|
---|
392 | if ( pDrv
|
---|
393 | && pDrv->cInstances < pDrv->pReg->cMaxInstances)
|
---|
394 | {
|
---|
395 | /* config node */
|
---|
396 | PCFGMNODE pConfigNode = CFGMR3GetChild(pNode, "Config");
|
---|
397 | if (!pConfigNode)
|
---|
398 | rc = CFGMR3InsertNode(pNode, "Config", &pConfigNode);
|
---|
399 | if (RT_SUCCESS(rc))
|
---|
400 | {
|
---|
401 | CFGMR3SetRestrictedRoot(pConfigNode);
|
---|
402 |
|
---|
403 | /*
|
---|
404 | * Allocate the driver instance.
|
---|
405 | */
|
---|
406 | size_t cb = RT_OFFSETOF(PDMDRVINS, achInstanceData[pDrv->pReg->cbInstance]);
|
---|
407 | cb = RT_ALIGN_Z(cb, 16);
|
---|
408 | bool const fHyperHeap = !!(pDrv->pReg->fFlags & (PDM_DRVREG_FLAGS_R0 | PDM_DRVREG_FLAGS_RC));
|
---|
409 | PPDMDRVINS pNew;
|
---|
410 | if (fHyperHeap)
|
---|
411 | rc = MMHyperAlloc(pVM, cb, 64, MM_TAG_PDM_DRIVER, (void **)&pNew);
|
---|
412 | else
|
---|
413 | rc = MMR3HeapAllocZEx(pVM, MM_TAG_PDM_DRIVER, cb, (void **)&pNew);
|
---|
414 | if (pNew)
|
---|
415 | {
|
---|
416 | /*
|
---|
417 | * Initialize the instance structure (declaration order).
|
---|
418 | */
|
---|
419 | pNew->u32Version = PDM_DRVINS_VERSION;
|
---|
420 | pNew->Internal.s.pUp = pDrvAbove ? pDrvAbove : NULL;
|
---|
421 | //pNew->Internal.s.pDown = NULL;
|
---|
422 | pNew->Internal.s.pLun = pLun;
|
---|
423 | pNew->Internal.s.pDrv = pDrv;
|
---|
424 | pNew->Internal.s.pVMR3 = pVM;
|
---|
425 | pNew->Internal.s.pVMR0 = pDrv->pReg->fFlags & PDM_DRVREG_FLAGS_R0 ? pVM->pVMR0 : NIL_RTR0PTR;
|
---|
426 | pNew->Internal.s.pVMRC = pDrv->pReg->fFlags & PDM_DRVREG_FLAGS_RC ? pVM->pVMRC : NIL_RTRCPTR;
|
---|
427 | //pNew->Internal.s.fDetaching = false;
|
---|
428 | pNew->Internal.s.fVMSuspended = true;
|
---|
429 | //pNew->Internal.s.fVMReset = false;
|
---|
430 | pNew->Internal.s.fHyperHeap = fHyperHeap;
|
---|
431 | //pNew->Internal.s.pfnAsyncNotify = NULL;
|
---|
432 | pNew->Internal.s.pCfgHandle = pNode;
|
---|
433 | pNew->pReg = pDrv->pReg;
|
---|
434 | pNew->pCfg = pConfigNode;
|
---|
435 | pNew->iInstance = pDrv->iNextInstance;
|
---|
436 | pNew->pUpBase = pBaseInterface;
|
---|
437 | Assert(!pDrvAbove || pBaseInterface == &pDrvAbove->IBase);
|
---|
438 | //pNew->pDownBase = NULL;
|
---|
439 | //pNew->IBase.pfnQueryInterface = NULL;
|
---|
440 | pNew->pHlpR3 = &g_pdmR3DrvHlp;
|
---|
441 | pNew->pvInstanceDataR3 = &pNew->achInstanceData[0];
|
---|
442 | if (pDrv->pReg->fFlags & PDM_DRVREG_FLAGS_R0)
|
---|
443 | {
|
---|
444 | pNew->pvInstanceDataR0 = MMHyperR3ToR0(pVM, &pNew->achInstanceData[0]);
|
---|
445 | rc = PDMR3LdrGetSymbolR0(pVM, NULL, "g_pdmR0DrvHlp", &pNew->pHlpR0);
|
---|
446 | AssertReleaseRCReturn(rc, rc);
|
---|
447 |
|
---|
448 | }
|
---|
449 | if (pDrv->pReg->fFlags & PDM_DRVREG_FLAGS_RC)
|
---|
450 | {
|
---|
451 | pNew->pvInstanceDataR0 = MMHyperR3ToRC(pVM, &pNew->achInstanceData[0]);
|
---|
452 | rc = PDMR3LdrGetSymbolRC(pVM, NULL, "g_pdmRCDrvHlp", &pNew->pHlpRC);
|
---|
453 | AssertReleaseRCReturn(rc, rc);
|
---|
454 | }
|
---|
455 |
|
---|
456 | pDrv->iNextInstance++;
|
---|
457 | pDrv->cInstances++;
|
---|
458 |
|
---|
459 | /*
|
---|
460 | * Link with it with the driver above / LUN.
|
---|
461 | */
|
---|
462 | if (pDrvAbove)
|
---|
463 | {
|
---|
464 | pDrvAbove->pDownBase = &pNew->IBase;
|
---|
465 | pDrvAbove->Internal.s.pDown = pNew;
|
---|
466 | }
|
---|
467 | else if (pLun)
|
---|
468 | pLun->pTop = pNew;
|
---|
469 | if (pLun)
|
---|
470 | pLun->pBottom = pNew;
|
---|
471 |
|
---|
472 | /*
|
---|
473 | * Invoke the constructor.
|
---|
474 | */
|
---|
475 | rc = pDrv->pReg->pfnConstruct(pNew, pNew->pCfg, 0 /*fFlags*/);
|
---|
476 | if (RT_SUCCESS(rc))
|
---|
477 | {
|
---|
478 | AssertPtr(pNew->IBase.pfnQueryInterface);
|
---|
479 | Assert(pNew->IBase.pfnQueryInterface(&pNew->IBase, PDMIBASE_IID) == &pNew->IBase);
|
---|
480 |
|
---|
481 | /* Success! */
|
---|
482 | *ppBaseInterface = &pNew->IBase;
|
---|
483 | if (pLun)
|
---|
484 | Log(("PDM: Attached driver %p:'%s'/%d to LUN#%d on device '%s'/%d, pDrvAbove=%p:'%s'/%d\n",
|
---|
485 | pNew, pDrv->pReg->szName, pNew->iInstance,
|
---|
486 | pLun->iLun,
|
---|
487 | pLun->pDevIns ? pLun->pDevIns->pReg->szName : pLun->pUsbIns->pReg->szName,
|
---|
488 | pLun->pDevIns ? pLun->pDevIns->iInstance : pLun->pUsbIns->iInstance,
|
---|
489 | pDrvAbove, pDrvAbove ? pDrvAbove->pReg->szName : "", pDrvAbove ? pDrvAbove->iInstance : UINT32_MAX));
|
---|
490 | else
|
---|
491 | Log(("PDM: Attached driver %p:'%s'/%d, pDrvAbove=%p:'%s'/%d\n",
|
---|
492 | pNew, pDrv->pReg->szName, pNew->iInstance,
|
---|
493 | pDrvAbove, pDrvAbove ? pDrvAbove->pReg->szName : "", pDrvAbove ? pDrvAbove->iInstance : UINT32_MAX));
|
---|
494 | }
|
---|
495 | else
|
---|
496 | pdmR3DrvDestroyChain(pNew, PDM_TACH_FLAGS_NO_CALLBACKS);
|
---|
497 | }
|
---|
498 | else
|
---|
499 | {
|
---|
500 | AssertMsgFailed(("Failed to allocate %d bytes for instantiating driver '%s'\n", cb, pszName));
|
---|
501 | rc = VERR_NO_MEMORY;
|
---|
502 | }
|
---|
503 | }
|
---|
504 | else
|
---|
505 | AssertMsgFailed(("Failed to create Config node! rc=%Rrc\n", rc));
|
---|
506 | }
|
---|
507 | else if (pDrv)
|
---|
508 | {
|
---|
509 | AssertMsgFailed(("Too many instances of driver '%s', max is %u\n", pszName, pDrv->pReg->cMaxInstances));
|
---|
510 | rc = VERR_PDM_TOO_MANY_DRIVER_INSTANCES;
|
---|
511 | }
|
---|
512 | else
|
---|
513 | {
|
---|
514 | AssertMsgFailed(("Driver '%s' wasn't found!\n", pszName));
|
---|
515 | rc = VERR_PDM_DRIVER_NOT_FOUND;
|
---|
516 | }
|
---|
517 | }
|
---|
518 | else
|
---|
519 | {
|
---|
520 | AssertMsgFailed(("Query for string value of \"Driver\" -> %Rrc\n", rc));
|
---|
521 | if (rc == VERR_CFGM_VALUE_NOT_FOUND)
|
---|
522 | rc = VERR_PDM_CFG_MISSING_DRIVER_NAME;
|
---|
523 | }
|
---|
524 | return rc;
|
---|
525 | }
|
---|
526 |
|
---|
527 |
|
---|
528 | /**
|
---|
529 | * Detaches a driver from whatever it's attached to.
|
---|
530 | * This will of course lead to the destruction of the driver and all drivers below it in the chain.
|
---|
531 | *
|
---|
532 | * @returns VINF_SUCCESS
|
---|
533 | * @param pDrvIns The driver instance to detach.
|
---|
534 | * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
|
---|
535 | */
|
---|
536 | int pdmR3DrvDetach(PPDMDRVINS pDrvIns, uint32_t fFlags)
|
---|
537 | {
|
---|
538 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
539 | LogFlow(("pdmR3DrvDetach: pDrvIns=%p '%s'/%d\n", pDrvIns, pDrvIns->pReg->szName, pDrvIns->iInstance));
|
---|
540 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
541 |
|
---|
542 | /*
|
---|
543 | * Check that we're not doing this recursively, that could have unwanted sideeffects!
|
---|
544 | */
|
---|
545 | if (pDrvIns->Internal.s.fDetaching)
|
---|
546 | {
|
---|
547 | AssertMsgFailed(("Recursive detach! '%s'/%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance));
|
---|
548 | return VINF_SUCCESS; }
|
---|
549 |
|
---|
550 | /*
|
---|
551 | * Check that we actually can detach this instance.
|
---|
552 | * The requirement is that the driver/device above has a detach method.
|
---|
553 | */
|
---|
554 | if (pDrvIns->Internal.s.pUp
|
---|
555 | ? !pDrvIns->Internal.s.pUp->pReg->pfnDetach
|
---|
556 | : !pDrvIns->Internal.s.pLun->pDevIns->pReg->pfnDetach)
|
---|
557 | {
|
---|
558 | AssertMsgFailed(("Cannot detach driver instance because the driver/device above doesn't support it!\n"));
|
---|
559 | return VERR_PDM_DRIVER_DETACH_NOT_POSSIBLE;
|
---|
560 | }
|
---|
561 |
|
---|
562 | /*
|
---|
563 | * Join paths with pdmR3DrvDestroyChain.
|
---|
564 | */
|
---|
565 | pdmR3DrvDestroyChain(pDrvIns, fFlags);
|
---|
566 | return VINF_SUCCESS;
|
---|
567 | }
|
---|
568 |
|
---|
569 |
|
---|
570 | /**
|
---|
571 | * Destroys a driver chain starting with the specified driver.
|
---|
572 | *
|
---|
573 | * This is used when unplugging a device at run time.
|
---|
574 | *
|
---|
575 | * @param pDrvIns Pointer to the driver instance to start with.
|
---|
576 | * @param fFlags PDM_TACH_FLAGS_NOT_HOT_PLUG, PDM_TACH_FLAGS_NO_CALLBACKS
|
---|
577 | * or 0.
|
---|
578 | */
|
---|
579 | void pdmR3DrvDestroyChain(PPDMDRVINS pDrvIns, uint32_t fFlags)
|
---|
580 | {
|
---|
581 | PVM pVM = pDrvIns->Internal.s.pVMR3;
|
---|
582 | VM_ASSERT_EMT(pVM);
|
---|
583 |
|
---|
584 | /*
|
---|
585 | * Detach the bottommost driver until we've detached pDrvIns.
|
---|
586 | */
|
---|
587 | pDrvIns->Internal.s.fDetaching = true;
|
---|
588 | PPDMDRVINS pCur;
|
---|
589 | do
|
---|
590 | {
|
---|
591 | /* find the driver to detach. */
|
---|
592 | pCur = pDrvIns;
|
---|
593 | while (pCur->Internal.s.pDown)
|
---|
594 | pCur = pCur->Internal.s.pDown;
|
---|
595 | LogFlow(("pdmR3DrvDestroyChain: pCur=%p '%s'/%d\n", pCur, pCur->pReg->szName, pCur->iInstance));
|
---|
596 |
|
---|
597 | /*
|
---|
598 | * Unlink it and notify parent.
|
---|
599 | */
|
---|
600 | pCur->Internal.s.fDetaching = true;
|
---|
601 |
|
---|
602 | PPDMLUN pLun = pCur->Internal.s.pLun;
|
---|
603 | Assert(pLun->pBottom == pCur);
|
---|
604 | pLun->pBottom = pCur->Internal.s.pUp;
|
---|
605 |
|
---|
606 | if (pCur->Internal.s.pUp)
|
---|
607 | {
|
---|
608 | /* driver parent */
|
---|
609 | PPDMDRVINS pParent = pCur->Internal.s.pUp;
|
---|
610 | pCur->Internal.s.pUp = NULL;
|
---|
611 | pParent->Internal.s.pDown = NULL;
|
---|
612 |
|
---|
613 | if (!(fFlags & PDM_TACH_FLAGS_NO_CALLBACKS) && pParent->pReg->pfnDetach)
|
---|
614 | pParent->pReg->pfnDetach(pParent, fFlags);
|
---|
615 |
|
---|
616 | pParent->pDownBase = NULL;
|
---|
617 | }
|
---|
618 | else
|
---|
619 | {
|
---|
620 | /* device parent */
|
---|
621 | Assert(pLun->pTop == pCur);
|
---|
622 | pLun->pTop = NULL;
|
---|
623 | if (!(fFlags & PDM_TACH_FLAGS_NO_CALLBACKS) && pLun->pDevIns->pReg->pfnDetach)
|
---|
624 | pLun->pDevIns->pReg->pfnDetach(pLun->pDevIns, pLun->iLun, fFlags);
|
---|
625 | }
|
---|
626 |
|
---|
627 | /*
|
---|
628 | * Call destructor.
|
---|
629 | */
|
---|
630 | pCur->pUpBase = NULL;
|
---|
631 | if (pCur->pReg->pfnDestruct)
|
---|
632 | pCur->pReg->pfnDestruct(pCur);
|
---|
633 | pCur->Internal.s.pDrv->cInstances--;
|
---|
634 |
|
---|
635 | /*
|
---|
636 | * Free all resources allocated by the driver.
|
---|
637 | */
|
---|
638 | /* Queues. */
|
---|
639 | int rc = PDMR3QueueDestroyDriver(pVM, pCur);
|
---|
640 | AssertRC(rc);
|
---|
641 |
|
---|
642 | /* Timers. */
|
---|
643 | rc = TMR3TimerDestroyDriver(pVM, pCur);
|
---|
644 | AssertRC(rc);
|
---|
645 |
|
---|
646 | /* SSM data units. */
|
---|
647 | rc = SSMR3DeregisterDriver(pVM, pCur, NULL, 0);
|
---|
648 | AssertRC(rc);
|
---|
649 |
|
---|
650 | /* PDM threads. */
|
---|
651 | rc = pdmR3ThreadDestroyDriver(pVM, pCur);
|
---|
652 | AssertRC(rc);
|
---|
653 |
|
---|
654 | /* Info handlers. */
|
---|
655 | rc = DBGFR3InfoDeregisterDriver(pVM, pCur, NULL);
|
---|
656 | AssertRC(rc);
|
---|
657 |
|
---|
658 | /* PDM critsects. */
|
---|
659 | rc = pdmR3CritSectDeleteDriver(pVM, pCur);
|
---|
660 | AssertRC(rc);
|
---|
661 |
|
---|
662 | /* Block caches. */
|
---|
663 | PDMR3BlkCacheReleaseDriver(pVM, pCur);
|
---|
664 |
|
---|
665 | /* Finally, the driver it self. */
|
---|
666 | bool fHyperHeap = pCur->Internal.s.fHyperHeap;
|
---|
667 | ASMMemFill32(pCur, RT_OFFSETOF(PDMDRVINS, achInstanceData[pCur->pReg->cbInstance]), 0xdeadd0d0);
|
---|
668 | if (fHyperHeap)
|
---|
669 | MMHyperFree(pVM, pCur);
|
---|
670 | else
|
---|
671 | MMR3HeapFree(pCur);
|
---|
672 |
|
---|
673 | } while (pCur != pDrvIns);
|
---|
674 | }
|
---|
675 |
|
---|
676 |
|
---|
677 |
|
---|
678 |
|
---|
679 | /** @name Driver Helpers
|
---|
680 | * @{
|
---|
681 | */
|
---|
682 |
|
---|
683 | /** @interface_method_impl{PDMDRVHLP,pfnAttach} */
|
---|
684 | static DECLCALLBACK(int) pdmR3DrvHlp_Attach(PPDMDRVINS pDrvIns, uint32_t fFlags, PPDMIBASE *ppBaseInterface)
|
---|
685 | {
|
---|
686 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
687 | PVM pVM = pDrvIns->Internal.s.pVMR3;
|
---|
688 | VM_ASSERT_EMT(pVM);
|
---|
689 | LogFlow(("pdmR3DrvHlp_Attach: caller='%s'/%d: fFlags=%#x\n", pDrvIns->pReg->szName, pDrvIns->iInstance, fFlags));
|
---|
690 | Assert(!(fFlags & ~(PDM_TACH_FLAGS_NOT_HOT_PLUG)));
|
---|
691 |
|
---|
692 | /*
|
---|
693 | * Check that there isn't anything attached already.
|
---|
694 | */
|
---|
695 | int rc;
|
---|
696 | if (!pDrvIns->Internal.s.pDown)
|
---|
697 | {
|
---|
698 | Assert(pDrvIns->Internal.s.pLun->pBottom == pDrvIns);
|
---|
699 |
|
---|
700 | /*
|
---|
701 | * Get the attached driver configuration.
|
---|
702 | */
|
---|
703 | PCFGMNODE pNode = CFGMR3GetChild(pDrvIns->Internal.s.pCfgHandle, "AttachedDriver");
|
---|
704 | if (pNode)
|
---|
705 | rc = pdmR3DrvInstantiate(pVM, pNode, &pDrvIns->IBase, pDrvIns, pDrvIns->Internal.s.pLun, ppBaseInterface);
|
---|
706 | else
|
---|
707 | rc = VERR_PDM_NO_ATTACHED_DRIVER;
|
---|
708 | }
|
---|
709 | else
|
---|
710 | {
|
---|
711 | AssertMsgFailed(("Already got a driver attached. The driver should keep track of such things!\n"));
|
---|
712 | rc = VERR_PDM_DRIVER_ALREADY_ATTACHED;
|
---|
713 | }
|
---|
714 |
|
---|
715 | LogFlow(("pdmR3DrvHlp_Attach: caller='%s'/%d: return %Rrc\n",
|
---|
716 | pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
717 | return rc;
|
---|
718 | }
|
---|
719 |
|
---|
720 |
|
---|
721 | /** @interface_method_impl{PDMDRVHLP,pfnDetach} */
|
---|
722 | static DECLCALLBACK(int) pdmR3DrvHlp_Detach(PPDMDRVINS pDrvIns, uint32_t fFlags)
|
---|
723 | {
|
---|
724 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
725 | LogFlow(("pdmR3DrvHlp_Detach: caller='%s'/%d: fFlags=%#x\n",
|
---|
726 | pDrvIns->pReg->szName, pDrvIns->iInstance, fFlags));
|
---|
727 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
728 |
|
---|
729 | /*
|
---|
730 | * Anything attached?
|
---|
731 | */
|
---|
732 | int rc;
|
---|
733 | if (pDrvIns->Internal.s.pDown)
|
---|
734 | rc = pdmR3DrvDetach(pDrvIns->Internal.s.pDown, fFlags);
|
---|
735 | else
|
---|
736 | {
|
---|
737 | AssertMsgFailed(("Nothing attached!\n"));
|
---|
738 | rc = VERR_PDM_NO_DRIVER_ATTACHED;
|
---|
739 | }
|
---|
740 |
|
---|
741 | LogFlow(("pdmR3DrvHlp_Detach: caller='%s'/%d: returns %Rrc\n",
|
---|
742 | pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
743 | return rc;
|
---|
744 | }
|
---|
745 |
|
---|
746 |
|
---|
747 | /** @interface_method_impl{PDMDRVHLP,pfnDetachSelf} */
|
---|
748 | static DECLCALLBACK(int) pdmR3DrvHlp_DetachSelf(PPDMDRVINS pDrvIns, uint32_t fFlags)
|
---|
749 | {
|
---|
750 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
751 | LogFlow(("pdmR3DrvHlp_DetachSelf: caller='%s'/%d: fFlags=%#x\n",
|
---|
752 | pDrvIns->pReg->szName, pDrvIns->iInstance, fFlags));
|
---|
753 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
754 |
|
---|
755 | int rc = pdmR3DrvDetach(pDrvIns, fFlags);
|
---|
756 |
|
---|
757 | LogFlow(("pdmR3DrvHlp_Detach: returns %Rrc\n", rc)); /* pDrvIns is freed by now. */
|
---|
758 | return rc;
|
---|
759 | }
|
---|
760 |
|
---|
761 |
|
---|
762 | /** @interface_method_impl{PDMDRVHLP,pfnMountPrepare} */
|
---|
763 | static DECLCALLBACK(int) pdmR3DrvHlp_MountPrepare(PPDMDRVINS pDrvIns, const char *pszFilename, const char *pszCoreDriver)
|
---|
764 | {
|
---|
765 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
766 | LogFlow(("pdmR3DrvHlp_MountPrepare: caller='%s'/%d: pszFilename=%p:{%s} pszCoreDriver=%p:{%s}\n",
|
---|
767 | pDrvIns->pReg->szName, pDrvIns->iInstance, pszFilename, pszFilename, pszCoreDriver, pszCoreDriver));
|
---|
768 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
769 |
|
---|
770 | /*
|
---|
771 | * Do the caller have anything attached below itself?
|
---|
772 | */
|
---|
773 | if (pDrvIns->Internal.s.pDown)
|
---|
774 | {
|
---|
775 | AssertMsgFailed(("Cannot prepare a mount when something's attached to you!\n"));
|
---|
776 | return VERR_PDM_DRIVER_ALREADY_ATTACHED;
|
---|
777 | }
|
---|
778 |
|
---|
779 | /*
|
---|
780 | * We're asked to prepare, so we'll start off by nuking the
|
---|
781 | * attached configuration tree.
|
---|
782 | */
|
---|
783 | PCFGMNODE pNode = CFGMR3GetChild(pDrvIns->Internal.s.pCfgHandle, "AttachedDriver");
|
---|
784 | if (pNode)
|
---|
785 | CFGMR3RemoveNode(pNode);
|
---|
786 |
|
---|
787 | /*
|
---|
788 | * If there is no core driver, we'll have to probe for it.
|
---|
789 | */
|
---|
790 | if (!pszCoreDriver)
|
---|
791 | {
|
---|
792 | /** @todo implement image probing. */
|
---|
793 | AssertReleaseMsgFailed(("Not implemented!\n"));
|
---|
794 | return VERR_NOT_IMPLEMENTED;
|
---|
795 | }
|
---|
796 |
|
---|
797 | /*
|
---|
798 | * Construct the basic attached driver configuration.
|
---|
799 | */
|
---|
800 | int rc = CFGMR3InsertNode(pDrvIns->Internal.s.pCfgHandle, "AttachedDriver", &pNode);
|
---|
801 | if (RT_SUCCESS(rc))
|
---|
802 | {
|
---|
803 | rc = CFGMR3InsertString(pNode, "Driver", pszCoreDriver);
|
---|
804 | if (RT_SUCCESS(rc))
|
---|
805 | {
|
---|
806 | PCFGMNODE pCfg;
|
---|
807 | rc = CFGMR3InsertNode(pNode, "Config", &pCfg);
|
---|
808 | if (RT_SUCCESS(rc))
|
---|
809 | {
|
---|
810 | rc = CFGMR3InsertString(pCfg, "Path", pszFilename);
|
---|
811 | if (RT_SUCCESS(rc))
|
---|
812 | {
|
---|
813 | LogFlow(("pdmR3DrvHlp_MountPrepare: caller='%s'/%d: returns %Rrc (Driver=%s)\n",
|
---|
814 | pDrvIns->pReg->szName, pDrvIns->iInstance, rc, pszCoreDriver));
|
---|
815 | return rc;
|
---|
816 | }
|
---|
817 | else
|
---|
818 | AssertMsgFailed(("Path string insert failed, rc=%Rrc\n", rc));
|
---|
819 | }
|
---|
820 | else
|
---|
821 | AssertMsgFailed(("Config node failed, rc=%Rrc\n", rc));
|
---|
822 | }
|
---|
823 | else
|
---|
824 | AssertMsgFailed(("Driver string insert failed, rc=%Rrc\n", rc));
|
---|
825 | CFGMR3RemoveNode(pNode);
|
---|
826 | }
|
---|
827 | else
|
---|
828 | AssertMsgFailed(("AttachedDriver node insert failed, rc=%Rrc\n", rc));
|
---|
829 |
|
---|
830 | LogFlow(("pdmR3DrvHlp_MountPrepare: caller='%s'/%d: returns %Rrc\n",
|
---|
831 | pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
832 | return rc;
|
---|
833 | }
|
---|
834 |
|
---|
835 |
|
---|
836 | /** @interface_method_impl{PDMDRVHLP,pfnAssertEMT} */
|
---|
837 | static DECLCALLBACK(bool) pdmR3DrvHlp_AssertEMT(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction)
|
---|
838 | {
|
---|
839 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
840 | if (VM_IS_EMT(pDrvIns->Internal.s.pVMR3))
|
---|
841 | return true;
|
---|
842 |
|
---|
843 | char szMsg[100];
|
---|
844 | RTStrPrintf(szMsg, sizeof(szMsg), "AssertEMT '%s'/%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance);
|
---|
845 | RTAssertMsg1Weak(szMsg, iLine, pszFile, pszFunction);
|
---|
846 | AssertBreakpoint();
|
---|
847 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
848 | return false;
|
---|
849 | }
|
---|
850 |
|
---|
851 |
|
---|
852 | /** @interface_method_impl{PDMDRVHLP,pfnAssertOther} */
|
---|
853 | static DECLCALLBACK(bool) pdmR3DrvHlp_AssertOther(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction)
|
---|
854 | {
|
---|
855 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
856 | if (!VM_IS_EMT(pDrvIns->Internal.s.pVMR3))
|
---|
857 | return true;
|
---|
858 |
|
---|
859 | char szMsg[100];
|
---|
860 | RTStrPrintf(szMsg, sizeof(szMsg), "AssertOther '%s'/%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance);
|
---|
861 | RTAssertMsg1Weak(szMsg, iLine, pszFile, pszFunction);
|
---|
862 | AssertBreakpoint();
|
---|
863 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
864 | return false;
|
---|
865 | }
|
---|
866 |
|
---|
867 |
|
---|
868 | /** @interface_method_impl{PDMDRVHLP,pfnVMSetError} */
|
---|
869 | static DECLCALLBACK(int) pdmR3DrvHlp_VMSetError(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)
|
---|
870 | {
|
---|
871 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
872 | va_list args;
|
---|
873 | va_start(args, pszFormat);
|
---|
874 | int rc2 = VMSetErrorV(pDrvIns->Internal.s.pVMR3, rc, RT_SRC_POS_ARGS, pszFormat, args); Assert(rc2 == rc); NOREF(rc2);
|
---|
875 | va_end(args);
|
---|
876 | return rc;
|
---|
877 | }
|
---|
878 |
|
---|
879 |
|
---|
880 | /** @interface_method_impl{PDMDRVHLP,pfnVMSetErrorV} */
|
---|
881 | static DECLCALLBACK(int) pdmR3DrvHlp_VMSetErrorV(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)
|
---|
882 | {
|
---|
883 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
884 | int rc2 = VMSetErrorV(pDrvIns->Internal.s.pVMR3, rc, RT_SRC_POS_ARGS, pszFormat, va); Assert(rc2 == rc); NOREF(rc2);
|
---|
885 | return rc;
|
---|
886 | }
|
---|
887 |
|
---|
888 |
|
---|
889 | /** @interface_method_impl{PDMDRVHLP,pfnVMSetRuntimeError} */
|
---|
890 | static DECLCALLBACK(int) pdmR3DrvHlp_VMSetRuntimeError(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...)
|
---|
891 | {
|
---|
892 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
893 | va_list args;
|
---|
894 | va_start(args, pszFormat);
|
---|
895 | int rc = VMSetRuntimeErrorV(pDrvIns->Internal.s.pVMR3, fFlags, pszErrorId, pszFormat, args);
|
---|
896 | va_end(args);
|
---|
897 | return rc;
|
---|
898 | }
|
---|
899 |
|
---|
900 |
|
---|
901 | /** @interface_method_impl{PDMDRVHLP,pfnVMSetRuntimeErrorV} */
|
---|
902 | static DECLCALLBACK(int) pdmR3DrvHlp_VMSetRuntimeErrorV(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va)
|
---|
903 | {
|
---|
904 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
905 | int rc = VMSetRuntimeErrorV(pDrvIns->Internal.s.pVMR3, fFlags, pszErrorId, pszFormat, va);
|
---|
906 | return rc;
|
---|
907 | }
|
---|
908 |
|
---|
909 |
|
---|
910 | /** @interface_method_impl{PDMDEVHLPR3,pfnVMState} */
|
---|
911 | static DECLCALLBACK(VMSTATE) pdmR3DrvHlp_VMState(PPDMDRVINS pDrvIns)
|
---|
912 | {
|
---|
913 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
914 |
|
---|
915 | VMSTATE enmVMState = VMR3GetState(pDrvIns->Internal.s.pVMR3);
|
---|
916 |
|
---|
917 | LogFlow(("pdmR3DrvHlp_VMState: caller='%s'/%d: returns %d (%s)\n", pDrvIns->pReg->szName, pDrvIns->iInstance,
|
---|
918 | enmVMState, VMR3GetStateName(enmVMState)));
|
---|
919 | return enmVMState;
|
---|
920 | }
|
---|
921 |
|
---|
922 |
|
---|
923 | /** @interface_method_impl{PDMDEVHLPR3,pfnVMTeleportedAndNotFullyResumedYet} */
|
---|
924 | static DECLCALLBACK(bool) pdmR3DrvHlp_VMTeleportedAndNotFullyResumedYet(PPDMDRVINS pDrvIns)
|
---|
925 | {
|
---|
926 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
927 |
|
---|
928 | bool fRc = VMR3TeleportedAndNotFullyResumedYet(pDrvIns->Internal.s.pVMR3);
|
---|
929 |
|
---|
930 | LogFlow(("pdmR3DrvHlp_VMState: caller='%s'/%d: returns %RTbool)\n", pDrvIns->pReg->szName, pDrvIns->iInstance,
|
---|
931 | fRc));
|
---|
932 | return fRc;
|
---|
933 | }
|
---|
934 |
|
---|
935 |
|
---|
936 | /** @interface_method_impl{PDMDEVHLPR3,pfnGetSupDrvSession} */
|
---|
937 | static DECLCALLBACK(PSUPDRVSESSION) pdmR3DrvHlp_GetSupDrvSession(PPDMDRVINS pDrvIns)
|
---|
938 | {
|
---|
939 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
940 |
|
---|
941 | PSUPDRVSESSION pSession = pDrvIns->Internal.s.pVMR3->pSession;
|
---|
942 | LogFlow(("pdmR3DrvHlp_GetSupDrvSession: caller='%s'/%d: returns %p)\n", pDrvIns->pReg->szName, pDrvIns->iInstance,
|
---|
943 | pSession));
|
---|
944 | return pSession;
|
---|
945 | }
|
---|
946 |
|
---|
947 |
|
---|
948 | /** @interface_method_impl{PDMDRVHLP,pfnQueueCreate} */
|
---|
949 | static DECLCALLBACK(int) pdmR3DrvHlp_QueueCreate(PPDMDRVINS pDrvIns, uint32_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
|
---|
950 | PFNPDMQUEUEDRV pfnCallback, const char *pszName, PPDMQUEUE *ppQueue)
|
---|
951 | {
|
---|
952 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
953 | LogFlow(("pdmR3DrvHlp_PDMQueueCreate: caller='%s'/%d: cbItem=%d cItems=%d cMilliesInterval=%d pfnCallback=%p pszName=%p:{%s} ppQueue=%p\n",
|
---|
954 | pDrvIns->pReg->szName, pDrvIns->iInstance, cbItem, cItems, cMilliesInterval, pfnCallback, pszName, pszName, ppQueue, ppQueue));
|
---|
955 | PVM pVM = pDrvIns->Internal.s.pVMR3;
|
---|
956 | VM_ASSERT_EMT(pVM);
|
---|
957 |
|
---|
958 | if (pDrvIns->iInstance > 0)
|
---|
959 | {
|
---|
960 | pszName = MMR3HeapAPrintf(pVM, MM_TAG_PDM_DRIVER_DESC, "%s_%u", pszName, pDrvIns->iInstance);
|
---|
961 | AssertLogRelReturn(pszName, VERR_NO_MEMORY);
|
---|
962 | }
|
---|
963 |
|
---|
964 | int rc = PDMR3QueueCreateDriver(pVM, pDrvIns, cbItem, cItems, cMilliesInterval, pfnCallback, pszName, ppQueue);
|
---|
965 |
|
---|
966 | LogFlow(("pdmR3DrvHlp_PDMQueueCreate: caller='%s'/%d: returns %Rrc *ppQueue=%p\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc, *ppQueue));
|
---|
967 | return rc;
|
---|
968 | }
|
---|
969 |
|
---|
970 |
|
---|
971 | /** @interface_method_impl{PDMDRVHLP,pfnTMGetVirtualFreq} */
|
---|
972 | static DECLCALLBACK(uint64_t) pdmR3DrvHlp_TMGetVirtualFreq(PPDMDRVINS pDrvIns)
|
---|
973 | {
|
---|
974 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
975 |
|
---|
976 | return TMVirtualGetFreq(pDrvIns->Internal.s.pVMR3);
|
---|
977 | }
|
---|
978 |
|
---|
979 |
|
---|
980 | /** @interface_method_impl{PDMDRVHLP,pfnTMGetVirtualTime} */
|
---|
981 | static DECLCALLBACK(uint64_t) pdmR3DrvHlp_TMGetVirtualTime(PPDMDRVINS pDrvIns)
|
---|
982 | {
|
---|
983 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
984 |
|
---|
985 | return TMVirtualGet(pDrvIns->Internal.s.pVMR3);
|
---|
986 | }
|
---|
987 |
|
---|
988 |
|
---|
989 | /** @interface_method_impl{PDMDRVHLP,pfnTMTimerCreate} */
|
---|
990 | static DECLCALLBACK(int) pdmR3DrvHlp_TMTimerCreate(PPDMDRVINS pDrvIns, TMCLOCK enmClock, PFNTMTIMERDRV pfnCallback, void *pvUser, uint32_t fFlags, const char *pszDesc, PPTMTIMERR3 ppTimer)
|
---|
991 | {
|
---|
992 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
993 | LogFlow(("pdmR3DrvHlp_TMTimerCreate: caller='%s'/%d: enmClock=%d pfnCallback=%p pvUser=%p fFlags=%#x pszDesc=%p:{%s} ppTimer=%p\n",
|
---|
994 | pDrvIns->pReg->szName, pDrvIns->iInstance, enmClock, pfnCallback, pvUser, fFlags, pszDesc, pszDesc, ppTimer));
|
---|
995 |
|
---|
996 | int rc = TMR3TimerCreateDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, enmClock, pfnCallback, pvUser, fFlags, pszDesc, ppTimer);
|
---|
997 |
|
---|
998 | LogFlow(("pdmR3DrvHlp_TMTimerCreate: caller='%s'/%d: returns %Rrc *ppTimer=%p\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc, *ppTimer));
|
---|
999 | return rc;
|
---|
1000 | }
|
---|
1001 |
|
---|
1002 |
|
---|
1003 |
|
---|
1004 | /** @interface_method_impl{PDMDRVHLP,pfnSSMRegister} */
|
---|
1005 | static DECLCALLBACK(int) pdmR3DrvHlp_SSMRegister(PPDMDRVINS pDrvIns, uint32_t uVersion, size_t cbGuess,
|
---|
1006 | PFNSSMDRVLIVEPREP pfnLivePrep, PFNSSMDRVLIVEEXEC pfnLiveExec, PFNSSMDRVLIVEVOTE pfnLiveVote,
|
---|
1007 | PFNSSMDRVSAVEPREP pfnSavePrep, PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVSAVEDONE pfnSaveDone,
|
---|
1008 | PFNSSMDRVLOADPREP pfnLoadPrep, PFNSSMDRVLOADEXEC pfnLoadExec, PFNSSMDRVLOADDONE pfnLoadDone)
|
---|
1009 | {
|
---|
1010 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1011 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1012 | LogFlow(("pdmR3DrvHlp_SSMRegister: caller='%s'/%d: uVersion=#x cbGuess=%#x \n"
|
---|
1013 | " pfnLivePrep=%p pfnLiveExec=%p pfnLiveVote=%p pfnSavePrep=%p pfnSaveExec=%p pfnSaveDone=%p pszLoadPrep=%p pfnLoadExec=%p pfnLoaddone=%p\n",
|
---|
1014 | pDrvIns->pReg->szName, pDrvIns->iInstance, uVersion, cbGuess,
|
---|
1015 | pfnLivePrep, pfnLiveExec, pfnLiveVote,
|
---|
1016 | pfnSavePrep, pfnSaveExec, pfnSaveDone, pfnLoadPrep, pfnLoadExec, pfnLoadDone));
|
---|
1017 |
|
---|
1018 | int rc = SSMR3RegisterDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, pDrvIns->pReg->szName, pDrvIns->iInstance,
|
---|
1019 | uVersion, cbGuess,
|
---|
1020 | pfnLivePrep, pfnLiveExec, pfnLiveVote,
|
---|
1021 | pfnSavePrep, pfnSaveExec, pfnSaveDone,
|
---|
1022 | pfnLoadPrep, pfnLoadExec, pfnLoadDone);
|
---|
1023 |
|
---|
1024 | LogFlow(("pdmR3DrvHlp_SSMRegister: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
1025 | return rc;
|
---|
1026 | }
|
---|
1027 |
|
---|
1028 |
|
---|
1029 | /** @interface_method_impl{PDMDRVHLP,pfnSSMDeregister} */
|
---|
1030 | static DECLCALLBACK(int) pdmR3DrvHlp_SSMDeregister(PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance)
|
---|
1031 | {
|
---|
1032 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1033 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1034 | LogFlow(("pdmR3DrvHlp_SSMDeregister: caller='%s'/%d: pszName=%p:{%s} u32Instance=%#x\n",
|
---|
1035 | pDrvIns->pReg->szName, pDrvIns->iInstance, pszName, pszName, u32Instance));
|
---|
1036 |
|
---|
1037 | int rc = SSMR3DeregisterDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, pszName, u32Instance);
|
---|
1038 |
|
---|
1039 | LogFlow(("pdmR3DrvHlp_SSMDeregister: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
1040 | return rc;
|
---|
1041 | }
|
---|
1042 |
|
---|
1043 |
|
---|
1044 | /** @interface_method_impl{PDMDEVHLP,pfnDBGFInfoRegister} */
|
---|
1045 | static DECLCALLBACK(int) pdmR3DrvHlp_DBGFInfoRegister(PPDMDRVINS pDrvIns, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDRV pfnHandler)
|
---|
1046 | {
|
---|
1047 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1048 | LogFlow(("pdmR3DrvHlp_DBGFInfoRegister: caller='%s'/%d: pszName=%p:{%s} pszDesc=%p:{%s} pfnHandler=%p\n",
|
---|
1049 | pDrvIns->pReg->szName, pDrvIns->iInstance, pszName, pszName, pszDesc, pszDesc, pfnHandler));
|
---|
1050 |
|
---|
1051 | int rc = DBGFR3InfoRegisterDriver(pDrvIns->Internal.s.pVMR3, pszName, pszDesc, pfnHandler, pDrvIns);
|
---|
1052 |
|
---|
1053 | LogFlow(("pdmR3DrvHlp_DBGFInfoRegister: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
1054 | return rc;
|
---|
1055 | }
|
---|
1056 |
|
---|
1057 |
|
---|
1058 | /** @interface_method_impl{PDMDEVHLP,pfnDBGFInfoDeregister} */
|
---|
1059 | static DECLCALLBACK(int) pdmR3DrvHlp_DBGFInfoDeregister(PPDMDRVINS pDrvIns, const char *pszName)
|
---|
1060 | {
|
---|
1061 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1062 | LogFlow(("pdmR3DrvHlp_DBGFInfoDeregister: caller='%s'/%d: pszName=%p:{%s} pszDesc=%p:{%s} pfnHandler=%p\n",
|
---|
1063 | pDrvIns->pReg->szName, pDrvIns->iInstance, pszName));
|
---|
1064 |
|
---|
1065 | int rc = DBGFR3InfoDeregisterDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, pszName);
|
---|
1066 |
|
---|
1067 | LogFlow(("pdmR3DrvHlp_DBGFInfoDeregister: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
1068 |
|
---|
1069 | return rc;
|
---|
1070 | }
|
---|
1071 |
|
---|
1072 |
|
---|
1073 | /** @interface_method_impl{PDMDRVHLP,pfnSTAMRegister} */
|
---|
1074 | static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegister(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, const char *pszName, STAMUNIT enmUnit, const char *pszDesc)
|
---|
1075 | {
|
---|
1076 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1077 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1078 |
|
---|
1079 | STAM_REG(pDrvIns->Internal.s.pVMR3, pvSample, enmType, pszName, enmUnit, pszDesc);
|
---|
1080 | /** @todo track the samples so they can be dumped & deregistered when the driver instance is destroyed.
|
---|
1081 | * For now we just have to be careful not to use this call for drivers which can be unloaded. */
|
---|
1082 | }
|
---|
1083 |
|
---|
1084 |
|
---|
1085 | /** @interface_method_impl{PDMDRVHLP,pfnSTAMRegisterF} */
|
---|
1086 | static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegisterF(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
|
---|
1087 | STAMUNIT enmUnit, const char *pszDesc, const char *pszName, ...)
|
---|
1088 | {
|
---|
1089 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1090 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1091 |
|
---|
1092 | va_list args;
|
---|
1093 | va_start(args, pszName);
|
---|
1094 | int rc = STAMR3RegisterV(pDrvIns->Internal.s.pVMR3, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, args);
|
---|
1095 | va_end(args);
|
---|
1096 | AssertRC(rc);
|
---|
1097 | }
|
---|
1098 |
|
---|
1099 |
|
---|
1100 | /** @interface_method_impl{PDMDRVHLP,pfnSTAMRegisterV} */
|
---|
1101 | static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegisterV(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
|
---|
1102 | STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list args)
|
---|
1103 | {
|
---|
1104 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1105 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1106 |
|
---|
1107 | int rc = STAMR3RegisterV(pDrvIns->Internal.s.pVMR3, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, args);
|
---|
1108 | AssertRC(rc);
|
---|
1109 | }
|
---|
1110 |
|
---|
1111 |
|
---|
1112 | /** @interface_method_impl{PDMDRVHLP,pfnSTAMDeregister} */
|
---|
1113 | static DECLCALLBACK(int) pdmR3DrvHlp_STAMDeregister(PPDMDRVINS pDrvIns, void *pvSample)
|
---|
1114 | {
|
---|
1115 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1116 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1117 |
|
---|
1118 | int rc = STAMR3DeregisterU(pDrvIns->Internal.s.pVMR3->pUVM, pvSample);
|
---|
1119 | AssertRC(rc);
|
---|
1120 | return rc;
|
---|
1121 | }
|
---|
1122 |
|
---|
1123 |
|
---|
1124 | /** @interface_method_impl{PDMDRVHLP,pfnSUPCallVMMR0Ex} */
|
---|
1125 | static DECLCALLBACK(int) pdmR3DrvHlp_SUPCallVMMR0Ex(PPDMDRVINS pDrvIns, unsigned uOperation, void *pvArg, unsigned cbArg)
|
---|
1126 | {
|
---|
1127 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1128 | LogFlow(("pdmR3DrvHlp_SSMCallVMMR0Ex: caller='%s'/%d: uOperation=%u pvArg=%p cbArg=%d\n",
|
---|
1129 | pDrvIns->pReg->szName, pDrvIns->iInstance, uOperation, pvArg, cbArg));
|
---|
1130 | int rc;
|
---|
1131 | if ( uOperation >= VMMR0_DO_SRV_START
|
---|
1132 | && uOperation < VMMR0_DO_SRV_END)
|
---|
1133 | rc = SUPR3CallVMMR0Ex(pDrvIns->Internal.s.pVMR3->pVMR0, NIL_VMCPUID, uOperation, 0, (PSUPVMMR0REQHDR)pvArg);
|
---|
1134 | else
|
---|
1135 | {
|
---|
1136 | AssertMsgFailed(("Invalid uOperation=%u\n", uOperation));
|
---|
1137 | rc = VERR_INVALID_PARAMETER;
|
---|
1138 | }
|
---|
1139 |
|
---|
1140 | LogFlow(("pdmR3DrvHlp_SUPCallVMMR0Ex: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
1141 | return rc;
|
---|
1142 | }
|
---|
1143 |
|
---|
1144 |
|
---|
1145 | /** @interface_method_impl{PDMDRVHLP,pfnUSBRegisterHub} */
|
---|
1146 | static DECLCALLBACK(int) pdmR3DrvHlp_USBRegisterHub(PPDMDRVINS pDrvIns, uint32_t fVersions, uint32_t cPorts, PCPDMUSBHUBREG pUsbHubReg, PPCPDMUSBHUBHLP ppUsbHubHlp)
|
---|
1147 | {
|
---|
1148 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1149 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1150 | LogFlow(("pdmR3DrvHlp_USBRegisterHub: caller='%s'/%d: fVersions=%#x cPorts=%#x pUsbHubReg=%p ppUsbHubHlp=%p\n",
|
---|
1151 | pDrvIns->pReg->szName, pDrvIns->iInstance, fVersions, cPorts, pUsbHubReg, ppUsbHubHlp));
|
---|
1152 |
|
---|
1153 | #ifdef VBOX_WITH_USB
|
---|
1154 | int rc = pdmR3UsbRegisterHub(pDrvIns->Internal.s.pVMR3, pDrvIns, fVersions, cPorts, pUsbHubReg, ppUsbHubHlp);
|
---|
1155 | #else
|
---|
1156 | int rc = VERR_NOT_SUPPORTED;
|
---|
1157 | #endif
|
---|
1158 |
|
---|
1159 | LogFlow(("pdmR3DrvHlp_USBRegisterHub: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
1160 | return rc;
|
---|
1161 | }
|
---|
1162 |
|
---|
1163 |
|
---|
1164 | /** @interface_method_impl{PDMDRVHLP,pfnSetAsyncNotification} */
|
---|
1165 | static DECLCALLBACK(int) pdmR3DrvHlp_SetAsyncNotification(PPDMDRVINS pDrvIns, PFNPDMDRVASYNCNOTIFY pfnAsyncNotify)
|
---|
1166 | {
|
---|
1167 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1168 | VM_ASSERT_EMT0(pDrvIns->Internal.s.pVMR3);
|
---|
1169 | LogFlow(("pdmR3DrvHlp_SetAsyncNotification: caller='%s'/%d: pfnAsyncNotify=%p\n", pDrvIns->pReg->szName, pDrvIns->iInstance, pfnAsyncNotify));
|
---|
1170 |
|
---|
1171 | int rc = VINF_SUCCESS;
|
---|
1172 | AssertStmt(pfnAsyncNotify, rc = VERR_INVALID_PARAMETER);
|
---|
1173 | AssertStmt(!pDrvIns->Internal.s.pfnAsyncNotify, rc = VERR_WRONG_ORDER);
|
---|
1174 | AssertStmt(pDrvIns->Internal.s.fVMSuspended || pDrvIns->Internal.s.fVMReset, rc = VERR_WRONG_ORDER);
|
---|
1175 | VMSTATE enmVMState = VMR3GetState(pDrvIns->Internal.s.pVMR3);
|
---|
1176 | AssertStmt( enmVMState == VMSTATE_SUSPENDING
|
---|
1177 | || enmVMState == VMSTATE_SUSPENDING_EXT_LS
|
---|
1178 | || enmVMState == VMSTATE_SUSPENDING_LS
|
---|
1179 | || enmVMState == VMSTATE_RESETTING
|
---|
1180 | || enmVMState == VMSTATE_RESETTING_LS
|
---|
1181 | || enmVMState == VMSTATE_POWERING_OFF
|
---|
1182 | || enmVMState == VMSTATE_POWERING_OFF_LS,
|
---|
1183 | rc = VERR_INVALID_STATE);
|
---|
1184 |
|
---|
1185 | if (RT_SUCCESS(rc))
|
---|
1186 | pDrvIns->Internal.s.pfnAsyncNotify = pfnAsyncNotify;
|
---|
1187 |
|
---|
1188 | LogFlow(("pdmR3DrvHlp_SetAsyncNotification: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName, pDrvIns->iInstance, rc));
|
---|
1189 | return rc;
|
---|
1190 | }
|
---|
1191 |
|
---|
1192 |
|
---|
1193 | /** @interface_method_impl{PDMDRVHLP,pfnAsyncNotificationCompleted} */
|
---|
1194 | static DECLCALLBACK(void) pdmR3DrvHlp_AsyncNotificationCompleted(PPDMDRVINS pDrvIns)
|
---|
1195 | {
|
---|
1196 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1197 | PVM pVM = pDrvIns->Internal.s.pVMR3;
|
---|
1198 |
|
---|
1199 | VMSTATE enmVMState = VMR3GetState(pVM);
|
---|
1200 | if ( enmVMState == VMSTATE_SUSPENDING
|
---|
1201 | || enmVMState == VMSTATE_SUSPENDING_EXT_LS
|
---|
1202 | || enmVMState == VMSTATE_SUSPENDING_LS
|
---|
1203 | || enmVMState == VMSTATE_RESETTING
|
---|
1204 | || enmVMState == VMSTATE_RESETTING_LS
|
---|
1205 | || enmVMState == VMSTATE_POWERING_OFF
|
---|
1206 | || enmVMState == VMSTATE_POWERING_OFF_LS)
|
---|
1207 | {
|
---|
1208 | LogFlow(("pdmR3DrvHlp_AsyncNotificationCompleted: caller='%s'/%d:\n", pDrvIns->pReg->szName, pDrvIns->iInstance));
|
---|
1209 | VMR3AsyncPdmNotificationWakeupU(pVM->pUVM);
|
---|
1210 | }
|
---|
1211 | else
|
---|
1212 | LogFlow(("pdmR3DrvHlp_AsyncNotificationCompleted: caller='%s'/%d: enmVMState=%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance, enmVMState));
|
---|
1213 | }
|
---|
1214 |
|
---|
1215 |
|
---|
1216 | /** @interface_method_impl{PDMDRVHLP,pfnThreadCreate} */
|
---|
1217 | static DECLCALLBACK(int) pdmR3DrvHlp_ThreadCreate(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
|
---|
1218 | PFNPDMTHREADWAKEUPDRV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)
|
---|
1219 | {
|
---|
1220 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1221 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1222 | LogFlow(("pdmR3DrvHlp_ThreadCreate: caller='%s'/%d: ppThread=%p pvUser=%p pfnThread=%p pfnWakeup=%p cbStack=%#zx enmType=%d pszName=%p:{%s}\n",
|
---|
1223 | pDrvIns->pReg->szName, pDrvIns->iInstance, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName, pszName));
|
---|
1224 |
|
---|
1225 | int rc = pdmR3ThreadCreateDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
|
---|
1226 |
|
---|
1227 | LogFlow(("pdmR3DrvHlp_ThreadCreate: caller='%s'/%d: returns %Rrc *ppThread=%RTthrd\n", pDrvIns->pReg->szName, pDrvIns->iInstance,
|
---|
1228 | rc, *ppThread));
|
---|
1229 | return rc;
|
---|
1230 | }
|
---|
1231 |
|
---|
1232 |
|
---|
1233 | /** @interface_method_impl{PDMDRVHLP,pfnAsyncCompletionTemplateCreate} */
|
---|
1234 | static DECLCALLBACK(int) pdmR3DrvHlp_AsyncCompletionTemplateCreate(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate,
|
---|
1235 | PFNPDMASYNCCOMPLETEDRV pfnCompleted, void *pvTemplateUser,
|
---|
1236 | const char *pszDesc)
|
---|
1237 | {
|
---|
1238 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1239 | LogFlow(("pdmR3DrvHlp_AsyncCompletionTemplateCreate: caller='%s'/%d: ppTemplate=%p pfnCompleted=%p pszDesc=%p:{%s}\n",
|
---|
1240 | pDrvIns->pReg->szName, pDrvIns->iInstance, ppTemplate, pfnCompleted, pszDesc, pszDesc));
|
---|
1241 |
|
---|
1242 | int rc = PDMR3AsyncCompletionTemplateCreateDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, ppTemplate, pfnCompleted, pvTemplateUser, pszDesc);
|
---|
1243 |
|
---|
1244 | LogFlow(("pdmR3DrvHlp_AsyncCompletionTemplateCreate: caller='%s'/%d: returns %Rrc *ppThread=%p\n", pDrvIns->pReg->szName,
|
---|
1245 | pDrvIns->iInstance, rc, *ppTemplate));
|
---|
1246 | return rc;
|
---|
1247 | }
|
---|
1248 |
|
---|
1249 |
|
---|
1250 | /** @interface_method_impl{PDMDRVHLP,pfnLdrGetRCInterfaceSymbols} */
|
---|
1251 | static DECLCALLBACK(int) pdmR3DrvHlp_LdrGetRCInterfaceSymbols(PPDMDRVINS pDrvIns, void *pvInterface, size_t cbInterface,
|
---|
1252 | const char *pszSymPrefix, const char *pszSymList)
|
---|
1253 | {
|
---|
1254 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1255 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1256 | LogFlow(("pdmR3DrvHlp_LdrGetRCInterfaceSymbols: caller='%s'/%d: pvInterface=%p cbInterface=%zu pszSymPrefix=%p:{%s} pszSymList=%p:{%s}\n",
|
---|
1257 | pDrvIns->pReg->szName, pDrvIns->iInstance, pvInterface, cbInterface, pszSymPrefix, pszSymPrefix, pszSymList, pszSymList));
|
---|
1258 |
|
---|
1259 | int rc;
|
---|
1260 | if ( strncmp(pszSymPrefix, "drv", 3) == 0
|
---|
1261 | && RTStrIStr(pszSymPrefix + 3, pDrvIns->pReg->szName) != NULL)
|
---|
1262 | {
|
---|
1263 | if (pDrvIns->pReg->fFlags & PDM_DRVREG_FLAGS_RC)
|
---|
1264 | rc = PDMR3LdrGetInterfaceSymbols(pDrvIns->Internal.s.pVMR3, pvInterface, cbInterface,
|
---|
1265 | pDrvIns->pReg->szRCMod, pszSymPrefix, pszSymList,
|
---|
1266 | false /*fRing0OrRC*/);
|
---|
1267 | else
|
---|
1268 | {
|
---|
1269 | AssertMsgFailed(("Not a raw-mode enabled driver\n"));
|
---|
1270 | rc = VERR_PERMISSION_DENIED;
|
---|
1271 | }
|
---|
1272 | }
|
---|
1273 | else
|
---|
1274 | {
|
---|
1275 | AssertMsgFailed(("Invalid prefix '%s' for '%s'; must start with 'drv' and contain the driver name!\n",
|
---|
1276 | pszSymPrefix, pDrvIns->pReg->szName));
|
---|
1277 | rc = VERR_INVALID_NAME;
|
---|
1278 | }
|
---|
1279 |
|
---|
1280 | LogFlow(("pdmR3DrvHlp_LdrGetRCInterfaceSymbols: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName,
|
---|
1281 | pDrvIns->iInstance, rc));
|
---|
1282 | return rc;
|
---|
1283 | }
|
---|
1284 |
|
---|
1285 |
|
---|
1286 | /** @interface_method_impl{PDMDRVHLP,pfnLdrGetR0InterfaceSymbols} */
|
---|
1287 | static DECLCALLBACK(int) pdmR3DrvHlp_LdrGetR0InterfaceSymbols(PPDMDRVINS pDrvIns, void *pvInterface, size_t cbInterface,
|
---|
1288 | const char *pszSymPrefix, const char *pszSymList)
|
---|
1289 | {
|
---|
1290 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1291 | VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
|
---|
1292 | LogFlow(("pdmR3DrvHlp_LdrGetR0InterfaceSymbols: caller='%s'/%d: pvInterface=%p cbInterface=%zu pszSymPrefix=%p:{%s} pszSymList=%p:{%s}\n",
|
---|
1293 | pDrvIns->pReg->szName, pDrvIns->iInstance, pvInterface, cbInterface, pszSymPrefix, pszSymPrefix, pszSymList, pszSymList));
|
---|
1294 |
|
---|
1295 | int rc;
|
---|
1296 | if ( strncmp(pszSymPrefix, "drv", 3) == 0
|
---|
1297 | && RTStrIStr(pszSymPrefix + 3, pDrvIns->pReg->szName) != NULL)
|
---|
1298 | {
|
---|
1299 | if (pDrvIns->pReg->fFlags & PDM_DRVREG_FLAGS_R0)
|
---|
1300 | rc = PDMR3LdrGetInterfaceSymbols(pDrvIns->Internal.s.pVMR3, pvInterface, cbInterface,
|
---|
1301 | pDrvIns->pReg->szR0Mod, pszSymPrefix, pszSymList,
|
---|
1302 | true /*fRing0OrRC*/);
|
---|
1303 | else
|
---|
1304 | {
|
---|
1305 | AssertMsgFailed(("Not a ring-0 enabled driver\n"));
|
---|
1306 | rc = VERR_PERMISSION_DENIED;
|
---|
1307 | }
|
---|
1308 | }
|
---|
1309 | else
|
---|
1310 | {
|
---|
1311 | AssertMsgFailed(("Invalid prefix '%s' for '%s'; must start with 'drv' and contain the driver name!\n",
|
---|
1312 | pszSymPrefix, pDrvIns->pReg->szName));
|
---|
1313 | rc = VERR_INVALID_NAME;
|
---|
1314 | }
|
---|
1315 |
|
---|
1316 | LogFlow(("pdmR3DrvHlp_LdrGetR0InterfaceSymbols: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName,
|
---|
1317 | pDrvIns->iInstance, rc));
|
---|
1318 | return rc;
|
---|
1319 | }
|
---|
1320 |
|
---|
1321 |
|
---|
1322 | /** @interface_method_impl{PDMDRVHLP,pfnCritSectInit} */
|
---|
1323 | static DECLCALLBACK(int) pdmR3DrvHlp_CritSectInit(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect,
|
---|
1324 | RT_SRC_POS_DECL, const char *pszName)
|
---|
1325 | {
|
---|
1326 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1327 | PVM pVM = pDrvIns->Internal.s.pVMR3;
|
---|
1328 | VM_ASSERT_EMT(pVM);
|
---|
1329 | LogFlow(("pdmR3DrvHlp_CritSectInit: caller='%s'/%d: pCritSect=%p pszName=%s\n",
|
---|
1330 | pDrvIns->pReg->szName, pDrvIns->iInstance, pCritSect, pszName));
|
---|
1331 |
|
---|
1332 | int rc = pdmR3CritSectInitDriver(pVM, pDrvIns, pCritSect, RT_SRC_POS_ARGS, "%s_%u", pszName, pDrvIns->iInstance);
|
---|
1333 |
|
---|
1334 | LogFlow(("pdmR3DrvHlp_CritSectInit: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName,
|
---|
1335 | pDrvIns->iInstance, rc));
|
---|
1336 | return rc;
|
---|
1337 | }
|
---|
1338 |
|
---|
1339 |
|
---|
1340 | /** @interface_method_impl{PDMDRVHLP,pfnCallR0} */
|
---|
1341 | static DECLCALLBACK(int) pdmR3DrvHlp_CallR0(PPDMDRVINS pDrvIns, uint32_t uOperation, uint64_t u64Arg)
|
---|
1342 | {
|
---|
1343 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1344 | PVM pVM = pDrvIns->Internal.s.pVMR3;
|
---|
1345 | LogFlow(("pdmR3DrvHlp_CallR0: caller='%s'/%d: uOperation=%#x u64Arg=%#RX64\n",
|
---|
1346 | pDrvIns->pReg->szName, pDrvIns->iInstance, uOperation, u64Arg));
|
---|
1347 |
|
---|
1348 | /*
|
---|
1349 | * Lazy resolve the ring-0 entry point.
|
---|
1350 | */
|
---|
1351 | int rc = VINF_SUCCESS;
|
---|
1352 | PFNPDMDRVREQHANDLERR0 pfnReqHandlerR0 = pDrvIns->Internal.s.pfnReqHandlerR0;
|
---|
1353 | if (RT_UNLIKELY(pfnReqHandlerR0 == NIL_RTR0PTR))
|
---|
1354 | {
|
---|
1355 | if (pDrvIns->pReg->fFlags & PDM_DRVREG_FLAGS_R0)
|
---|
1356 | {
|
---|
1357 | char szSymbol[ sizeof("drvR0") + sizeof(pDrvIns->pReg->szName) + sizeof("ReqHandler")];
|
---|
1358 | strcat(strcat(strcpy(szSymbol, "drvR0"), pDrvIns->pReg->szName), "ReqHandler");
|
---|
1359 | szSymbol[sizeof("drvR0") - 1] = RT_C_TO_UPPER(szSymbol[sizeof("drvR0") - 1]);
|
---|
1360 |
|
---|
1361 | rc = PDMR3LdrGetSymbolR0Lazy(pVM, pDrvIns->pReg->szR0Mod, szSymbol, &pfnReqHandlerR0);
|
---|
1362 | if (RT_SUCCESS(rc))
|
---|
1363 | pDrvIns->Internal.s.pfnReqHandlerR0 = pfnReqHandlerR0;
|
---|
1364 | else
|
---|
1365 | pfnReqHandlerR0 = NIL_RTR0PTR;
|
---|
1366 | }
|
---|
1367 | else
|
---|
1368 | rc = VERR_ACCESS_DENIED;
|
---|
1369 | }
|
---|
1370 | if (RT_LIKELY(pfnReqHandlerR0 != NIL_RTR0PTR))
|
---|
1371 | {
|
---|
1372 | /*
|
---|
1373 | * Make the ring-0 call.
|
---|
1374 | */
|
---|
1375 | PDMDRIVERCALLREQHANDLERREQ Req;
|
---|
1376 | Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
|
---|
1377 | Req.Hdr.cbReq = sizeof(Req);
|
---|
1378 | Req.pDrvInsR0 = PDMDRVINS_2_R0PTR(pDrvIns);
|
---|
1379 | Req.uOperation = uOperation;
|
---|
1380 | Req.u32Alignment = 0;
|
---|
1381 | Req.u64Arg = u64Arg;
|
---|
1382 | rc = SUPR3CallVMMR0Ex(pVM->pVMR0, NIL_VMCPUID, VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER, 0, &Req.Hdr);
|
---|
1383 | }
|
---|
1384 |
|
---|
1385 | LogFlow(("pdmR3DrvHlp_CallR0: caller='%s'/%d: returns %Rrc\n", pDrvIns->pReg->szName,
|
---|
1386 | pDrvIns->iInstance, rc));
|
---|
1387 | return rc;
|
---|
1388 | }
|
---|
1389 |
|
---|
1390 |
|
---|
1391 | /** @interface_method_impl{PDMDRVHLP,pfnFTSetCheckpoint} */
|
---|
1392 | static DECLCALLBACK(int) pdmR3DrvHlp_FTSetCheckpoint(PPDMDRVINS pDrvIns, FTMCHECKPOINTTYPE enmType)
|
---|
1393 | {
|
---|
1394 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1395 | return FTMSetCheckpoint(pDrvIns->Internal.s.pVMR3, enmType);
|
---|
1396 | }
|
---|
1397 |
|
---|
1398 |
|
---|
1399 | /** @interface_method_impl{PDMDRVHLP,pfnBlkCacheRetain} */
|
---|
1400 | static DECLCALLBACK(int) pdmR3DrvHlp_BlkCacheRetain(PPDMDRVINS pDrvIns, PPPDMBLKCACHE ppBlkCache,
|
---|
1401 | PFNPDMBLKCACHEXFERCOMPLETEDRV pfnXferComplete,
|
---|
1402 | PFNPDMBLKCACHEXFERENQUEUEDRV pfnXferEnqueue,
|
---|
1403 | const char *pcszId)
|
---|
1404 | {
|
---|
1405 | PDMDRV_ASSERT_DRVINS(pDrvIns);
|
---|
1406 | return PDMR3BlkCacheRetainDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, ppBlkCache,
|
---|
1407 | pfnXferComplete, pfnXferEnqueue, pcszId);
|
---|
1408 | }
|
---|
1409 |
|
---|
1410 |
|
---|
1411 | /**
|
---|
1412 | * The driver helper structure.
|
---|
1413 | */
|
---|
1414 | const PDMDRVHLPR3 g_pdmR3DrvHlp =
|
---|
1415 | {
|
---|
1416 | PDM_DRVHLPR3_VERSION,
|
---|
1417 | pdmR3DrvHlp_Attach,
|
---|
1418 | pdmR3DrvHlp_Detach,
|
---|
1419 | pdmR3DrvHlp_DetachSelf,
|
---|
1420 | pdmR3DrvHlp_MountPrepare,
|
---|
1421 | pdmR3DrvHlp_AssertEMT,
|
---|
1422 | pdmR3DrvHlp_AssertOther,
|
---|
1423 | pdmR3DrvHlp_VMSetError,
|
---|
1424 | pdmR3DrvHlp_VMSetErrorV,
|
---|
1425 | pdmR3DrvHlp_VMSetRuntimeError,
|
---|
1426 | pdmR3DrvHlp_VMSetRuntimeErrorV,
|
---|
1427 | pdmR3DrvHlp_VMState,
|
---|
1428 | pdmR3DrvHlp_VMTeleportedAndNotFullyResumedYet,
|
---|
1429 | pdmR3DrvHlp_GetSupDrvSession,
|
---|
1430 | pdmR3DrvHlp_QueueCreate,
|
---|
1431 | pdmR3DrvHlp_TMGetVirtualFreq,
|
---|
1432 | pdmR3DrvHlp_TMGetVirtualTime,
|
---|
1433 | pdmR3DrvHlp_TMTimerCreate,
|
---|
1434 | pdmR3DrvHlp_SSMRegister,
|
---|
1435 | pdmR3DrvHlp_SSMDeregister,
|
---|
1436 | pdmR3DrvHlp_DBGFInfoRegister,
|
---|
1437 | pdmR3DrvHlp_DBGFInfoDeregister,
|
---|
1438 | pdmR3DrvHlp_STAMRegister,
|
---|
1439 | pdmR3DrvHlp_STAMRegisterF,
|
---|
1440 | pdmR3DrvHlp_STAMRegisterV,
|
---|
1441 | pdmR3DrvHlp_STAMDeregister,
|
---|
1442 | pdmR3DrvHlp_SUPCallVMMR0Ex,
|
---|
1443 | pdmR3DrvHlp_USBRegisterHub,
|
---|
1444 | pdmR3DrvHlp_SetAsyncNotification,
|
---|
1445 | pdmR3DrvHlp_AsyncNotificationCompleted,
|
---|
1446 | pdmR3DrvHlp_ThreadCreate,
|
---|
1447 | pdmR3DrvHlp_AsyncCompletionTemplateCreate,
|
---|
1448 | pdmR3DrvHlp_LdrGetRCInterfaceSymbols,
|
---|
1449 | pdmR3DrvHlp_LdrGetR0InterfaceSymbols,
|
---|
1450 | pdmR3DrvHlp_CritSectInit,
|
---|
1451 | pdmR3DrvHlp_CallR0,
|
---|
1452 | pdmR3DrvHlp_FTSetCheckpoint,
|
---|
1453 | pdmR3DrvHlp_BlkCacheRetain,
|
---|
1454 | PDM_DRVHLPR3_VERSION /* u32TheEnd */
|
---|
1455 | };
|
---|
1456 |
|
---|
1457 | /** @} */
|
---|