1 | /* $Id: tstDevicePdmDevHlp.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * tstDevice - Test framework for PDM devices/drivers, PDM helper implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2017-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 |
|
---|
29 | /*********************************************************************************************************************************
|
---|
30 | * Header Files *
|
---|
31 | *********************************************************************************************************************************/
|
---|
32 | #define LOG_GROUP LOG_GROUP_DEFAULT /** @todo */
|
---|
33 | #include <VBox/types.h>
|
---|
34 | #include <VBox/version.h>
|
---|
35 | #include <VBox/vmm/pdmpci.h>
|
---|
36 |
|
---|
37 | #include <iprt/assert.h>
|
---|
38 | #include <iprt/mem.h>
|
---|
39 | #include <iprt/rand.h>
|
---|
40 |
|
---|
41 | #include "tstDeviceInternal.h"
|
---|
42 |
|
---|
43 |
|
---|
44 | /*********************************************************************************************************************************
|
---|
45 | * Defined Constants And Macros *
|
---|
46 | *********************************************************************************************************************************/
|
---|
47 |
|
---|
48 | /* Temporarily until the stubs got implemented. */
|
---|
49 | #define VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS 1
|
---|
50 |
|
---|
51 | /** @def PDMDEV_ASSERT_DEVINS
|
---|
52 | * Asserts the validity of the device instance.
|
---|
53 | */
|
---|
54 | #ifdef VBOX_STRICT
|
---|
55 | # define PDMDEV_ASSERT_DEVINS(pDevIns) \
|
---|
56 | do { \
|
---|
57 | AssertPtr(pDevIns); \
|
---|
58 | Assert(pDevIns->u32Version == PDM_DEVINS_VERSION); \
|
---|
59 | Assert(pDevIns->CTX_SUFF(pvInstanceDataFor) == (void *)&pDevIns->achInstanceData[0]); \
|
---|
60 | } while (0)
|
---|
61 | #else
|
---|
62 | # define PDMDEV_ASSERT_DEVINS(pDevIns) do { } while (0)
|
---|
63 | #endif
|
---|
64 |
|
---|
65 |
|
---|
66 | /** Frequency of the real clock. */
|
---|
67 | #define TMCLOCK_FREQ_REAL UINT32_C(1000)
|
---|
68 | /** Frequency of the virtual clock. */
|
---|
69 | #define TMCLOCK_FREQ_VIRTUAL UINT32_C(1000000000)
|
---|
70 |
|
---|
71 |
|
---|
72 | /** Start structure magic. (Isaac Asimov) */
|
---|
73 | #define SSMR3STRUCT_BEGIN UINT32_C(0x19200102)
|
---|
74 | /** End structure magic. (Isaac Asimov) */
|
---|
75 | #define SSMR3STRUCT_END UINT32_C(0x19920406)
|
---|
76 |
|
---|
77 |
|
---|
78 | /*********************************************************************************************************************************
|
---|
79 | * Structures and Typedefs *
|
---|
80 | *********************************************************************************************************************************/
|
---|
81 |
|
---|
82 |
|
---|
83 |
|
---|
84 | /*********************************************************************************************************************************
|
---|
85 | * Global Variables *
|
---|
86 | *********************************************************************************************************************************/
|
---|
87 |
|
---|
88 |
|
---|
89 |
|
---|
90 | /*********************************************************************************************************************************
|
---|
91 | * Internal Functions *
|
---|
92 | *********************************************************************************************************************************/
|
---|
93 |
|
---|
94 |
|
---|
95 | /**
|
---|
96 | * Resolves a path reference to a configuration item.
|
---|
97 | *
|
---|
98 | * @returns VBox status code.
|
---|
99 | * @param paDevCfg The array of config items.
|
---|
100 | * @param cCfgItems Number of config items in the array.
|
---|
101 | * @param pszName Name of a byte string value.
|
---|
102 | * @param ppItem Where to store the pointer to the item.
|
---|
103 | */
|
---|
104 | static int tstDev_CfgmR3ResolveItem(PCTSTDEVCFGITEM paDevCfg, uint32_t cCfgItems, const char *pszName, PCTSTDEVCFGITEM *ppItem)
|
---|
105 | {
|
---|
106 | *ppItem = NULL;
|
---|
107 | if (!paDevCfg)
|
---|
108 | return VERR_CFGM_VALUE_NOT_FOUND;
|
---|
109 |
|
---|
110 | size_t cchName = strlen(pszName);
|
---|
111 | PCTSTDEVCFGITEM pDevCfgItem = paDevCfg;
|
---|
112 |
|
---|
113 | for (uint32_t i = 0; i < cCfgItems; i++)
|
---|
114 | {
|
---|
115 | size_t cchKey = strlen(pDevCfgItem->pszKey);
|
---|
116 | if (cchName == cchKey)
|
---|
117 | {
|
---|
118 | int iDiff = memcmp(pszName, pDevCfgItem->pszKey, cchName);
|
---|
119 | if (iDiff <= 0)
|
---|
120 | {
|
---|
121 | if (iDiff != 0)
|
---|
122 | break;
|
---|
123 | *ppItem = pDevCfgItem;
|
---|
124 | return VINF_SUCCESS;
|
---|
125 | }
|
---|
126 | }
|
---|
127 |
|
---|
128 | /* next */
|
---|
129 | pDevCfgItem++;
|
---|
130 | }
|
---|
131 | return VERR_CFGM_VALUE_NOT_FOUND;
|
---|
132 | }
|
---|
133 |
|
---|
134 |
|
---|
135 | /** @interface_method_impl{PDMDEVHLPR3,pfnIoPortCreateEx} */
|
---|
136 | static DECLCALLBACK(int) pdmR3DevHlp_IoPortCreateEx(PPDMDEVINS pDevIns, RTIOPORT cPorts, uint32_t fFlags, PPDMPCIDEV pPciDev,
|
---|
137 | uint32_t iPciRegion, PFNIOMIOPORTNEWOUT pfnOut, PFNIOMIOPORTNEWIN pfnIn,
|
---|
138 | PFNIOMIOPORTNEWOUTSTRING pfnOutStr, PFNIOMIOPORTNEWINSTRING pfnInStr, RTR3PTR pvUser,
|
---|
139 | const char *pszDesc, PCIOMIOPORTDESC paExtDescs, PIOMIOPORTHANDLE phIoPorts)
|
---|
140 | {
|
---|
141 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
142 | LogFlow(("pdmR3DevHlp_IoPortCreateEx: caller='%s'/%d: cPorts=%#x fFlags=%#x pPciDev=%p iPciRegion=%#x pfnOut=%p pfnIn=%p pfnOutStr=%p pfnInStr=%p pvUser=%p pszDesc=%p:{%s} paExtDescs=%p phIoPorts=%p\n",
|
---|
143 | pDevIns->pReg->szName, pDevIns->iInstance, cPorts, fFlags, pPciDev, iPciRegion, pfnOut, pfnIn, pfnOutStr, pfnInStr,
|
---|
144 | pvUser, pszDesc, pszDesc, paExtDescs, phIoPorts));
|
---|
145 |
|
---|
146 | /** @todo Verify there is no overlapping. */
|
---|
147 |
|
---|
148 | RT_NOREF(pszDesc);
|
---|
149 | int rc = VINF_SUCCESS;
|
---|
150 | PRTDEVDUTIOPORT pIoPort = (PRTDEVDUTIOPORT)RTMemAllocZ(sizeof(RTDEVDUTIOPORT));
|
---|
151 | if (RT_LIKELY(pIoPort))
|
---|
152 | {
|
---|
153 | pIoPort->cPorts = cPorts;
|
---|
154 | pIoPort->pvUserR3 = pvUser;
|
---|
155 | pIoPort->pfnOutR3 = pfnOut;
|
---|
156 | pIoPort->pfnInR3 = pfnIn;
|
---|
157 | pIoPort->pfnOutStrR3 = pfnOutStr;
|
---|
158 | pIoPort->pfnInStrR3 = pfnInStr;
|
---|
159 | RTListAppend(&pDevIns->Internal.s.pDut->LstIoPorts, &pIoPort->NdIoPorts);
|
---|
160 | *phIoPorts = (IOMIOPORTHANDLE)pIoPort;
|
---|
161 | }
|
---|
162 | else
|
---|
163 | rc = VERR_NO_MEMORY;
|
---|
164 |
|
---|
165 | LogFlow(("pdmR3DevHlp_IoPortCreateEx: caller='%s'/%d: returns %Rrc (*phIoPorts=%#x)\n",
|
---|
166 | pDevIns->pReg->szName, pDevIns->iInstance, rc, *phIoPorts));
|
---|
167 | return rc;
|
---|
168 | }
|
---|
169 |
|
---|
170 |
|
---|
171 | /** @interface_method_impl{PDMDEVHLPR3,pfnIoPortMap} */
|
---|
172 | static DECLCALLBACK(int) pdmR3DevHlp_IoPortMap(PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts, RTIOPORT Port)
|
---|
173 | {
|
---|
174 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
175 | LogFlow(("pdmR3DevHlp_IoPortMap: caller='%s'/%d: hIoPorts=%#x Port=%#x\n", pDevIns->pReg->szName, pDevIns->iInstance, hIoPorts, Port));
|
---|
176 |
|
---|
177 | PRTDEVDUTIOPORT pIoPort = (PRTDEVDUTIOPORT)hIoPorts;
|
---|
178 | pIoPort->PortStart = Port;
|
---|
179 |
|
---|
180 | LogFlow(("pdmR3DevHlp_IoPortMap: caller='%s'/%d: returns VINF_SUCCESS\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
|
---|
181 | return VINF_SUCCESS;
|
---|
182 | }
|
---|
183 |
|
---|
184 |
|
---|
185 | /** @interface_method_impl{PDMDEVHLPR3,pfnIoPortUnmap} */
|
---|
186 | static DECLCALLBACK(int) pdmR3DevHlp_IoPortUnmap(PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts)
|
---|
187 | {
|
---|
188 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
189 | LogFlow(("pdmR3DevHlp_IoPortMap: caller='%s'/%d: hIoPorts=%#x\n", pDevIns->pReg->szName, pDevIns->iInstance, hIoPorts));
|
---|
190 |
|
---|
191 | PRTDEVDUTIOPORT pIoPort = (PRTDEVDUTIOPORT)hIoPorts;
|
---|
192 | pIoPort->PortStart = 0;
|
---|
193 | int rc = VINF_SUCCESS;
|
---|
194 |
|
---|
195 | LogFlow(("pdmR3DevHlp_IoPortMap: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
196 | return rc;
|
---|
197 | }
|
---|
198 |
|
---|
199 |
|
---|
200 | /** @interface_method_impl{PDMDEVHLPR3,pfnIoPortGetMappingAddress} */
|
---|
201 | static DECLCALLBACK(uint32_t) pdmR3DevHlp_IoPortGetMappingAddress(PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts)
|
---|
202 | {
|
---|
203 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
204 | LogFlow(("pdmR3DevHlp_IoPortGetMappingAddress: caller='%s'/%d: hIoPorts=%#x\n", pDevIns->pReg->szName, pDevIns->iInstance, hIoPorts));
|
---|
205 |
|
---|
206 | PRTDEVDUTIOPORT pIoPort = (PRTDEVDUTIOPORT)hIoPorts;
|
---|
207 | uint32_t uAddress = pIoPort->PortStart;
|
---|
208 |
|
---|
209 | LogFlow(("pdmR3DevHlp_IoPortGetMappingAddress: caller='%s'/%d: returns %#RX32\n", pDevIns->pReg->szName, pDevIns->iInstance, uAddress));
|
---|
210 | return uAddress;
|
---|
211 | }
|
---|
212 |
|
---|
213 |
|
---|
214 | /** @interface_method_impl{PDMDEVHLPR3,pfnIoPortWrite} */
|
---|
215 | static DECLCALLBACK(VBOXSTRICTRC) pdmR3DevHlp_IoPortWrite(PPDMDEVINS pDevIns, RTIOPORT Port, uint32_t u32Value, size_t cbValue)
|
---|
216 | {
|
---|
217 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
218 | LogFlow(("pdmR3DevHlp_IoPortWrite: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
219 |
|
---|
220 | RT_NOREF(Port, u32Value, cbValue);
|
---|
221 | VBOXSTRICTRC rcStrict = VERR_NOT_IMPLEMENTED;
|
---|
222 | AssertFailed();
|
---|
223 |
|
---|
224 | LogFlow(("pdmR3DevHlp_IoPortWrite: caller='%s'/%d: returns %Rrc\n",
|
---|
225 | pDevIns->pReg->szName, pDevIns->iInstance, VBOXSTRICTRC_VAL(rcStrict)));
|
---|
226 | return rcStrict;
|
---|
227 | }
|
---|
228 |
|
---|
229 |
|
---|
230 | /** @interface_method_impl{PDMDEVHLPR3,pfnMmioCreateEx} */
|
---|
231 | static DECLCALLBACK(int) pdmR3DevHlp_MmioCreateEx(PPDMDEVINS pDevIns, RTGCPHYS cbRegion,
|
---|
232 | uint32_t fFlags, PPDMPCIDEV pPciDev, uint32_t iPciRegion,
|
---|
233 | PFNIOMMMIONEWWRITE pfnWrite, PFNIOMMMIONEWREAD pfnRead, PFNIOMMMIONEWFILL pfnFill,
|
---|
234 | void *pvUser, const char *pszDesc, PIOMMMIOHANDLE phRegion)
|
---|
235 | {
|
---|
236 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
237 | LogFlow(("pdmR3DevHlp_MmioCreateEx: caller='%s'/%d: cbRegion=%#RGp fFlags=%#x pPciDev=%p iPciRegion=%#x pfnWrite=%p pfnRead=%p pfnFill=%p pvUser=%p pszDesc=%p:{%s} phRegion=%p\n",
|
---|
238 | pDevIns->pReg->szName, pDevIns->iInstance, cbRegion, fFlags, pPciDev, iPciRegion, pfnWrite, pfnRead, pfnFill, pvUser, pszDesc, pszDesc, phRegion));
|
---|
239 |
|
---|
240 | /** @todo Verify there is no overlapping. */
|
---|
241 |
|
---|
242 | RT_NOREF(pszDesc);
|
---|
243 | int rc = VINF_SUCCESS;
|
---|
244 | PRTDEVDUTMMIO pMmio = (PRTDEVDUTMMIO)RTMemAllocZ(sizeof(*pMmio));
|
---|
245 | if (RT_LIKELY(pMmio))
|
---|
246 | {
|
---|
247 | pMmio->cbRegion = cbRegion;
|
---|
248 | pMmio->pvUserR3 = pvUser;
|
---|
249 | pMmio->pfnWriteR3 = pfnWrite;
|
---|
250 | pMmio->pfnReadR3 = pfnRead;
|
---|
251 | pMmio->pfnFillR3 = pfnFill;
|
---|
252 | RTListAppend(&pDevIns->Internal.s.pDut->LstMmio, &pMmio->NdMmio);
|
---|
253 | *phRegion = (IOMMMIOHANDLE)pMmio;
|
---|
254 | }
|
---|
255 | else
|
---|
256 | rc = VERR_NO_MEMORY;
|
---|
257 |
|
---|
258 | LogFlow(("pdmR3DevHlp_MmioCreateEx: caller='%s'/%d: returns %Rrc (*phRegion=%#x)\n",
|
---|
259 | pDevIns->pReg->szName, pDevIns->iInstance, rc, *phRegion));
|
---|
260 | return rc;
|
---|
261 | }
|
---|
262 |
|
---|
263 |
|
---|
264 | /** @interface_method_impl{PDMDEVHLPR3,pfnMmioMap} */
|
---|
265 | static DECLCALLBACK(int) pdmR3DevHlp_MmioMap(PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion, RTGCPHYS GCPhys)
|
---|
266 | {
|
---|
267 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
268 | LogFlow(("pdmR3DevHlp_MmioMap: caller='%s'/%d: hRegion=%#x GCPhys=%#RGp\n", pDevIns->pReg->szName, pDevIns->iInstance, hRegion, GCPhys));
|
---|
269 |
|
---|
270 | int rc = VINF_SUCCESS;
|
---|
271 | PRTDEVDUTMMIO pMmio = (PRTDEVDUTMMIO)hRegion;
|
---|
272 | pMmio->GCPhysStart = GCPhys;
|
---|
273 |
|
---|
274 | LogFlow(("pdmR3DevHlp_MmioMap: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
275 | return rc;
|
---|
276 | }
|
---|
277 |
|
---|
278 |
|
---|
279 | /** @interface_method_impl{PDMDEVHLPR3,pfnMmioUnmap} */
|
---|
280 | static DECLCALLBACK(int) pdmR3DevHlp_MmioUnmap(PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion)
|
---|
281 | {
|
---|
282 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
283 | LogFlow(("pdmR3DevHlp_MmioUnmap: caller='%s'/%d: hRegion=%#x\n", pDevIns->pReg->szName, pDevIns->iInstance, hRegion));
|
---|
284 |
|
---|
285 | int rc = VINF_SUCCESS;
|
---|
286 | PRTDEVDUTMMIO pMmio = (PRTDEVDUTMMIO)hRegion;
|
---|
287 | pMmio->GCPhysStart = NIL_RTGCPHYS;
|
---|
288 |
|
---|
289 | LogFlow(("pdmR3DevHlp_MmioUnmap: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
290 | return rc;
|
---|
291 | }
|
---|
292 |
|
---|
293 |
|
---|
294 | /** @interface_method_impl{PDMDEVHLPR3,pfnMmioReduce} */
|
---|
295 | static DECLCALLBACK(int) pdmR3DevHlp_MmioReduce(PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion, RTGCPHYS cbRegion)
|
---|
296 | {
|
---|
297 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
298 | LogFlow(("pdmR3DevHlp_MmioReduce: caller='%s'/%d: hRegion=%#x cbRegion=%#RGp\n", pDevIns->pReg->szName, pDevIns->iInstance, hRegion, cbRegion));
|
---|
299 |
|
---|
300 | int rc = VINF_SUCCESS;
|
---|
301 | PRTDEVDUTMMIO pMmio = (PRTDEVDUTMMIO)hRegion;
|
---|
302 | pMmio->cbRegion = cbRegion;
|
---|
303 |
|
---|
304 | LogFlow(("pdmR3DevHlp_MmioReduce: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
305 | return rc;
|
---|
306 | }
|
---|
307 |
|
---|
308 |
|
---|
309 | /** @interface_method_impl{PDMDEVHLPR3,pfnMmioGetMappingAddress} */
|
---|
310 | static DECLCALLBACK(RTGCPHYS) pdmR3DevHlp_MmioGetMappingAddress(PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion)
|
---|
311 | {
|
---|
312 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
313 | LogFlow(("pdmR3DevHlp_MmioGetMappingAddress: caller='%s'/%d: hRegion=%#x\n", pDevIns->pReg->szName, pDevIns->iInstance, hRegion));
|
---|
314 |
|
---|
315 | PRTDEVDUTMMIO pMmio = (PRTDEVDUTMMIO)hRegion;
|
---|
316 | RTGCPHYS GCPhys = pMmio->GCPhysStart;
|
---|
317 |
|
---|
318 | LogFlow(("pdmR3DevHlp_MmioGetMappingAddress: caller='%s'/%d: returns %RGp\n", pDevIns->pReg->szName, pDevIns->iInstance, GCPhys));
|
---|
319 | return GCPhys;
|
---|
320 | }
|
---|
321 |
|
---|
322 |
|
---|
323 | /** @interface_method_impl{PDMDEVHLPR3,pfnMmio2Create} */
|
---|
324 | static DECLCALLBACK(int) pdmR3DevHlp_Mmio2Create(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iPciRegion, RTGCPHYS cbRegion,
|
---|
325 | uint32_t fFlags, const char *pszDesc, void **ppvMapping, PPGMMMIO2HANDLE phRegion)
|
---|
326 | {
|
---|
327 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
328 | LogFlow(("pdmR3DevHlp_Mmio2Create: caller='%s'/%d: pPciDev=%p (%#x) iPciRegion=%#x cbRegion=%#RGp fFlags=%RX32 pszDesc=%p:{%s} ppvMapping=%p phRegion=%p\n",
|
---|
329 | pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iPciRegion, cbRegion,
|
---|
330 | fFlags, pszDesc, pszDesc, ppvMapping, phRegion));
|
---|
331 |
|
---|
332 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
333 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
334 | AssertFailed();
|
---|
335 | #else
|
---|
336 | int rc = VINF_SUCCESS;
|
---|
337 | *phRegion = 0;
|
---|
338 | *ppvMapping = RTMemAllocZ(cbRegion);
|
---|
339 | if (!*ppvMapping)
|
---|
340 | rc = VERR_NO_MEMORY;
|
---|
341 | #endif
|
---|
342 |
|
---|
343 | LogFlow(("pdmR3DevHlp_Mmio2Create: caller='%s'/%d: returns %Rrc *ppvMapping=%p phRegion=%#RX64\n",
|
---|
344 | pDevIns->pReg->szName, pDevIns->iInstance, rc, *ppvMapping, *phRegion));
|
---|
345 | return rc;
|
---|
346 | }
|
---|
347 |
|
---|
348 |
|
---|
349 | /** @interface_method_impl{PDMDEVHLPR3,pfnMmio2Destroy} */
|
---|
350 | static DECLCALLBACK(int) pdmR3DevHlp_Mmio2Destroy(PPDMDEVINS pDevIns, PGMMMIO2HANDLE hRegion)
|
---|
351 | {
|
---|
352 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
353 | LogFlow(("pdmR3DevHlp_Mmio2Destroy: caller='%s'/%d: hRegion=%#RX64\n", pDevIns->pReg->szName, pDevIns->iInstance, hRegion));
|
---|
354 |
|
---|
355 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
356 | AssertFailed();
|
---|
357 |
|
---|
358 | LogFlow(("pdmR3DevHlp_Mmio2Destroy: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
359 | return rc;
|
---|
360 | }
|
---|
361 |
|
---|
362 |
|
---|
363 | /** @interface_method_impl{PDMDEVHLPR3,pfnMmio2Map} */
|
---|
364 | static DECLCALLBACK(int) pdmR3DevHlp_Mmio2Map(PPDMDEVINS pDevIns, PGMMMIO2HANDLE hRegion, RTGCPHYS GCPhys)
|
---|
365 | {
|
---|
366 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
367 | LogFlow(("pdmR3DevHlp_Mmio2Map: caller='%s'/%d: hRegion=%#RX64 GCPhys=%RGp\n", pDevIns->pReg->szName, pDevIns->iInstance, hRegion, GCPhys));
|
---|
368 |
|
---|
369 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
370 | AssertFailed();
|
---|
371 |
|
---|
372 | LogFlow(("pdmR3DevHlp_Mmio2Map: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
373 | return rc;
|
---|
374 | }
|
---|
375 |
|
---|
376 |
|
---|
377 | /** @interface_method_impl{PDMDEVHLPR3,pfnMmio2Unmap} */
|
---|
378 | static DECLCALLBACK(int) pdmR3DevHlp_Mmio2Unmap(PPDMDEVINS pDevIns, PGMMMIO2HANDLE hRegion)
|
---|
379 | {
|
---|
380 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
381 | LogFlow(("pdmR3DevHlp_Mmio2Unmap: caller='%s'/%d: hRegion=%#RX64\n", pDevIns->pReg->szName, pDevIns->iInstance, hRegion));
|
---|
382 |
|
---|
383 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
384 | AssertFailed();
|
---|
385 |
|
---|
386 | LogFlow(("pdmR3DevHlp_Mmio2Unmap: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
387 | return rc;
|
---|
388 | }
|
---|
389 |
|
---|
390 |
|
---|
391 | /** @interface_method_impl{PDMDEVHLPR3,pfnMmio2Reduce} */
|
---|
392 | static DECLCALLBACK(int) pdmR3DevHlp_Mmio2Reduce(PPDMDEVINS pDevIns, PGMMMIO2HANDLE hRegion, RTGCPHYS cbRegion)
|
---|
393 | {
|
---|
394 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
395 | LogFlow(("pdmR3DevHlp_Mmio2Reduce: caller='%s'/%d: hRegion=%#RX64 cbRegion=%RGp\n", pDevIns->pReg->szName, pDevIns->iInstance, hRegion, cbRegion));
|
---|
396 |
|
---|
397 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
398 | AssertFailed();
|
---|
399 |
|
---|
400 | LogFlow(("pdmR3DevHlp_Mmio2Reduce: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
401 | return rc;
|
---|
402 | }
|
---|
403 |
|
---|
404 |
|
---|
405 | /** @interface_method_impl{PDMDEVHLPR3,pfnMmio2GetMappingAddress} */
|
---|
406 | static DECLCALLBACK(RTGCPHYS) pdmR3DevHlp_Mmio2GetMappingAddress(PPDMDEVINS pDevIns, PGMMMIO2HANDLE hRegion)
|
---|
407 | {
|
---|
408 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
409 | LogFlow(("pdmR3DevHlp_Mmio2GetMappingAddress: caller='%s'/%d: hRegion=%#RX6r\n", pDevIns->pReg->szName, pDevIns->iInstance, hRegion));
|
---|
410 |
|
---|
411 | RTGCPHYS GCPhys = NIL_RTGCPHYS;
|
---|
412 | AssertFailed();
|
---|
413 |
|
---|
414 | LogFlow(("pdmR3DevHlp_Mmio2GetMappingAddress: caller='%s'/%d: returns %RGp\n", pDevIns->pReg->szName, pDevIns->iInstance, GCPhys));
|
---|
415 | return GCPhys;
|
---|
416 | }
|
---|
417 |
|
---|
418 |
|
---|
419 | /** @interface_method_impl{PDMDEVHLPR3,pfnMmio2QueryAndResetDirtyBitmap} */
|
---|
420 | static DECLCALLBACK(int) pdmR3DevHlp_Mmio2QueryAndResetDirtyBitmap(PPDMDEVINS pDevIns, PGMMMIO2HANDLE hRegion,
|
---|
421 | void *pvBitmap, size_t cbBitmap)
|
---|
422 | {
|
---|
423 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
424 | //PVM pVM = pDevIns->Internal.s.pVMR3;
|
---|
425 | LogFlow(("pdmR3DevHlp_Mmio2QueryAndResetDirtyBitmap: caller='%s'/%d: hRegion=%#RX64 pvBitmap=%p cbBitmap=%#zx\n",
|
---|
426 | pDevIns->pReg->szName, pDevIns->iInstance, hRegion, pvBitmap, cbBitmap));
|
---|
427 |
|
---|
428 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
429 |
|
---|
430 | LogFlow(("pdmR3DevHlp_Mmio2QueryAndResetDirtyBitmap: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
431 | return rc;
|
---|
432 | }
|
---|
433 |
|
---|
434 |
|
---|
435 | /** @interface_method_impl{PDMDEVHLPR3,pfnMmio2ControlDirtyPageTracking} */
|
---|
436 | static DECLCALLBACK(int) pdmR3DevHlp_Mmio2ControlDirtyPageTracking(PPDMDEVINS pDevIns, PGMMMIO2HANDLE hRegion, bool fEnabled)
|
---|
437 | {
|
---|
438 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
439 | //PVM pVM = pDevIns->Internal.s.pVMR3;
|
---|
440 | LogFlow(("pdmR3DevHlp_Mmio2ControlDirtyPageTracking: caller='%s'/%d: hRegion=%#RX64 fEnabled=%RTbool\n",
|
---|
441 | pDevIns->pReg->szName, pDevIns->iInstance, hRegion, fEnabled));
|
---|
442 |
|
---|
443 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
444 |
|
---|
445 | LogFlow(("pdmR3DevHlp_Mmio2ControlDirtyPageTracking: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
446 | return rc;
|
---|
447 | }
|
---|
448 |
|
---|
449 |
|
---|
450 | /**
|
---|
451 | * @copydoc PDMDEVHLPR3::pfnMmio2ChangeRegionNo
|
---|
452 | */
|
---|
453 | static DECLCALLBACK(int) pdmR3DevHlp_Mmio2ChangeRegionNo(PPDMDEVINS pDevIns, PGMMMIO2HANDLE hRegion, uint32_t iNewRegion)
|
---|
454 | {
|
---|
455 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
456 | LogFlow(("pdmR3DevHlp_Mmio2ChangeRegionNo: caller='%s'/%d: hRegion=%#RX6r iNewRegion=%#x\n", pDevIns->pReg->szName, pDevIns->iInstance, hRegion, iNewRegion));
|
---|
457 |
|
---|
458 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
459 | AssertFailed();
|
---|
460 |
|
---|
461 | LogFlow(("pdmR3DevHlp_Mmio2ChangeRegionNo: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
462 | return rc;
|
---|
463 | }
|
---|
464 |
|
---|
465 |
|
---|
466 | /** @interface_method_impl{PDMDEVHLPR3,pfnMmioMapMmio2Page} */
|
---|
467 | static DECLCALLBACK(int) pdmR3DevHlp_MmioMapMmio2Page(PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion, RTGCPHYS offRegion,
|
---|
468 | uint64_t hMmio2, RTGCPHYS offMmio2, uint64_t fPageFlags)
|
---|
469 | {
|
---|
470 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
471 | LogFlow(("pdmR3DevHlp_MmioMapMmio2Page: caller='%s'/%d: hRegion=%RX64 offRegion=%RGp hMmio2=%RX64 offMmio2=%RGp fPageFlags=%RX64\n",
|
---|
472 | pDevIns->pReg->szName, pDevIns->iInstance, hRegion, offRegion, hMmio2, offMmio2, fPageFlags));
|
---|
473 |
|
---|
474 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
475 | AssertFailed();
|
---|
476 |
|
---|
477 | Log(("pdmR3DevHlp_MmioMapMmio2Page: caller='%s'/%d: returns %Rrc\n",
|
---|
478 | pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
479 | return rc;
|
---|
480 | }
|
---|
481 |
|
---|
482 |
|
---|
483 | /** @interface_method_impl{PDMDEVHLPR3,pfnMmioResetRegion} */
|
---|
484 | static DECLCALLBACK(int) pdmR3DevHlp_MmioResetRegion(PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion)
|
---|
485 | {
|
---|
486 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
487 | LogFlow(("pdmR3DevHlp_MmioResetRegion: caller='%s'/%d: hRegion=%RX64\n",
|
---|
488 | pDevIns->pReg->szName, pDevIns->iInstance, hRegion));
|
---|
489 |
|
---|
490 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
491 | AssertFailed();
|
---|
492 |
|
---|
493 | Log(("pdmR3DevHlp_MmioResetRegion: caller='%s'/%d: returns %Rrc\n",
|
---|
494 | pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
495 | return rc;
|
---|
496 | }
|
---|
497 |
|
---|
498 |
|
---|
499 | /** @interface_method_impl{PDMDEVHLPR3,pfnROMRegister} */
|
---|
500 | static DECLCALLBACK(int) pdmR3DevHlp_ROMRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange,
|
---|
501 | const void *pvBinary, uint32_t cbBinary, uint32_t fFlags, const char *pszDesc)
|
---|
502 | {
|
---|
503 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
504 | LogFlow(("pdmR3DevHlp_ROMRegister: caller='%s'/%d: GCPhysStart=%RGp cbRange=%#x pvBinary=%p cbBinary=%#x fFlags=%#RX32 pszDesc=%p:{%s}\n",
|
---|
505 | pDevIns->pReg->szName, pDevIns->iInstance, GCPhysStart, cbRange, pvBinary, cbBinary, fFlags, pszDesc, pszDesc));
|
---|
506 |
|
---|
507 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
508 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
509 | AssertFailed();
|
---|
510 | #else
|
---|
511 | int rc = VINF_SUCCESS;
|
---|
512 | #endif
|
---|
513 |
|
---|
514 | LogFlow(("pdmR3DevHlp_ROMRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
515 | return rc;
|
---|
516 | }
|
---|
517 |
|
---|
518 |
|
---|
519 | /** @interface_method_impl{PDMDEVHLPR3,pfnROMProtectShadow} */
|
---|
520 | static DECLCALLBACK(int) pdmR3DevHlp_ROMProtectShadow(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange, PGMROMPROT enmProt)
|
---|
521 | {
|
---|
522 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
523 | LogFlow(("pdmR3DevHlp_ROMProtectShadow: caller='%s'/%d: GCPhysStart=%RGp cbRange=%#x enmProt=%d\n",
|
---|
524 | pDevIns->pReg->szName, pDevIns->iInstance, GCPhysStart, cbRange, enmProt));
|
---|
525 |
|
---|
526 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
527 | AssertFailed();
|
---|
528 |
|
---|
529 | LogFlow(("pdmR3DevHlp_ROMProtectShadow: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
530 | return rc;
|
---|
531 | }
|
---|
532 |
|
---|
533 |
|
---|
534 | static DECLCALLBACK(int) pdmR3DevHlp_SSMRegister(PPDMDEVINS pDevIns, uint32_t uVersion, size_t cbGuess, const char *pszBefore,
|
---|
535 | PFNSSMDEVLIVEPREP pfnLivePrep, PFNSSMDEVLIVEEXEC pfnLiveExec, PFNSSMDEVLIVEVOTE pfnLiveVote,
|
---|
536 | PFNSSMDEVSAVEPREP pfnSavePrep, PFNSSMDEVSAVEEXEC pfnSaveExec, PFNSSMDEVSAVEDONE pfnSaveDone,
|
---|
537 | PFNSSMDEVLOADPREP pfnLoadPrep, PFNSSMDEVLOADEXEC pfnLoadExec, PFNSSMDEVLOADDONE pfnLoadDone)
|
---|
538 | {
|
---|
539 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
540 | LogFlow(("pdmR3DevHlp_SSMRegister: caller='%s'/%d: uVersion=%#x cbGuess=%#x pszBefore=%p:{%s}\n"
|
---|
541 | " pfnLivePrep=%p pfnLiveExec=%p pfnLiveVote=%p pfnSavePrep=%p pfnSaveExec=%p pfnSaveDone=%p pszLoadPrep=%p pfnLoadExec=%p pfnLoadDone=%p\n",
|
---|
542 | pDevIns->pReg->szName, pDevIns->iInstance, uVersion, cbGuess, pszBefore, pszBefore,
|
---|
543 | pfnLivePrep, pfnLiveExec, pfnLiveVote,
|
---|
544 | pfnSavePrep, pfnSaveExec, pfnSaveDone,
|
---|
545 | pfnLoadPrep, pfnLoadExec, pfnLoadDone));
|
---|
546 |
|
---|
547 | RT_NOREF(cbGuess, pszBefore);
|
---|
548 | int rc = VINF_SUCCESS;
|
---|
549 | PTSTDEVDUTSSM pSsm = (PTSTDEVDUTSSM)RTMemAllocZ(sizeof(*pSsm));
|
---|
550 | if (RT_LIKELY(pSsm))
|
---|
551 | {
|
---|
552 | pSsm->uVersion = uVersion;
|
---|
553 | pSsm->pfnLivePrep = pfnLivePrep;
|
---|
554 | pSsm->pfnLiveExec = pfnLiveExec;
|
---|
555 | pSsm->pfnLiveVote = pfnLiveVote;
|
---|
556 | pSsm->pfnSavePrep = pfnSavePrep;
|
---|
557 | pSsm->pfnSaveExec = pfnSaveExec;
|
---|
558 | pSsm->pfnSaveDone = pfnSaveDone;
|
---|
559 | pSsm->pfnLoadPrep = pfnLoadPrep;
|
---|
560 | pSsm->pfnLoadExec = pfnLoadExec;
|
---|
561 | pSsm->pfnLoadDone = pfnLoadDone;
|
---|
562 | RTListAppend(&pDevIns->Internal.s.pDut->LstSsmHandlers, &pSsm->NdSsm);
|
---|
563 | }
|
---|
564 | else
|
---|
565 | rc = VERR_NO_MEMORY;
|
---|
566 |
|
---|
567 | LogFlow(("pdmR3DevHlp_SSMRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
568 | return rc;
|
---|
569 | }
|
---|
570 |
|
---|
571 |
|
---|
572 | /** @interface_method_impl{PDMDEVHLPR3,pfnSSMRegisterLegacy} */
|
---|
573 | static DECLCALLBACK(int) pdmR3DevHlp_SSMRegisterLegacy(PPDMDEVINS pDevIns, const char *pszOldName, PFNSSMDEVLOADPREP pfnLoadPrep,
|
---|
574 | PFNSSMDEVLOADEXEC pfnLoadExec, PFNSSMDEVLOADDONE pfnLoadDone)
|
---|
575 | {
|
---|
576 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
577 | LogFlow(("pdmR3DevHlp_SSMRegisterLegacy: caller='%s'/%d: pszOldName=%p:{%s} pfnLoadPrep=%p pfnLoadExec=%p pfnLoadDone=%p\n",
|
---|
578 | pDevIns->pReg->szName, pDevIns->iInstance, pszOldName, pszOldName, pfnLoadPrep, pfnLoadExec, pfnLoadDone));
|
---|
579 |
|
---|
580 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
581 | AssertFailed();
|
---|
582 |
|
---|
583 | LogFlow(("pdmR3DevHlp_SSMRegisterLegacy: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
584 | return rc;
|
---|
585 | }
|
---|
586 |
|
---|
587 |
|
---|
588 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutStruct(PSSMHANDLE pSSM, const void *pvStruct, PCSSMFIELD paFields)
|
---|
589 | {
|
---|
590 | RT_NOREF(pSSM, pvStruct, paFields);
|
---|
591 | AssertFailed();
|
---|
592 | return VERR_NOT_IMPLEMENTED;
|
---|
593 | }
|
---|
594 |
|
---|
595 |
|
---|
596 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutStructEx(PSSMHANDLE pSSM, const void *pvStruct, size_t cbStruct, uint32_t fFlags, PCSSMFIELD paFields, void *pvUser)
|
---|
597 | {
|
---|
598 | RT_NOREF(pSSM, pvStruct, cbStruct, fFlags, paFields, pvUser);
|
---|
599 | AssertFailed();
|
---|
600 | return VERR_NOT_IMPLEMENTED;
|
---|
601 | }
|
---|
602 |
|
---|
603 |
|
---|
604 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutBool(PSSMHANDLE pSSM, bool fBool)
|
---|
605 | {
|
---|
606 | RT_NOREF(pSSM, fBool);
|
---|
607 | AssertFailed();
|
---|
608 | return VERR_NOT_IMPLEMENTED;
|
---|
609 | }
|
---|
610 |
|
---|
611 |
|
---|
612 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutU8(PSSMHANDLE pSSM, uint8_t u8)
|
---|
613 | {
|
---|
614 | RT_NOREF(pSSM, u8);
|
---|
615 | AssertFailed();
|
---|
616 | return VERR_NOT_IMPLEMENTED;
|
---|
617 | }
|
---|
618 |
|
---|
619 |
|
---|
620 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutS8(PSSMHANDLE pSSM, int8_t i8)
|
---|
621 | {
|
---|
622 | RT_NOREF(pSSM, i8);
|
---|
623 | AssertFailed();
|
---|
624 | return VERR_NOT_IMPLEMENTED;
|
---|
625 | }
|
---|
626 |
|
---|
627 |
|
---|
628 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutU16(PSSMHANDLE pSSM, uint16_t u16)
|
---|
629 | {
|
---|
630 | RT_NOREF(pSSM, u16);
|
---|
631 | AssertFailed();
|
---|
632 | return VERR_NOT_IMPLEMENTED;
|
---|
633 | }
|
---|
634 |
|
---|
635 |
|
---|
636 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutS16(PSSMHANDLE pSSM, int16_t i16)
|
---|
637 | {
|
---|
638 | RT_NOREF(pSSM, i16);
|
---|
639 | AssertFailed();
|
---|
640 | return VERR_NOT_IMPLEMENTED;
|
---|
641 | }
|
---|
642 |
|
---|
643 |
|
---|
644 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutU32(PSSMHANDLE pSSM, uint32_t u32)
|
---|
645 | {
|
---|
646 | RT_NOREF(pSSM, u32);
|
---|
647 | AssertFailed();
|
---|
648 | return VERR_NOT_IMPLEMENTED;
|
---|
649 | }
|
---|
650 |
|
---|
651 |
|
---|
652 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutS32(PSSMHANDLE pSSM, int32_t i32)
|
---|
653 | {
|
---|
654 | RT_NOREF(pSSM, i32);
|
---|
655 | AssertFailed();
|
---|
656 | return VERR_NOT_IMPLEMENTED;
|
---|
657 | }
|
---|
658 |
|
---|
659 |
|
---|
660 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutU64(PSSMHANDLE pSSM, uint64_t u64)
|
---|
661 | {
|
---|
662 | RT_NOREF(pSSM, u64);
|
---|
663 | AssertFailed();
|
---|
664 | return VERR_NOT_IMPLEMENTED;
|
---|
665 | }
|
---|
666 |
|
---|
667 |
|
---|
668 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutS64(PSSMHANDLE pSSM, int64_t i64)
|
---|
669 | {
|
---|
670 | RT_NOREF(pSSM, i64);
|
---|
671 | AssertFailed();
|
---|
672 | return VERR_NOT_IMPLEMENTED;
|
---|
673 | }
|
---|
674 |
|
---|
675 |
|
---|
676 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutU128(PSSMHANDLE pSSM, uint128_t u128)
|
---|
677 | {
|
---|
678 | RT_NOREF(pSSM, u128);
|
---|
679 | AssertFailed();
|
---|
680 | return VERR_NOT_IMPLEMENTED;
|
---|
681 | }
|
---|
682 |
|
---|
683 |
|
---|
684 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutS128(PSSMHANDLE pSSM, int128_t i128)
|
---|
685 | {
|
---|
686 | RT_NOREF(pSSM, i128);
|
---|
687 | AssertFailed();
|
---|
688 | return VERR_NOT_IMPLEMENTED;
|
---|
689 | }
|
---|
690 |
|
---|
691 |
|
---|
692 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutUInt(PSSMHANDLE pSSM, RTUINT u)
|
---|
693 | {
|
---|
694 | RT_NOREF(pSSM, u);
|
---|
695 | AssertFailed();
|
---|
696 | return VERR_NOT_IMPLEMENTED;
|
---|
697 | }
|
---|
698 |
|
---|
699 |
|
---|
700 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutSInt(PSSMHANDLE pSSM, RTINT i)
|
---|
701 | {
|
---|
702 | RT_NOREF(pSSM, i);
|
---|
703 | AssertFailed();
|
---|
704 | return VERR_NOT_IMPLEMENTED;
|
---|
705 | }
|
---|
706 |
|
---|
707 |
|
---|
708 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutGCUInt(PSSMHANDLE pSSM, RTGCUINT u)
|
---|
709 | {
|
---|
710 | RT_NOREF(pSSM, u);
|
---|
711 | AssertFailed();
|
---|
712 | return VERR_NOT_IMPLEMENTED;
|
---|
713 | }
|
---|
714 |
|
---|
715 |
|
---|
716 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutGCUIntReg(PSSMHANDLE pSSM, RTGCUINTREG u)
|
---|
717 | {
|
---|
718 | RT_NOREF(pSSM, u);
|
---|
719 | AssertFailed();
|
---|
720 | return VERR_NOT_IMPLEMENTED;
|
---|
721 | }
|
---|
722 |
|
---|
723 |
|
---|
724 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutGCPhys32(PSSMHANDLE pSSM, RTGCPHYS32 GCPhys)
|
---|
725 | {
|
---|
726 | RT_NOREF(pSSM, GCPhys);
|
---|
727 | AssertFailed();
|
---|
728 | return VERR_NOT_IMPLEMENTED;
|
---|
729 | }
|
---|
730 |
|
---|
731 |
|
---|
732 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutGCPhys64(PSSMHANDLE pSSM, RTGCPHYS64 GCPhys)
|
---|
733 | {
|
---|
734 | RT_NOREF(pSSM, GCPhys);
|
---|
735 | AssertFailed();
|
---|
736 | return VERR_NOT_IMPLEMENTED;
|
---|
737 | }
|
---|
738 |
|
---|
739 |
|
---|
740 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutGCPhys(PSSMHANDLE pSSM, RTGCPHYS GCPhys)
|
---|
741 | {
|
---|
742 | RT_NOREF(pSSM, GCPhys);
|
---|
743 | AssertFailed();
|
---|
744 | return VERR_NOT_IMPLEMENTED;
|
---|
745 | }
|
---|
746 |
|
---|
747 |
|
---|
748 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutGCPtr(PSSMHANDLE pSSM, RTGCPTR GCPtr)
|
---|
749 | {
|
---|
750 | RT_NOREF(pSSM, GCPtr);
|
---|
751 | AssertFailed();
|
---|
752 | return VERR_NOT_IMPLEMENTED;
|
---|
753 | }
|
---|
754 |
|
---|
755 |
|
---|
756 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutGCUIntPtr(PSSMHANDLE pSSM, RTGCUINTPTR GCPtr)
|
---|
757 | {
|
---|
758 | RT_NOREF(pSSM, GCPtr);
|
---|
759 | AssertFailed();
|
---|
760 | return VERR_NOT_IMPLEMENTED;
|
---|
761 | }
|
---|
762 |
|
---|
763 |
|
---|
764 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutRCPtr(PSSMHANDLE pSSM, RTRCPTR RCPtr)
|
---|
765 | {
|
---|
766 | RT_NOREF(pSSM, RCPtr);
|
---|
767 | AssertFailed();
|
---|
768 | return VERR_NOT_IMPLEMENTED;
|
---|
769 | }
|
---|
770 |
|
---|
771 |
|
---|
772 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutIOPort(PSSMHANDLE pSSM, RTIOPORT IOPort)
|
---|
773 | {
|
---|
774 | RT_NOREF(pSSM, IOPort);
|
---|
775 | AssertFailed();
|
---|
776 | return VERR_NOT_IMPLEMENTED;
|
---|
777 | }
|
---|
778 |
|
---|
779 |
|
---|
780 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutSel(PSSMHANDLE pSSM, RTSEL Sel)
|
---|
781 | {
|
---|
782 | RT_NOREF(pSSM, Sel);
|
---|
783 | AssertFailed();
|
---|
784 | return VERR_NOT_IMPLEMENTED;
|
---|
785 | }
|
---|
786 |
|
---|
787 |
|
---|
788 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutMem(PSSMHANDLE pSSM, const void *pv, size_t cb)
|
---|
789 | {
|
---|
790 | RT_NOREF(pSSM, pv, cb);
|
---|
791 | AssertFailed();
|
---|
792 | return VERR_NOT_IMPLEMENTED;
|
---|
793 | }
|
---|
794 |
|
---|
795 |
|
---|
796 | static DECLCALLBACK(int) pdmR3DevHlp_SSMPutStrZ(PSSMHANDLE pSSM, const char *psz)
|
---|
797 | {
|
---|
798 | RT_NOREF(pSSM, psz);
|
---|
799 | AssertFailed();
|
---|
800 | return VERR_NOT_IMPLEMENTED;
|
---|
801 | }
|
---|
802 |
|
---|
803 |
|
---|
804 | /**
|
---|
805 | * Gets the host bit count of the saved state.
|
---|
806 | *
|
---|
807 | * Works for on both save and load handles.
|
---|
808 | *
|
---|
809 | * @returns 32 or 64.
|
---|
810 | * @param pSSM The saved state handle.
|
---|
811 | */
|
---|
812 | DECLINLINE(uint32_t) ssmR3GetHostBits(PSSMHANDLE pSSM)
|
---|
813 | {
|
---|
814 | /** @todo Don't care about 32bit saved states for now (VBox is 64bit only as of 6.0). */
|
---|
815 | RT_NOREF(pSSM);
|
---|
816 | return HC_ARCH_BITS;
|
---|
817 | }
|
---|
818 |
|
---|
819 |
|
---|
820 | /**
|
---|
821 | * Saved state origins on a host using 32-bit MSC?
|
---|
822 | *
|
---|
823 | * Works for on both save and load handles.
|
---|
824 | *
|
---|
825 | * @returns true/false.
|
---|
826 | * @param pSSM The saved state handle.
|
---|
827 | */
|
---|
828 | DECLINLINE(bool) ssmR3IsHostMsc32(PSSMHANDLE pSSM)
|
---|
829 | {
|
---|
830 | /** @todo Don't care about 32bit saved states for now (VBox is 64bit only as of 6.0). */
|
---|
831 | RT_NOREF(pSSM);
|
---|
832 | return false;
|
---|
833 | }
|
---|
834 |
|
---|
835 |
|
---|
836 | /**
|
---|
837 | * Inlined worker that handles format checks and buffered reads.
|
---|
838 | *
|
---|
839 | * @param pSSM The saved state handle.
|
---|
840 | * @param pvBuf Where to store the read data.
|
---|
841 | * @param cbBuf Number of bytes to read.
|
---|
842 | */
|
---|
843 | DECLINLINE(int) tstDevSsmR3DataRead(PSSMHANDLE pSSM, void *pvBuf, size_t cbBuf)
|
---|
844 | {
|
---|
845 | /*
|
---|
846 | * Fend off previous errors and V1 data units.
|
---|
847 | */
|
---|
848 | if (RT_SUCCESS(pSSM->rc))
|
---|
849 | {
|
---|
850 | /** @todo Don't care about version 1 saved states (long obsolete). */
|
---|
851 | uint32_t off = pSSM->offDataBuffer;
|
---|
852 | if ( cbBuf <= pSSM->cbSavedState
|
---|
853 | && pSSM->cbSavedState - cbBuf >= off)
|
---|
854 | {
|
---|
855 | memcpy(pvBuf, &pSSM->pbSavedState[off], cbBuf);
|
---|
856 | pSSM->offDataBuffer = off + (uint32_t)cbBuf;
|
---|
857 | return VINF_SUCCESS;
|
---|
858 | }
|
---|
859 | else
|
---|
860 | pSSM->rc = VERR_BUFFER_OVERFLOW;
|
---|
861 | }
|
---|
862 | return pSSM->rc;
|
---|
863 | }
|
---|
864 |
|
---|
865 |
|
---|
866 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetBool(PSSMHANDLE pSSM, bool *pfBool)
|
---|
867 | {
|
---|
868 | uint8_t u8; /* see SSMR3PutBool */
|
---|
869 | int rc = tstDevSsmR3DataRead(pSSM, &u8, sizeof(u8));
|
---|
870 | if (RT_SUCCESS(rc))
|
---|
871 | {
|
---|
872 | Assert(u8 <= 1);
|
---|
873 | *pfBool = RT_BOOL(u8);
|
---|
874 | }
|
---|
875 | return rc;
|
---|
876 | }
|
---|
877 |
|
---|
878 |
|
---|
879 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetBoolV(PSSMHANDLE pSSM, bool volatile *pfBool)
|
---|
880 | {
|
---|
881 | uint8_t u8; /* see SSMR3PutBool */
|
---|
882 | int rc = tstDevSsmR3DataRead(pSSM, &u8, sizeof(u8));
|
---|
883 | if (RT_SUCCESS(rc))
|
---|
884 | {
|
---|
885 | Assert(u8 <= 1);
|
---|
886 | *pfBool = RT_BOOL(u8);
|
---|
887 | }
|
---|
888 | return rc;
|
---|
889 | }
|
---|
890 |
|
---|
891 |
|
---|
892 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetU8(PSSMHANDLE pSSM, uint8_t *pu8)
|
---|
893 | {
|
---|
894 | return tstDevSsmR3DataRead(pSSM, pu8, sizeof(*pu8));
|
---|
895 | }
|
---|
896 |
|
---|
897 |
|
---|
898 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetU8V(PSSMHANDLE pSSM, uint8_t volatile *pu8)
|
---|
899 | {
|
---|
900 | return tstDevSsmR3DataRead(pSSM, (void *)pu8, sizeof(*pu8));
|
---|
901 | }
|
---|
902 |
|
---|
903 |
|
---|
904 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetS8(PSSMHANDLE pSSM, int8_t *pi8)
|
---|
905 | {
|
---|
906 | return tstDevSsmR3DataRead(pSSM, pi8, sizeof(*pi8));
|
---|
907 | }
|
---|
908 |
|
---|
909 |
|
---|
910 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetS8V(PSSMHANDLE pSSM, int8_t volatile *pi8)
|
---|
911 | {
|
---|
912 | return tstDevSsmR3DataRead(pSSM, (void *)pi8, sizeof(*pi8));
|
---|
913 | }
|
---|
914 |
|
---|
915 |
|
---|
916 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetU16(PSSMHANDLE pSSM, uint16_t *pu16)
|
---|
917 | {
|
---|
918 | return tstDevSsmR3DataRead(pSSM, pu16, sizeof(*pu16));
|
---|
919 | }
|
---|
920 |
|
---|
921 |
|
---|
922 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetU16V(PSSMHANDLE pSSM, uint16_t volatile *pu16)
|
---|
923 | {
|
---|
924 | return tstDevSsmR3DataRead(pSSM, (void *)pu16, sizeof(*pu16));
|
---|
925 | }
|
---|
926 |
|
---|
927 |
|
---|
928 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetS16(PSSMHANDLE pSSM, int16_t *pi16)
|
---|
929 | {
|
---|
930 | return tstDevSsmR3DataRead(pSSM, pi16, sizeof(*pi16));
|
---|
931 | }
|
---|
932 |
|
---|
933 |
|
---|
934 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetS16V(PSSMHANDLE pSSM, int16_t volatile *pi16)
|
---|
935 | {
|
---|
936 | return tstDevSsmR3DataRead(pSSM, (void *)pi16, sizeof(*pi16));
|
---|
937 | }
|
---|
938 |
|
---|
939 |
|
---|
940 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetU32(PSSMHANDLE pSSM, uint32_t *pu32)
|
---|
941 | {
|
---|
942 | return tstDevSsmR3DataRead(pSSM, pu32, sizeof(*pu32));
|
---|
943 | }
|
---|
944 |
|
---|
945 |
|
---|
946 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetU32V(PSSMHANDLE pSSM, uint32_t volatile *pu32)
|
---|
947 | {
|
---|
948 | return tstDevSsmR3DataRead(pSSM, (void *)pu32, sizeof(*pu32));
|
---|
949 | }
|
---|
950 |
|
---|
951 |
|
---|
952 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetS32(PSSMHANDLE pSSM, int32_t *pi32)
|
---|
953 | {
|
---|
954 | return tstDevSsmR3DataRead(pSSM, pi32, sizeof(*pi32));
|
---|
955 | }
|
---|
956 |
|
---|
957 |
|
---|
958 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetS32V(PSSMHANDLE pSSM, int32_t volatile *pi32)
|
---|
959 | {
|
---|
960 | return tstDevSsmR3DataRead(pSSM, (void *)pi32, sizeof(*pi32));
|
---|
961 | }
|
---|
962 |
|
---|
963 |
|
---|
964 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetU64(PSSMHANDLE pSSM, uint64_t *pu64)
|
---|
965 | {
|
---|
966 | return tstDevSsmR3DataRead(pSSM, pu64, sizeof(*pu64));
|
---|
967 | }
|
---|
968 |
|
---|
969 |
|
---|
970 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetU64V(PSSMHANDLE pSSM, uint64_t volatile *pu64)
|
---|
971 | {
|
---|
972 | return tstDevSsmR3DataRead(pSSM, (void *)pu64, sizeof(*pu64));
|
---|
973 | }
|
---|
974 |
|
---|
975 |
|
---|
976 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetS64(PSSMHANDLE pSSM, int64_t *pi64)
|
---|
977 | {
|
---|
978 | return tstDevSsmR3DataRead(pSSM, pi64, sizeof(*pi64));
|
---|
979 | }
|
---|
980 |
|
---|
981 |
|
---|
982 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetS64V(PSSMHANDLE pSSM, int64_t volatile *pi64)
|
---|
983 | {
|
---|
984 | return tstDevSsmR3DataRead(pSSM, (void *)pi64, sizeof(*pi64));
|
---|
985 | }
|
---|
986 |
|
---|
987 |
|
---|
988 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetU128(PSSMHANDLE pSSM, uint128_t *pu128)
|
---|
989 | {
|
---|
990 | return tstDevSsmR3DataRead(pSSM, pu128, sizeof(*pu128));
|
---|
991 | }
|
---|
992 |
|
---|
993 |
|
---|
994 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetU128V(PSSMHANDLE pSSM, uint128_t volatile *pu128)
|
---|
995 | {
|
---|
996 | return tstDevSsmR3DataRead(pSSM, (void *)pu128, sizeof(*pu128));
|
---|
997 | }
|
---|
998 |
|
---|
999 |
|
---|
1000 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetS128(PSSMHANDLE pSSM, int128_t *pi128)
|
---|
1001 | {
|
---|
1002 | return tstDevSsmR3DataRead(pSSM, pi128, sizeof(*pi128));
|
---|
1003 | }
|
---|
1004 |
|
---|
1005 |
|
---|
1006 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetS128V(PSSMHANDLE pSSM, int128_t volatile *pi128)
|
---|
1007 | {
|
---|
1008 | return tstDevSsmR3DataRead(pSSM, (void *)pi128, sizeof(*pi128));
|
---|
1009 | }
|
---|
1010 |
|
---|
1011 |
|
---|
1012 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetGCPhys32(PSSMHANDLE pSSM, PRTGCPHYS32 pGCPhys)
|
---|
1013 | {
|
---|
1014 | return tstDevSsmR3DataRead(pSSM, pGCPhys, sizeof(*pGCPhys));
|
---|
1015 | }
|
---|
1016 |
|
---|
1017 |
|
---|
1018 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetGCPhys32V(PSSMHANDLE pSSM, RTGCPHYS32 volatile *pGCPhys)
|
---|
1019 | {
|
---|
1020 | return tstDevSsmR3DataRead(pSSM, (void *)pGCPhys, sizeof(*pGCPhys));
|
---|
1021 | }
|
---|
1022 |
|
---|
1023 |
|
---|
1024 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetGCPhys64(PSSMHANDLE pSSM, PRTGCPHYS64 pGCPhys)
|
---|
1025 | {
|
---|
1026 | return tstDevSsmR3DataRead(pSSM, pGCPhys, sizeof(*pGCPhys));
|
---|
1027 | }
|
---|
1028 |
|
---|
1029 |
|
---|
1030 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetGCPhys64V(PSSMHANDLE pSSM, RTGCPHYS64 volatile *pGCPhys)
|
---|
1031 | {
|
---|
1032 | return tstDevSsmR3DataRead(pSSM, (void *)pGCPhys, sizeof(*pGCPhys));
|
---|
1033 | }
|
---|
1034 |
|
---|
1035 |
|
---|
1036 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetGCPhys(PSSMHANDLE pSSM, PRTGCPHYS pGCPhys)
|
---|
1037 | {
|
---|
1038 | /*
|
---|
1039 | * Default size?
|
---|
1040 | */
|
---|
1041 | if (RT_LIKELY(/*sizeof(*pGCPhys) == pSSM->u.Read.cbGCPhys*/true))
|
---|
1042 | return tstDevSsmR3DataRead(pSSM, pGCPhys, sizeof(*pGCPhys));
|
---|
1043 |
|
---|
1044 | #if 0 /** @todo Later if necessary (only very old saved states). */
|
---|
1045 | /*
|
---|
1046 | * Fiddly.
|
---|
1047 | */
|
---|
1048 | Assert(sizeof(*pGCPhys) == sizeof(uint64_t) || sizeof(*pGCPhys) == sizeof(uint32_t));
|
---|
1049 | Assert(pSSM->u.Read.cbGCPhys == sizeof(uint64_t) || pSSM->u.Read.cbGCPhys == sizeof(uint32_t));
|
---|
1050 | if (pSSM->u.Read.cbGCPhys == sizeof(uint64_t))
|
---|
1051 | {
|
---|
1052 | /* 64-bit saved, 32-bit load: try truncate it. */
|
---|
1053 | uint64_t u64;
|
---|
1054 | int rc = tstDevSsmR3DataRead(pSSM, &u64, sizeof(uint64_t));
|
---|
1055 | if (RT_FAILURE(rc))
|
---|
1056 | return rc;
|
---|
1057 | if (u64 >= _4G)
|
---|
1058 | return VERR_SSM_GCPHYS_OVERFLOW;
|
---|
1059 | *pGCPhys = (RTGCPHYS)u64;
|
---|
1060 | return rc;
|
---|
1061 | }
|
---|
1062 |
|
---|
1063 | /* 32-bit saved, 64-bit load: clear the high part. */
|
---|
1064 | *pGCPhys = 0;
|
---|
1065 | return tstDevSsmR3DataRead(pSSM, pGCPhys, sizeof(uint32_t));
|
---|
1066 | #endif
|
---|
1067 | }
|
---|
1068 |
|
---|
1069 |
|
---|
1070 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetGCPhysV(PSSMHANDLE pSSM, RTGCPHYS volatile *pGCPhys)
|
---|
1071 | {
|
---|
1072 | return pdmR3DevHlp_SSMGetGCPhys(pSSM, (PRTGCPHYS)pGCPhys);
|
---|
1073 | }
|
---|
1074 |
|
---|
1075 |
|
---|
1076 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetUInt(PSSMHANDLE pSSM, PRTUINT pu)
|
---|
1077 | {
|
---|
1078 | return tstDevSsmR3DataRead(pSSM, pu, sizeof(*pu));
|
---|
1079 | }
|
---|
1080 |
|
---|
1081 |
|
---|
1082 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetSInt(PSSMHANDLE pSSM, PRTINT pi)
|
---|
1083 | {
|
---|
1084 | return tstDevSsmR3DataRead(pSSM, pi, sizeof(*pi));
|
---|
1085 | }
|
---|
1086 |
|
---|
1087 |
|
---|
1088 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetGCPtr(PSSMHANDLE pSSM, PRTGCPTR pGCPtr)
|
---|
1089 | {
|
---|
1090 | return tstDevSsmR3DataRead(pSSM, pGCPtr, sizeof(*pGCPtr));
|
---|
1091 | }
|
---|
1092 |
|
---|
1093 |
|
---|
1094 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetGCUInt(PSSMHANDLE pSSM, PRTGCUINT pu)
|
---|
1095 | {
|
---|
1096 | return pdmR3DevHlp_SSMGetGCPtr(pSSM, (PRTGCPTR)pu);
|
---|
1097 | }
|
---|
1098 |
|
---|
1099 |
|
---|
1100 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetGCUIntReg(PSSMHANDLE pSSM, PRTGCUINTREG pu)
|
---|
1101 | {
|
---|
1102 | AssertCompile(sizeof(RTGCPTR) == sizeof(*pu));
|
---|
1103 | return pdmR3DevHlp_SSMGetGCPtr(pSSM, (PRTGCPTR)pu);
|
---|
1104 | }
|
---|
1105 |
|
---|
1106 |
|
---|
1107 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetGCUIntPtr(PSSMHANDLE pSSM, PRTGCUINTPTR pGCPtr)
|
---|
1108 | {
|
---|
1109 | return pdmR3DevHlp_SSMGetGCPtr(pSSM, (PRTGCPTR)pGCPtr);
|
---|
1110 | }
|
---|
1111 |
|
---|
1112 |
|
---|
1113 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetRCPtr(PSSMHANDLE pSSM, PRTRCPTR pRCPtr)
|
---|
1114 | {
|
---|
1115 | return tstDevSsmR3DataRead(pSSM, pRCPtr, sizeof(*pRCPtr));
|
---|
1116 | }
|
---|
1117 |
|
---|
1118 |
|
---|
1119 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetIOPort(PSSMHANDLE pSSM, PRTIOPORT pIOPort)
|
---|
1120 | {
|
---|
1121 | return tstDevSsmR3DataRead(pSSM, pIOPort, sizeof(*pIOPort));
|
---|
1122 | }
|
---|
1123 |
|
---|
1124 |
|
---|
1125 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetSel(PSSMHANDLE pSSM, PRTSEL pSel)
|
---|
1126 | {
|
---|
1127 | return tstDevSsmR3DataRead(pSSM, pSel, sizeof(*pSel));
|
---|
1128 | }
|
---|
1129 |
|
---|
1130 |
|
---|
1131 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetMem(PSSMHANDLE pSSM, void *pv, size_t cb)
|
---|
1132 | {
|
---|
1133 | return tstDevSsmR3DataRead(pSSM, pv, cb);
|
---|
1134 | }
|
---|
1135 |
|
---|
1136 |
|
---|
1137 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetStrZEx(PSSMHANDLE pSSM, char *psz, size_t cbMax, size_t *pcbStr)
|
---|
1138 | {
|
---|
1139 | /* read size prefix. */
|
---|
1140 | uint32_t u32;
|
---|
1141 | int rc = pdmR3DevHlp_SSMGetU32(pSSM, &u32);
|
---|
1142 | if (RT_SUCCESS(rc))
|
---|
1143 | {
|
---|
1144 | if (pcbStr)
|
---|
1145 | *pcbStr = u32;
|
---|
1146 | if (u32 < cbMax)
|
---|
1147 | {
|
---|
1148 | /* terminate and read string content. */
|
---|
1149 | psz[u32] = '\0';
|
---|
1150 | return tstDevSsmR3DataRead(pSSM, psz, u32);
|
---|
1151 | }
|
---|
1152 | return VERR_TOO_MUCH_DATA;
|
---|
1153 | }
|
---|
1154 | return rc;
|
---|
1155 | }
|
---|
1156 |
|
---|
1157 |
|
---|
1158 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetStrZ(PSSMHANDLE pSSM, char *psz, size_t cbMax)
|
---|
1159 | {
|
---|
1160 | return pdmR3DevHlp_SSMGetStrZEx(pSSM, psz, cbMax, NULL);
|
---|
1161 | }
|
---|
1162 |
|
---|
1163 |
|
---|
1164 | static DECLCALLBACK(int) pdmR3DevHlp_SSMSkip(PSSMHANDLE pSSM, size_t cb)
|
---|
1165 | {
|
---|
1166 | while (cb > 0)
|
---|
1167 | {
|
---|
1168 | uint8_t abBuf[8192];
|
---|
1169 | size_t cbCur = RT_MIN(sizeof(abBuf), cb);
|
---|
1170 | cb -= cbCur;
|
---|
1171 | int rc = tstDevSsmR3DataRead(pSSM, abBuf, cbCur);
|
---|
1172 | if (RT_FAILURE(rc))
|
---|
1173 | return rc;
|
---|
1174 | }
|
---|
1175 |
|
---|
1176 | return VINF_SUCCESS;
|
---|
1177 | }
|
---|
1178 |
|
---|
1179 |
|
---|
1180 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetStruct(PSSMHANDLE pSSM, void *pvStruct, PCSSMFIELD paFields)
|
---|
1181 | {
|
---|
1182 | AssertPtr(pvStruct);
|
---|
1183 | AssertPtr(paFields);
|
---|
1184 |
|
---|
1185 | /* begin marker. */
|
---|
1186 | uint32_t u32Magic;
|
---|
1187 | int rc = pdmR3DevHlp_SSMGetU32(pSSM, &u32Magic);
|
---|
1188 | if (RT_FAILURE(rc))
|
---|
1189 | return rc;
|
---|
1190 | AssertMsgReturn(u32Magic == SSMR3STRUCT_BEGIN, ("u32Magic=%#RX32\n", u32Magic), pSSM->rc = VERR_SSM_STRUCTURE_MAGIC);
|
---|
1191 |
|
---|
1192 | /* get the fields */
|
---|
1193 | for (PCSSMFIELD pCur = paFields;
|
---|
1194 | pCur->cb != UINT32_MAX && pCur->off != UINT32_MAX;
|
---|
1195 | pCur++)
|
---|
1196 | {
|
---|
1197 | if (pCur->uFirstVer <= pSSM->uCurUnitVer)
|
---|
1198 | {
|
---|
1199 | uint8_t *pbField = (uint8_t *)pvStruct + pCur->off;
|
---|
1200 | switch ((uintptr_t)pCur->pfnGetPutOrTransformer)
|
---|
1201 | {
|
---|
1202 | case SSMFIELDTRANS_NO_TRANSFORMATION:
|
---|
1203 | rc = tstDevSsmR3DataRead(pSSM, pbField, pCur->cb);
|
---|
1204 | break;
|
---|
1205 |
|
---|
1206 | case SSMFIELDTRANS_GCPTR:
|
---|
1207 | AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1208 | rc = pdmR3DevHlp_SSMGetGCPtr(pSSM, (PRTGCPTR)pbField);
|
---|
1209 | break;
|
---|
1210 |
|
---|
1211 | case SSMFIELDTRANS_GCPHYS:
|
---|
1212 | AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPHYS), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1213 | rc = pdmR3DevHlp_SSMGetGCPhys(pSSM, (PRTGCPHYS)pbField);
|
---|
1214 | break;
|
---|
1215 |
|
---|
1216 | case SSMFIELDTRANS_RCPTR:
|
---|
1217 | AssertMsgBreakStmt(pCur->cb == sizeof(RTRCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1218 | rc = pdmR3DevHlp_SSMGetRCPtr(pSSM, (PRTRCPTR)pbField);
|
---|
1219 | break;
|
---|
1220 |
|
---|
1221 | case SSMFIELDTRANS_RCPTR_ARRAY:
|
---|
1222 | {
|
---|
1223 | uint32_t const cEntries = pCur->cb / sizeof(RTRCPTR);
|
---|
1224 | AssertMsgBreakStmt(pCur->cb == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1225 | rc = VINF_SUCCESS;
|
---|
1226 | for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
|
---|
1227 | rc = pdmR3DevHlp_SSMGetRCPtr(pSSM, &((PRTRCPTR)pbField)[i]);
|
---|
1228 | break;
|
---|
1229 | }
|
---|
1230 |
|
---|
1231 | default:
|
---|
1232 | AssertMsgFailedBreakStmt(("%#x\n", pCur->pfnGetPutOrTransformer), rc = VERR_SSM_FIELD_COMPLEX);
|
---|
1233 | }
|
---|
1234 | if (RT_FAILURE(rc))
|
---|
1235 | {
|
---|
1236 | if (RT_SUCCESS(pSSM->rc))
|
---|
1237 | pSSM->rc = rc;
|
---|
1238 | return rc;
|
---|
1239 | }
|
---|
1240 | }
|
---|
1241 | }
|
---|
1242 |
|
---|
1243 | /* end marker */
|
---|
1244 | rc = pdmR3DevHlp_SSMGetU32(pSSM, &u32Magic);
|
---|
1245 | if (RT_FAILURE(rc))
|
---|
1246 | return rc;
|
---|
1247 | AssertMsgReturn(u32Magic == SSMR3STRUCT_END, ("u32Magic=%#RX32\n", u32Magic), pSSM->rc = VERR_SSM_STRUCTURE_MAGIC);
|
---|
1248 | return rc;
|
---|
1249 | }
|
---|
1250 |
|
---|
1251 |
|
---|
1252 | /**
|
---|
1253 | * SSMR3GetStructEx helper that gets a HCPTR that is used as a NULL indicator.
|
---|
1254 | *
|
---|
1255 | * @returns VBox status code.
|
---|
1256 | *
|
---|
1257 | * @param pSSM The saved state handle.
|
---|
1258 | * @param ppv Where to return the value (0/1).
|
---|
1259 | * @param fFlags SSMSTRUCT_FLAGS_XXX.
|
---|
1260 | */
|
---|
1261 | DECLINLINE(int) ssmR3GetHCPtrNI(PSSMHANDLE pSSM, void **ppv, uint32_t fFlags)
|
---|
1262 | {
|
---|
1263 | uintptr_t uPtrNI;
|
---|
1264 | if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
|
---|
1265 | {
|
---|
1266 | if (ssmR3GetHostBits(pSSM) == 64)
|
---|
1267 | {
|
---|
1268 | uint64_t u;
|
---|
1269 | int rc = tstDevSsmR3DataRead(pSSM, &u, sizeof(u));
|
---|
1270 | if (RT_FAILURE(rc))
|
---|
1271 | return rc;
|
---|
1272 | uPtrNI = u ? 1 : 0;
|
---|
1273 | }
|
---|
1274 | else
|
---|
1275 | {
|
---|
1276 | uint32_t u;
|
---|
1277 | int rc = tstDevSsmR3DataRead(pSSM, &u, sizeof(u));
|
---|
1278 | if (RT_FAILURE(rc))
|
---|
1279 | return rc;
|
---|
1280 | uPtrNI = u ? 1 : 0;
|
---|
1281 | }
|
---|
1282 | }
|
---|
1283 | else
|
---|
1284 | {
|
---|
1285 | bool f;
|
---|
1286 | int rc = pdmR3DevHlp_SSMGetBool(pSSM, &f);
|
---|
1287 | if (RT_FAILURE(rc))
|
---|
1288 | return rc;
|
---|
1289 | uPtrNI = f ? 1 : 0;
|
---|
1290 | }
|
---|
1291 | *ppv = (void *)uPtrNI;
|
---|
1292 | return VINF_SUCCESS;
|
---|
1293 | }
|
---|
1294 |
|
---|
1295 |
|
---|
1296 | static DECLCALLBACK(int) pdmR3DevHlp_SSMGetStructEx(PSSMHANDLE pSSM, void *pvStruct, size_t cbStruct, uint32_t fFlags, PCSSMFIELD paFields, void *pvUser)
|
---|
1297 | {
|
---|
1298 | int rc;
|
---|
1299 | uint32_t u32Magic;
|
---|
1300 |
|
---|
1301 | /*
|
---|
1302 | * Validation.
|
---|
1303 | */
|
---|
1304 | AssertMsgReturn(!(fFlags & ~SSMSTRUCT_FLAGS_VALID_MASK), ("%#x\n", fFlags), pSSM->rc = VERR_INVALID_PARAMETER);
|
---|
1305 | AssertPtr(pvStruct);
|
---|
1306 | AssertPtr(paFields);
|
---|
1307 |
|
---|
1308 | /*
|
---|
1309 | * Begin marker.
|
---|
1310 | */
|
---|
1311 | if (!(fFlags & (SSMSTRUCT_FLAGS_NO_MARKERS | SSMSTRUCT_FLAGS_NO_LEAD_MARKER)))
|
---|
1312 | {
|
---|
1313 | rc = pdmR3DevHlp_SSMGetU32(pSSM, &u32Magic);
|
---|
1314 | if (RT_FAILURE(rc))
|
---|
1315 | return rc;
|
---|
1316 | AssertMsgReturn(u32Magic == SSMR3STRUCT_BEGIN, ("u32Magic=%#RX32\n", u32Magic), pSSM->rc = VERR_SSM_STRUCTURE_MAGIC);
|
---|
1317 | }
|
---|
1318 |
|
---|
1319 | /*
|
---|
1320 | * Put the fields
|
---|
1321 | */
|
---|
1322 | rc = VINF_SUCCESS;
|
---|
1323 | uint32_t off = 0;
|
---|
1324 | for (PCSSMFIELD pCur = paFields;
|
---|
1325 | pCur->cb != UINT32_MAX && pCur->off != UINT32_MAX;
|
---|
1326 | pCur++)
|
---|
1327 | {
|
---|
1328 | uint32_t const offField = (!SSMFIELDTRANS_IS_PADDING(pCur->pfnGetPutOrTransformer) || pCur->off != UINT32_MAX / 2)
|
---|
1329 | && !SSMFIELDTRANS_IS_OLD(pCur->pfnGetPutOrTransformer)
|
---|
1330 | ? pCur->off
|
---|
1331 | : off;
|
---|
1332 | uint32_t const cbField = SSMFIELDTRANS_IS_OLD(pCur->pfnGetPutOrTransformer)
|
---|
1333 | ? 0
|
---|
1334 | : SSMFIELDTRANS_IS_PADDING(pCur->pfnGetPutOrTransformer)
|
---|
1335 | ? RT_HIWORD(pCur->cb)
|
---|
1336 | : pCur->cb;
|
---|
1337 | AssertMsgReturn( cbField <= cbStruct
|
---|
1338 | && offField + cbField <= cbStruct
|
---|
1339 | && offField + cbField >= offField,
|
---|
1340 | ("off=%#x cb=%#x cbStruct=%#x (%s)\n", cbField, offField, cbStruct, pCur->pszName),
|
---|
1341 | pSSM->rc = VERR_SSM_FIELD_OUT_OF_BOUNDS);
|
---|
1342 | AssertMsgReturn( !(fFlags & SSMSTRUCT_FLAGS_FULL_STRUCT)
|
---|
1343 | || off == offField,
|
---|
1344 | ("off=%#x offField=%#x (%s)\n", off, offField, pCur->pszName),
|
---|
1345 | pSSM->rc = VERR_SSM_FIELD_NOT_CONSECUTIVE);
|
---|
1346 |
|
---|
1347 | if (pCur->uFirstVer <= pSSM->uCurUnitVer)
|
---|
1348 | {
|
---|
1349 | rc = VINF_SUCCESS;
|
---|
1350 | uint8_t *pbField = (uint8_t *)pvStruct + offField;
|
---|
1351 | switch ((uintptr_t)pCur->pfnGetPutOrTransformer)
|
---|
1352 | {
|
---|
1353 | case SSMFIELDTRANS_NO_TRANSFORMATION:
|
---|
1354 | rc = tstDevSsmR3DataRead(pSSM, pbField, cbField);
|
---|
1355 | break;
|
---|
1356 |
|
---|
1357 | case SSMFIELDTRANS_GCPHYS:
|
---|
1358 | AssertMsgBreakStmt(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1359 | rc = pdmR3DevHlp_SSMGetGCPhys(pSSM, (PRTGCPHYS)pbField);
|
---|
1360 | break;
|
---|
1361 |
|
---|
1362 | case SSMFIELDTRANS_GCPTR:
|
---|
1363 | AssertMsgBreakStmt(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1364 | rc = pdmR3DevHlp_SSMGetGCPtr(pSSM, (PRTGCPTR)pbField);
|
---|
1365 | break;
|
---|
1366 |
|
---|
1367 | case SSMFIELDTRANS_RCPTR:
|
---|
1368 | AssertMsgBreakStmt(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1369 | rc = pdmR3DevHlp_SSMGetRCPtr(pSSM, (PRTRCPTR)pbField);
|
---|
1370 | break;
|
---|
1371 |
|
---|
1372 | case SSMFIELDTRANS_RCPTR_ARRAY:
|
---|
1373 | {
|
---|
1374 | uint32_t const cEntries = cbField / sizeof(RTRCPTR);
|
---|
1375 | AssertMsgBreakStmt(cbField == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1376 | rc = VINF_SUCCESS;
|
---|
1377 | for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
|
---|
1378 | rc = pdmR3DevHlp_SSMGetRCPtr(pSSM, &((PRTRCPTR)pbField)[i]);
|
---|
1379 | break;
|
---|
1380 | }
|
---|
1381 |
|
---|
1382 | case SSMFIELDTRANS_HCPTR_NI:
|
---|
1383 | AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1384 | rc = ssmR3GetHCPtrNI(pSSM, (void **)pbField, fFlags);
|
---|
1385 | break;
|
---|
1386 |
|
---|
1387 | case SSMFIELDTRANS_HCPTR_NI_ARRAY:
|
---|
1388 | {
|
---|
1389 | uint32_t const cEntries = cbField / sizeof(void *);
|
---|
1390 | AssertMsgBreakStmt(cbField == cEntries * sizeof(void *) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1391 | rc = VINF_SUCCESS;
|
---|
1392 | for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
|
---|
1393 | rc = ssmR3GetHCPtrNI(pSSM, &((void **)pbField)[i], fFlags);
|
---|
1394 | break;
|
---|
1395 | }
|
---|
1396 |
|
---|
1397 | case SSMFIELDTRANS_HCPTR_HACK_U32:
|
---|
1398 | AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1399 | *(uintptr_t *)pbField = 0;
|
---|
1400 | rc = tstDevSsmR3DataRead(pSSM, pbField, sizeof(uint32_t));
|
---|
1401 | if ((fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE) && ssmR3GetHostBits(pSSM) == 64)
|
---|
1402 | {
|
---|
1403 | uint32_t u32;
|
---|
1404 | rc = tstDevSsmR3DataRead(pSSM, &u32, sizeof(uint32_t));
|
---|
1405 | AssertMsgBreakStmt(RT_FAILURE(rc) || u32 == 0 || (fFlags & SSMSTRUCT_FLAGS_SAVED_AS_MEM),
|
---|
1406 | ("high=%#x low=%#x (%s)\n", u32, *(uint32_t *)pbField, pCur->pszName),
|
---|
1407 | rc = VERR_SSM_FIELD_INVALID_VALUE);
|
---|
1408 | }
|
---|
1409 | break;
|
---|
1410 |
|
---|
1411 | case SSMFIELDTRANS_U32_ZX_U64:
|
---|
1412 | AssertMsgBreakStmt(cbField == sizeof(uint64_t), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1413 | ((uint32_t *)pbField)[1] = 0;
|
---|
1414 | rc = pdmR3DevHlp_SSMGetU32(pSSM, (uint32_t *)pbField);
|
---|
1415 | break;
|
---|
1416 |
|
---|
1417 |
|
---|
1418 | case SSMFIELDTRANS_IGNORE:
|
---|
1419 | if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
|
---|
1420 | rc = pdmR3DevHlp_SSMSkip(pSSM, cbField);
|
---|
1421 | break;
|
---|
1422 |
|
---|
1423 | case SSMFIELDTRANS_IGN_GCPHYS:
|
---|
1424 | AssertMsgBreakStmt(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1425 | if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
|
---|
1426 | rc = pdmR3DevHlp_SSMSkip(pSSM, sizeof(RTGCPHYS));
|
---|
1427 | break;
|
---|
1428 |
|
---|
1429 | case SSMFIELDTRANS_IGN_GCPTR:
|
---|
1430 | AssertMsgBreakStmt(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1431 | if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
|
---|
1432 | rc = pdmR3DevHlp_SSMSkip(pSSM, sizeof(RTGCPTR));
|
---|
1433 | break;
|
---|
1434 |
|
---|
1435 | case SSMFIELDTRANS_IGN_RCPTR:
|
---|
1436 | AssertMsgBreakStmt(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1437 | if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
|
---|
1438 | rc = pdmR3DevHlp_SSMSkip(pSSM, sizeof(RTRCPTR));
|
---|
1439 | break;
|
---|
1440 |
|
---|
1441 | case SSMFIELDTRANS_IGN_HCPTR:
|
---|
1442 | AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1443 | if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
|
---|
1444 | rc = pdmR3DevHlp_SSMSkip(pSSM, ssmR3GetHostBits(pSSM) / 8);
|
---|
1445 | break;
|
---|
1446 |
|
---|
1447 |
|
---|
1448 | case SSMFIELDTRANS_OLD:
|
---|
1449 | AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1450 | rc = pdmR3DevHlp_SSMSkip(pSSM, pCur->cb);
|
---|
1451 | break;
|
---|
1452 |
|
---|
1453 | case SSMFIELDTRANS_OLD_GCPHYS:
|
---|
1454 | AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPHYS) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1455 | rc = pdmR3DevHlp_SSMSkip(pSSM, sizeof(RTGCPHYS));
|
---|
1456 | break;
|
---|
1457 |
|
---|
1458 | case SSMFIELDTRANS_OLD_GCPTR:
|
---|
1459 | AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1460 | rc = pdmR3DevHlp_SSMSkip(pSSM, sizeof(RTGCPTR));
|
---|
1461 | break;
|
---|
1462 |
|
---|
1463 | case SSMFIELDTRANS_OLD_RCPTR:
|
---|
1464 | AssertMsgBreakStmt(pCur->cb == sizeof(RTRCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1465 | rc = pdmR3DevHlp_SSMSkip(pSSM, sizeof(RTRCPTR));
|
---|
1466 | break;
|
---|
1467 |
|
---|
1468 | case SSMFIELDTRANS_OLD_HCPTR:
|
---|
1469 | AssertMsgBreakStmt(pCur->cb == sizeof(void *) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1470 | rc = pdmR3DevHlp_SSMSkip(pSSM, ssmR3GetHostBits(pSSM) / 8);
|
---|
1471 | break;
|
---|
1472 |
|
---|
1473 | case SSMFIELDTRANS_OLD_PAD_HC:
|
---|
1474 | AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1475 | rc = pdmR3DevHlp_SSMSkip(pSSM, ssmR3GetHostBits(pSSM) == 64 ? RT_HIWORD(pCur->cb) : RT_LOWORD(pCur->cb));
|
---|
1476 | break;
|
---|
1477 |
|
---|
1478 | case SSMFIELDTRANS_OLD_PAD_MSC32:
|
---|
1479 | AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
|
---|
1480 | if (ssmR3IsHostMsc32(pSSM))
|
---|
1481 | rc = pdmR3DevHlp_SSMSkip(pSSM, pCur->cb);
|
---|
1482 | break;
|
---|
1483 |
|
---|
1484 |
|
---|
1485 | case SSMFIELDTRANS_PAD_HC:
|
---|
1486 | case SSMFIELDTRANS_PAD_HC32:
|
---|
1487 | case SSMFIELDTRANS_PAD_HC64:
|
---|
1488 | case SSMFIELDTRANS_PAD_HC_AUTO:
|
---|
1489 | case SSMFIELDTRANS_PAD_MSC32_AUTO:
|
---|
1490 | {
|
---|
1491 | uint32_t cb32 = RT_BYTE1(pCur->cb);
|
---|
1492 | uint32_t cb64 = RT_BYTE2(pCur->cb);
|
---|
1493 | uint32_t cbCtx = HC_ARCH_BITS == 64
|
---|
1494 | || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
|
---|
1495 | ? cb64 : cb32;
|
---|
1496 | uint32_t cbSaved = ssmR3GetHostBits(pSSM) == 64
|
---|
1497 | || ( (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
|
---|
1498 | && !ssmR3IsHostMsc32(pSSM))
|
---|
1499 | ? cb64 : cb32;
|
---|
1500 | AssertMsgBreakStmt( cbField == cbCtx
|
---|
1501 | && ( ( pCur->off == UINT32_MAX / 2
|
---|
1502 | && ( cbField == 0
|
---|
1503 | || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_HC_AUTO
|
---|
1504 | || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
|
---|
1505 | )
|
---|
1506 | )
|
---|
1507 | || (pCur->off != UINT32_MAX / 2 && cbField != 0)
|
---|
1508 | )
|
---|
1509 | , ("cbField=%#x cb32=%#x cb64=%#x HC_ARCH_BITS=%u cbCtx=%#x cbSaved=%#x off=%#x\n",
|
---|
1510 | cbField, cb32, cb64, HC_ARCH_BITS, cbCtx, cbSaved, pCur->off),
|
---|
1511 | rc = VERR_SSM_FIELD_INVALID_PADDING_SIZE);
|
---|
1512 | if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
|
---|
1513 | rc = pdmR3DevHlp_SSMSkip(pSSM, cbSaved);
|
---|
1514 | break;
|
---|
1515 | }
|
---|
1516 |
|
---|
1517 | default:
|
---|
1518 | AssertBreakStmt(pCur->pfnGetPutOrTransformer, rc = VERR_SSM_FIELD_INVALID_CALLBACK);
|
---|
1519 | rc = pCur->pfnGetPutOrTransformer(pSSM, pCur, pvStruct, fFlags, true /*fGetOrPut*/, pvUser);
|
---|
1520 | break;
|
---|
1521 | }
|
---|
1522 | if (RT_FAILURE(rc))
|
---|
1523 | break;
|
---|
1524 | }
|
---|
1525 |
|
---|
1526 | off = offField + cbField;
|
---|
1527 | }
|
---|
1528 |
|
---|
1529 | if (RT_SUCCESS(rc))
|
---|
1530 | AssertMsgStmt( !(fFlags & SSMSTRUCT_FLAGS_FULL_STRUCT)
|
---|
1531 | || off == cbStruct,
|
---|
1532 | ("off=%#x cbStruct=%#x\n", off, cbStruct),
|
---|
1533 | rc = VERR_SSM_FIELD_NOT_CONSECUTIVE);
|
---|
1534 |
|
---|
1535 | if (RT_FAILURE(rc))
|
---|
1536 | {
|
---|
1537 | if (RT_SUCCESS(pSSM->rc))
|
---|
1538 | pSSM->rc = rc;
|
---|
1539 | return rc;
|
---|
1540 | }
|
---|
1541 |
|
---|
1542 | /*
|
---|
1543 | * End marker
|
---|
1544 | */
|
---|
1545 | if (!(fFlags & (SSMSTRUCT_FLAGS_NO_MARKERS | SSMSTRUCT_FLAGS_NO_TAIL_MARKER)))
|
---|
1546 | {
|
---|
1547 | rc = pdmR3DevHlp_SSMGetU32(pSSM, &u32Magic);
|
---|
1548 | if (RT_FAILURE(rc))
|
---|
1549 | return rc;
|
---|
1550 | AssertMsgReturn(u32Magic == SSMR3STRUCT_END, ("u32Magic=%#RX32\n", u32Magic), pSSM->rc = VERR_SSM_STRUCTURE_MAGIC);
|
---|
1551 | }
|
---|
1552 |
|
---|
1553 | return VINF_SUCCESS;
|
---|
1554 | }
|
---|
1555 |
|
---|
1556 |
|
---|
1557 | static DECLCALLBACK(int) pdmR3DevHlp_SSMSkipToEndOfUnit(PSSMHANDLE pSSM)
|
---|
1558 | {
|
---|
1559 | RT_NOREF(pSSM);
|
---|
1560 | AssertFailed();
|
---|
1561 | return VERR_NOT_IMPLEMENTED;
|
---|
1562 | }
|
---|
1563 |
|
---|
1564 |
|
---|
1565 | static DECLCALLBACK(int) pdmR3DevHlp_SSMSetLoadError(PSSMHANDLE pSSM, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(6, 7)
|
---|
1566 | {
|
---|
1567 | RT_NOREF(pSSM, rc, RT_SRC_POS_ARGS, pszFormat);
|
---|
1568 | AssertFailed();
|
---|
1569 | return VERR_NOT_IMPLEMENTED;
|
---|
1570 | }
|
---|
1571 |
|
---|
1572 |
|
---|
1573 | static DECLCALLBACK(int) pdmR3DevHlp_SSMSetLoadErrorV(PSSMHANDLE pSSM, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(6, 0)
|
---|
1574 | {
|
---|
1575 | RT_NOREF(pSSM, rc, RT_SRC_POS_ARGS, pszFormat, va);
|
---|
1576 | AssertFailed();
|
---|
1577 | return VERR_NOT_IMPLEMENTED;
|
---|
1578 | }
|
---|
1579 |
|
---|
1580 |
|
---|
1581 | static DECLCALLBACK(int) pdmR3DevHlp_SSMSetCfgError(PSSMHANDLE pSSM, RT_SRC_POS_DECL, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(5, 6)
|
---|
1582 | {
|
---|
1583 | RT_NOREF(pSSM, RT_SRC_POS_ARGS, pszFormat);
|
---|
1584 | pSSM->rc = VERR_SSM_LOAD_CONFIG_MISMATCH;
|
---|
1585 | return pSSM->rc;
|
---|
1586 | }
|
---|
1587 |
|
---|
1588 |
|
---|
1589 | static DECLCALLBACK(int) pdmR3DevHlp_SSMSetCfgErrorV(PSSMHANDLE pSSM, RT_SRC_POS_DECL, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(5, 0)
|
---|
1590 | {
|
---|
1591 | RT_NOREF(pSSM, RT_SRC_POS_ARGS, pszFormat, va);
|
---|
1592 | pSSM->rc = VERR_SSM_LOAD_CONFIG_MISMATCH;
|
---|
1593 | return pSSM->rc;
|
---|
1594 | }
|
---|
1595 |
|
---|
1596 |
|
---|
1597 | static DECLCALLBACK(int) pdmR3DevHlp_SSMHandleGetStatus(PSSMHANDLE pSSM)
|
---|
1598 | {
|
---|
1599 | RT_NOREF(pSSM);
|
---|
1600 | return pSSM->rc;
|
---|
1601 | }
|
---|
1602 |
|
---|
1603 |
|
---|
1604 | static DECLCALLBACK(SSMAFTER) pdmR3DevHlp_SSMHandleGetAfter(PSSMHANDLE pSSM)
|
---|
1605 | {
|
---|
1606 | RT_NOREF(pSSM);
|
---|
1607 | AssertFailed();
|
---|
1608 | return SSMAFTER_INVALID;
|
---|
1609 | }
|
---|
1610 |
|
---|
1611 |
|
---|
1612 | static DECLCALLBACK(bool) pdmR3DevHlp_SSMHandleIsLiveSave(PSSMHANDLE pSSM)
|
---|
1613 | {
|
---|
1614 | RT_NOREF(pSSM);
|
---|
1615 | AssertFailed();
|
---|
1616 | return false;
|
---|
1617 | }
|
---|
1618 |
|
---|
1619 |
|
---|
1620 | static DECLCALLBACK(uint32_t) pdmR3DevHlp_SSMHandleMaxDowntime(PSSMHANDLE pSSM)
|
---|
1621 | {
|
---|
1622 | RT_NOREF(pSSM);
|
---|
1623 | AssertFailed();
|
---|
1624 | return 0;
|
---|
1625 | }
|
---|
1626 |
|
---|
1627 |
|
---|
1628 | static DECLCALLBACK(uint32_t) pdmR3DevHlp_SSMHandleHostBits(PSSMHANDLE pSSM)
|
---|
1629 | {
|
---|
1630 | RT_NOREF(pSSM);
|
---|
1631 | AssertFailed();
|
---|
1632 | return 0;
|
---|
1633 | }
|
---|
1634 |
|
---|
1635 |
|
---|
1636 | static DECLCALLBACK(uint32_t) pdmR3DevHlp_SSMHandleRevision(PSSMHANDLE pSSM)
|
---|
1637 | {
|
---|
1638 | RT_NOREF(pSSM);
|
---|
1639 | AssertFailed();
|
---|
1640 | return 0;
|
---|
1641 | }
|
---|
1642 |
|
---|
1643 |
|
---|
1644 | static DECLCALLBACK(uint32_t) pdmR3DevHlp_SSMHandleVersion(PSSMHANDLE pSSM)
|
---|
1645 | {
|
---|
1646 | RT_NOREF(pSSM);
|
---|
1647 | AssertFailed();
|
---|
1648 | return 0;
|
---|
1649 | }
|
---|
1650 |
|
---|
1651 |
|
---|
1652 | static DECLCALLBACK(const char *) pdmR3DevHlp_SSMHandleHostOSAndArch(PSSMHANDLE pSSM)
|
---|
1653 | {
|
---|
1654 | RT_NOREF(pSSM);
|
---|
1655 | AssertFailed();
|
---|
1656 | return NULL;
|
---|
1657 | }
|
---|
1658 |
|
---|
1659 |
|
---|
1660 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerCreate} */
|
---|
1661 | static DECLCALLBACK(int) pdmR3DevHlp_TimerCreate(PPDMDEVINS pDevIns, TMCLOCK enmClock, PFNTMTIMERDEV pfnCallback,
|
---|
1662 | void *pvUser, uint32_t fFlags, const char *pszDesc, PTMTIMERHANDLE phTimer)
|
---|
1663 | {
|
---|
1664 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
1665 | LogFlow(("pdmR3DevHlp_TimerCreate: caller='%s'/%d: enmClock=%d pfnCallback=%p pvUser=%p fFlags=%#x pszDesc=%p:{%s} phTimer=%p\n",
|
---|
1666 | pDevIns->pReg->szName, pDevIns->iInstance, enmClock, pfnCallback, pvUser, fFlags, pszDesc, pszDesc, phTimer));
|
---|
1667 |
|
---|
1668 | int rc = VINF_SUCCESS;
|
---|
1669 | PTMTIMERR3 pTimer = (PTMTIMERR3)RTMemAllocZ(sizeof(TMTIMER));
|
---|
1670 | if (RT_LIKELY(pTimer))
|
---|
1671 | {
|
---|
1672 | pTimer->enmClock = enmClock;
|
---|
1673 | pTimer->pfnCallbackDev = pfnCallback;
|
---|
1674 | pTimer->pvUser = pvUser;
|
---|
1675 | pTimer->fFlags = fFlags;
|
---|
1676 | RTListAppend(&pDevIns->Internal.s.pDut->LstTimers, &pTimer->NdDevTimers);
|
---|
1677 | *phTimer = (TMTIMERHANDLE)pTimer;
|
---|
1678 | }
|
---|
1679 | else
|
---|
1680 | rc = VERR_NO_MEMORY;
|
---|
1681 |
|
---|
1682 | LogFlow(("pdmR3DevHlp_TimerCreate: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
1683 | return rc;
|
---|
1684 | }
|
---|
1685 |
|
---|
1686 |
|
---|
1687 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerFromMicro} */
|
---|
1688 | static DECLCALLBACK(uint64_t) pdmR3DevHlp_TimerFromMicro(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cMicroSecs)
|
---|
1689 | {
|
---|
1690 | RT_NOREF(pDevIns, hTimer, cMicroSecs);
|
---|
1691 | AssertFailed();
|
---|
1692 | return 0;
|
---|
1693 | }
|
---|
1694 |
|
---|
1695 |
|
---|
1696 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerFromMilli} */
|
---|
1697 | static DECLCALLBACK(uint64_t) pdmR3DevHlp_TimerFromMilli(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cMilliSecs)
|
---|
1698 | {
|
---|
1699 | RT_NOREF(pDevIns, hTimer, cMilliSecs);
|
---|
1700 | AssertFailed();
|
---|
1701 | return 0;
|
---|
1702 | }
|
---|
1703 |
|
---|
1704 |
|
---|
1705 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerFromNano} */
|
---|
1706 | static DECLCALLBACK(uint64_t) pdmR3DevHlp_TimerFromNano(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cNanoSecs)
|
---|
1707 | {
|
---|
1708 | RT_NOREF(pDevIns, hTimer, cNanoSecs);
|
---|
1709 | AssertFailed();
|
---|
1710 | return 0;
|
---|
1711 | }
|
---|
1712 |
|
---|
1713 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerGet} */
|
---|
1714 | static DECLCALLBACK(uint64_t) pdmR3DevHlp_TimerGet(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
|
---|
1715 | {
|
---|
1716 | RT_NOREF(pDevIns, hTimer);
|
---|
1717 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
1718 | AssertFailed();
|
---|
1719 | return 0;
|
---|
1720 | #else
|
---|
1721 | static uint64_t cCnt = 0;
|
---|
1722 | return cCnt++;
|
---|
1723 | #endif
|
---|
1724 | }
|
---|
1725 |
|
---|
1726 |
|
---|
1727 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerGetFreq} */
|
---|
1728 | static DECLCALLBACK(uint64_t) pdmR3DevHlp_TimerGetFreq(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
|
---|
1729 | {
|
---|
1730 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
1731 |
|
---|
1732 | PTMTIMERR3 pTimer = (PTMTIMERR3)hTimer;
|
---|
1733 | switch (pTimer->enmClock)
|
---|
1734 | {
|
---|
1735 | case TMCLOCK_VIRTUAL:
|
---|
1736 | case TMCLOCK_VIRTUAL_SYNC:
|
---|
1737 | return TMCLOCK_FREQ_VIRTUAL;
|
---|
1738 |
|
---|
1739 | case TMCLOCK_REAL:
|
---|
1740 | return TMCLOCK_FREQ_REAL;
|
---|
1741 |
|
---|
1742 | default:
|
---|
1743 | AssertMsgFailed(("Invalid enmClock=%d\n", pTimer->enmClock));
|
---|
1744 | return 0;
|
---|
1745 | }
|
---|
1746 | }
|
---|
1747 |
|
---|
1748 |
|
---|
1749 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerGetNano} */
|
---|
1750 | static DECLCALLBACK(uint64_t) pdmR3DevHlp_TimerGetNano(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
|
---|
1751 | {
|
---|
1752 | RT_NOREF(pDevIns, hTimer);
|
---|
1753 | AssertFailed();
|
---|
1754 | return 0;
|
---|
1755 | }
|
---|
1756 |
|
---|
1757 |
|
---|
1758 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerIsActive} */
|
---|
1759 | static DECLCALLBACK(bool) pdmR3DevHlp_TimerIsActive(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
|
---|
1760 | {
|
---|
1761 | RT_NOREF(pDevIns, hTimer);
|
---|
1762 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
1763 | AssertFailed();
|
---|
1764 | return false;
|
---|
1765 | #else
|
---|
1766 | return true;
|
---|
1767 | #endif
|
---|
1768 | }
|
---|
1769 |
|
---|
1770 |
|
---|
1771 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerIsLockOwner} */
|
---|
1772 | static DECLCALLBACK(bool) pdmR3DevHlp_TimerIsLockOwner(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
|
---|
1773 | {
|
---|
1774 | RT_NOREF(pDevIns, hTimer);
|
---|
1775 | AssertFailed();
|
---|
1776 | return false;
|
---|
1777 | }
|
---|
1778 |
|
---|
1779 |
|
---|
1780 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerLockClock} */
|
---|
1781 | static DECLCALLBACK(VBOXSTRICTRC) pdmR3DevHlp_TimerLockClock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, int rcBusy)
|
---|
1782 | {
|
---|
1783 | RT_NOREF(pDevIns, hTimer, rcBusy);
|
---|
1784 |
|
---|
1785 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
1786 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
1787 | AssertFailed();
|
---|
1788 | #else
|
---|
1789 | int rc = VINF_SUCCESS;
|
---|
1790 | #endif
|
---|
1791 | return rc;
|
---|
1792 | }
|
---|
1793 |
|
---|
1794 |
|
---|
1795 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerLockClock2} */
|
---|
1796 | static DECLCALLBACK(VBOXSTRICTRC) pdmR3DevHlp_TimerLockClock2(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer,
|
---|
1797 | PPDMCRITSECT pCritSect, int rcBusy)
|
---|
1798 | {
|
---|
1799 | RT_NOREF(pDevIns, hTimer, pCritSect, rcBusy);
|
---|
1800 |
|
---|
1801 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
1802 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
1803 | AssertFailed();
|
---|
1804 | #else
|
---|
1805 | int rc = VINF_SUCCESS;
|
---|
1806 | #endif
|
---|
1807 | return rc;
|
---|
1808 | }
|
---|
1809 |
|
---|
1810 |
|
---|
1811 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerSet} */
|
---|
1812 | static DECLCALLBACK(int) pdmR3DevHlp_TimerSet(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t uExpire)
|
---|
1813 | {
|
---|
1814 | RT_NOREF(pDevIns, hTimer, uExpire);
|
---|
1815 |
|
---|
1816 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
1817 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
1818 | AssertFailed();
|
---|
1819 | #else
|
---|
1820 | int rc = VINF_SUCCESS;
|
---|
1821 | #endif
|
---|
1822 |
|
---|
1823 | return rc;
|
---|
1824 | }
|
---|
1825 |
|
---|
1826 |
|
---|
1827 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerSetFrequencyHint} */
|
---|
1828 | static DECLCALLBACK(int) pdmR3DevHlp_TimerSetFrequencyHint(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint32_t uHz)
|
---|
1829 | {
|
---|
1830 | RT_NOREF(pDevIns, hTimer, uHz);
|
---|
1831 |
|
---|
1832 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
1833 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
1834 | AssertFailed();
|
---|
1835 | #else
|
---|
1836 | int rc = VINF_SUCCESS;
|
---|
1837 | #endif
|
---|
1838 |
|
---|
1839 | return rc;
|
---|
1840 | }
|
---|
1841 |
|
---|
1842 |
|
---|
1843 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerSetMicro} */
|
---|
1844 | static DECLCALLBACK(int) pdmR3DevHlp_TimerSetMicro(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cMicrosToNext)
|
---|
1845 | {
|
---|
1846 | RT_NOREF(pDevIns, hTimer, cMicrosToNext);
|
---|
1847 |
|
---|
1848 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
1849 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
1850 | AssertFailed();
|
---|
1851 | #else
|
---|
1852 | int rc = VINF_SUCCESS;
|
---|
1853 | #endif
|
---|
1854 | return rc;
|
---|
1855 | }
|
---|
1856 |
|
---|
1857 |
|
---|
1858 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerSetMillies} */
|
---|
1859 | static DECLCALLBACK(int) pdmR3DevHlp_TimerSetMillies(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cMilliesToNext)
|
---|
1860 | {
|
---|
1861 | RT_NOREF(pDevIns, hTimer, cMilliesToNext);
|
---|
1862 |
|
---|
1863 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
1864 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
1865 | AssertFailed();
|
---|
1866 | #else
|
---|
1867 | int rc = VINF_SUCCESS;
|
---|
1868 | #endif
|
---|
1869 | return rc;
|
---|
1870 | }
|
---|
1871 |
|
---|
1872 |
|
---|
1873 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerSetNano} */
|
---|
1874 | static DECLCALLBACK(int) pdmR3DevHlp_TimerSetNano(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cNanosToNext)
|
---|
1875 | {
|
---|
1876 | RT_NOREF(pDevIns, hTimer, cNanosToNext);
|
---|
1877 |
|
---|
1878 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
1879 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
1880 | AssertFailed();
|
---|
1881 | #else
|
---|
1882 | int rc = VINF_SUCCESS;
|
---|
1883 | #endif
|
---|
1884 |
|
---|
1885 | return rc;
|
---|
1886 | }
|
---|
1887 |
|
---|
1888 |
|
---|
1889 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerSetRelative} */
|
---|
1890 | static DECLCALLBACK(int) pdmR3DevHlp_TimerSetRelative(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cTicksToNext, uint64_t *pu64Now)
|
---|
1891 | {
|
---|
1892 | RT_NOREF(pDevIns, hTimer, cTicksToNext, pu64Now);
|
---|
1893 |
|
---|
1894 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
1895 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
1896 | AssertFailed();
|
---|
1897 | #else
|
---|
1898 | int rc = VINF_SUCCESS;
|
---|
1899 | #endif
|
---|
1900 |
|
---|
1901 | return rc;
|
---|
1902 | }
|
---|
1903 |
|
---|
1904 |
|
---|
1905 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerStop} */
|
---|
1906 | static DECLCALLBACK(int) pdmR3DevHlp_TimerStop(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
|
---|
1907 | {
|
---|
1908 | RT_NOREF(pDevIns, hTimer);
|
---|
1909 |
|
---|
1910 | #if 1 /** @todo */
|
---|
1911 | int rc = VINF_SUCCESS;
|
---|
1912 | #else
|
---|
1913 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
1914 | AssertFailed();
|
---|
1915 | #endif
|
---|
1916 |
|
---|
1917 | return rc;
|
---|
1918 | }
|
---|
1919 |
|
---|
1920 |
|
---|
1921 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerUnlockClock} */
|
---|
1922 | static DECLCALLBACK(void) pdmR3DevHlp_TimerUnlockClock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
|
---|
1923 | {
|
---|
1924 | RT_NOREF(pDevIns, hTimer);
|
---|
1925 | AssertFailed();
|
---|
1926 | }
|
---|
1927 |
|
---|
1928 |
|
---|
1929 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerUnlockClock2} */
|
---|
1930 | static DECLCALLBACK(void) pdmR3DevHlp_TimerUnlockClock2(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect)
|
---|
1931 | {
|
---|
1932 | RT_NOREF(pDevIns, hTimer, pCritSect);
|
---|
1933 | AssertFailed();
|
---|
1934 | }
|
---|
1935 |
|
---|
1936 |
|
---|
1937 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerSetCritSect} */
|
---|
1938 | static DECLCALLBACK(int) pdmR3DevHlp_TimerSetCritSect(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect)
|
---|
1939 | {
|
---|
1940 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
1941 |
|
---|
1942 | PTMTIMERR3 pTimer = (PTMTIMERR3)hTimer;
|
---|
1943 | pTimer->pCritSect = pCritSect;
|
---|
1944 | return VINF_SUCCESS;
|
---|
1945 | }
|
---|
1946 |
|
---|
1947 |
|
---|
1948 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerSave} */
|
---|
1949 | static DECLCALLBACK(int) pdmR3DevHlp_TimerSave(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, PSSMHANDLE pSSM)
|
---|
1950 | {
|
---|
1951 | RT_NOREF(pDevIns, hTimer, pSSM);
|
---|
1952 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
1953 | AssertFailed();
|
---|
1954 | return rc;
|
---|
1955 | }
|
---|
1956 |
|
---|
1957 |
|
---|
1958 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerLoad} */
|
---|
1959 | static DECLCALLBACK(int) pdmR3DevHlp_TimerLoad(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, PSSMHANDLE pSSM)
|
---|
1960 | {
|
---|
1961 | RT_NOREF(pDevIns, hTimer);
|
---|
1962 |
|
---|
1963 | /** @name Saved state values (comes directly from TM.cpp)
|
---|
1964 | * @{ */
|
---|
1965 | #define TMTIMERSTATE_SAVED_PENDING_STOP 4
|
---|
1966 | #define TMTIMERSTATE_SAVED_PENDING_SCHEDULE 7
|
---|
1967 | /** @} */
|
---|
1968 |
|
---|
1969 | /*
|
---|
1970 | * Load the state and validate it.
|
---|
1971 | */
|
---|
1972 | uint8_t u8State;
|
---|
1973 | int rc = pdmR3DevHlp_SSMGetU8(pSSM, &u8State);
|
---|
1974 | if (RT_FAILURE(rc))
|
---|
1975 | return rc;
|
---|
1976 |
|
---|
1977 | /* TMTIMERSTATE_SAVED_XXX: Workaround for accidental state shift in r47786 (2009-05-26 19:12:12). */
|
---|
1978 | if ( u8State == TMTIMERSTATE_SAVED_PENDING_STOP + 1
|
---|
1979 | || u8State == TMTIMERSTATE_SAVED_PENDING_SCHEDULE + 1)
|
---|
1980 | u8State--;
|
---|
1981 |
|
---|
1982 | if ( u8State != TMTIMERSTATE_SAVED_PENDING_STOP
|
---|
1983 | && u8State != TMTIMERSTATE_SAVED_PENDING_SCHEDULE)
|
---|
1984 | {
|
---|
1985 | /*AssertLogRelMsgFailed(("u8State=%d\n", u8State));*/
|
---|
1986 | return VERR_TM_LOAD_STATE;
|
---|
1987 | }
|
---|
1988 |
|
---|
1989 | if (u8State == TMTIMERSTATE_SAVED_PENDING_SCHEDULE)
|
---|
1990 | {
|
---|
1991 | /*
|
---|
1992 | * Load the expire time.
|
---|
1993 | */
|
---|
1994 | uint64_t u64Expire;
|
---|
1995 | rc = pdmR3DevHlp_SSMGetU64(pSSM, &u64Expire);
|
---|
1996 | if (RT_FAILURE(rc))
|
---|
1997 | return rc;
|
---|
1998 |
|
---|
1999 | /*
|
---|
2000 | * Set it.
|
---|
2001 | */
|
---|
2002 | Log(("u8State=%d u64Expire=%llu\n", u8State, u64Expire));
|
---|
2003 | }
|
---|
2004 |
|
---|
2005 | return VINF_SUCCESS;
|
---|
2006 | }
|
---|
2007 |
|
---|
2008 |
|
---|
2009 | /** @interface_method_impl{PDMDEVHLPR3,pfnTimerDestroy} */
|
---|
2010 | static DECLCALLBACK(int) pdmR3DevHlp_TimerDestroy(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
|
---|
2011 | {
|
---|
2012 | RT_NOREF(pDevIns, hTimer);
|
---|
2013 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
2014 | AssertFailed();
|
---|
2015 | return rc;
|
---|
2016 | }
|
---|
2017 |
|
---|
2018 |
|
---|
2019 | static DECLCALLBACK(int) pdmR3DevHlp_TimerSkipLoad(PSSMHANDLE pSSM, bool *pfActive)
|
---|
2020 | {
|
---|
2021 | RT_NOREF(pSSM, pfActive);
|
---|
2022 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
2023 | AssertFailed();
|
---|
2024 | return rc;
|
---|
2025 | }
|
---|
2026 |
|
---|
2027 |
|
---|
2028 | /** @interface_method_impl{PDMDEVHLPR3,pfnTMUtcNow} */
|
---|
2029 | static DECLCALLBACK(PRTTIMESPEC) pdmR3DevHlp_TMUtcNow(PPDMDEVINS pDevIns, PRTTIMESPEC pTime)
|
---|
2030 | {
|
---|
2031 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
2032 | LogFlow(("pdmR3DevHlp_TMUtcNow: caller='%s'/%d: pTime=%p\n",
|
---|
2033 | pDevIns->pReg->szName, pDevIns->iInstance, pTime));
|
---|
2034 |
|
---|
2035 | RT_NOREF(pDevIns, pTime);
|
---|
2036 | AssertFailed();
|
---|
2037 |
|
---|
2038 | LogFlow(("pdmR3DevHlp_TMUtcNow: caller='%s'/%d: returns %RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, RTTimeSpecGetNano(pTime)));
|
---|
2039 | return pTime;
|
---|
2040 | }
|
---|
2041 |
|
---|
2042 |
|
---|
2043 | static DECLCALLBACK(bool) pdmR3DevHlp_CFGMExists(PCFGMNODE pNode, const char *pszName)
|
---|
2044 | {
|
---|
2045 | RT_NOREF(pNode, pszName);
|
---|
2046 | AssertFailed();
|
---|
2047 | return false;
|
---|
2048 | }
|
---|
2049 |
|
---|
2050 |
|
---|
2051 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryType(PCFGMNODE pNode, const char *pszName, PCFGMVALUETYPE penmType)
|
---|
2052 | {
|
---|
2053 | RT_NOREF(pNode, pszName, penmType);
|
---|
2054 | AssertFailed();
|
---|
2055 | return VERR_NOT_IMPLEMENTED;
|
---|
2056 | }
|
---|
2057 |
|
---|
2058 |
|
---|
2059 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQuerySize(PCFGMNODE pNode, const char *pszName, size_t *pcb)
|
---|
2060 | {
|
---|
2061 | if (!pNode)
|
---|
2062 | return VERR_CFGM_NO_PARENT;
|
---|
2063 |
|
---|
2064 | PCTSTDEVCFGITEM pCfgItem;
|
---|
2065 | int rc = tstDev_CfgmR3ResolveItem(pNode->pDut->pTest->paCfgItems, pNode->pDut->pTest->cCfgItems, pszName, &pCfgItem);
|
---|
2066 | if (RT_SUCCESS(rc))
|
---|
2067 | {
|
---|
2068 | switch (pCfgItem->enmType)
|
---|
2069 | {
|
---|
2070 | case TSTDEVCFGITEMTYPE_INTEGER:
|
---|
2071 | *pcb = sizeof(uint64_t);
|
---|
2072 | break;
|
---|
2073 |
|
---|
2074 | case TSTDEVCFGITEMTYPE_STRING:
|
---|
2075 | *pcb = strlen(pCfgItem->u.psz) + 1;
|
---|
2076 | break;
|
---|
2077 |
|
---|
2078 | case TSTDEVCFGITEMTYPE_BYTES:
|
---|
2079 | AssertFailed();
|
---|
2080 | break;
|
---|
2081 |
|
---|
2082 | default:
|
---|
2083 | rc = VERR_CFGM_IPE_1;
|
---|
2084 | AssertMsgFailed(("Invalid value type %d\n", pCfgItem->enmType));
|
---|
2085 | break;
|
---|
2086 | }
|
---|
2087 | }
|
---|
2088 | return rc;
|
---|
2089 | }
|
---|
2090 |
|
---|
2091 |
|
---|
2092 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryInteger(PCFGMNODE pNode, const char *pszName, uint64_t *pu64)
|
---|
2093 | {
|
---|
2094 | if (!pNode)
|
---|
2095 | return VERR_CFGM_NO_PARENT;
|
---|
2096 |
|
---|
2097 | PCTSTDEVCFGITEM pCfgItem;
|
---|
2098 | int rc = tstDev_CfgmR3ResolveItem(pNode->pDut->pTest->paCfgItems, pNode->pDut->pTest->cCfgItems, pszName, &pCfgItem);
|
---|
2099 | if (RT_SUCCESS(rc))
|
---|
2100 | {
|
---|
2101 | if (pCfgItem->enmType == TSTDEVCFGITEMTYPE_INTEGER)
|
---|
2102 | *pu64 = (uint64_t)pCfgItem->u.i64;
|
---|
2103 | else
|
---|
2104 | rc = VERR_CFGM_NOT_INTEGER;
|
---|
2105 | }
|
---|
2106 |
|
---|
2107 | return rc;
|
---|
2108 | }
|
---|
2109 |
|
---|
2110 |
|
---|
2111 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryIntegerDef(PCFGMNODE pNode, const char *pszName, uint64_t *pu64, uint64_t u64Def)
|
---|
2112 | {
|
---|
2113 | int rc = pdmR3DevHlp_CFGMQueryInteger(pNode, pszName, pu64);
|
---|
2114 | if (RT_FAILURE(rc))
|
---|
2115 | {
|
---|
2116 | *pu64 = u64Def;
|
---|
2117 | if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT)
|
---|
2118 | rc = VINF_SUCCESS;
|
---|
2119 | }
|
---|
2120 |
|
---|
2121 | return rc;
|
---|
2122 | }
|
---|
2123 |
|
---|
2124 |
|
---|
2125 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryString(PCFGMNODE pNode, const char *pszName, char *pszString, size_t cchString)
|
---|
2126 | {
|
---|
2127 | if (!pNode)
|
---|
2128 | return VERR_CFGM_NO_PARENT;
|
---|
2129 |
|
---|
2130 | PCTSTDEVCFGITEM pCfgItem;
|
---|
2131 | int rc = tstDev_CfgmR3ResolveItem(pNode->pDut->pTest->paCfgItems, pNode->pDut->pTest->cCfgItems, pszName, &pCfgItem);
|
---|
2132 | if (RT_SUCCESS(rc))
|
---|
2133 | {
|
---|
2134 | switch (pCfgItem->enmType)
|
---|
2135 | {
|
---|
2136 | case TSTDEVCFGITEMTYPE_STRING:
|
---|
2137 | {
|
---|
2138 | size_t cchVal = strlen(pCfgItem->u.psz);
|
---|
2139 | if (cchString <= cchVal + 1)
|
---|
2140 | memcpy(pszString, pCfgItem->u.psz, cchVal);
|
---|
2141 | else
|
---|
2142 | rc = VERR_CFGM_NOT_ENOUGH_SPACE;
|
---|
2143 | break;
|
---|
2144 | }
|
---|
2145 | case TSTDEVCFGITEMTYPE_INTEGER:
|
---|
2146 | case TSTDEVCFGITEMTYPE_BYTES:
|
---|
2147 | default:
|
---|
2148 | rc = VERR_CFGM_IPE_1;
|
---|
2149 | AssertMsgFailed(("Invalid value type %d\n", pCfgItem->enmType));
|
---|
2150 | break;
|
---|
2151 | }
|
---|
2152 | }
|
---|
2153 | else
|
---|
2154 | rc = VERR_CFGM_VALUE_NOT_FOUND;
|
---|
2155 |
|
---|
2156 | return rc;
|
---|
2157 | }
|
---|
2158 |
|
---|
2159 |
|
---|
2160 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryStringDef(PCFGMNODE pNode, const char *pszName, char *pszString, size_t cchString, const char *pszDef)
|
---|
2161 | {
|
---|
2162 | int rc = pdmR3DevHlp_CFGMQueryString(pNode, pszName, pszString, cchString);
|
---|
2163 | if (RT_FAILURE(rc) && rc != VERR_CFGM_NOT_ENOUGH_SPACE)
|
---|
2164 | {
|
---|
2165 | size_t cchDef = strlen(pszDef);
|
---|
2166 | if (cchString > cchDef)
|
---|
2167 | {
|
---|
2168 | memcpy(pszString, pszDef, cchDef);
|
---|
2169 | memset(pszString + cchDef, 0, cchString - cchDef);
|
---|
2170 | if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT)
|
---|
2171 | rc = VINF_SUCCESS;
|
---|
2172 | }
|
---|
2173 | else if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT)
|
---|
2174 | rc = VERR_CFGM_NOT_ENOUGH_SPACE;
|
---|
2175 | }
|
---|
2176 |
|
---|
2177 | return rc;
|
---|
2178 | }
|
---|
2179 |
|
---|
2180 |
|
---|
2181 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryPassword(PCFGMNODE pNode, const char *pszName, char *pszString, size_t cchString)
|
---|
2182 | {
|
---|
2183 | return pdmR3DevHlp_CFGMQueryString(pNode, pszName, pszString, cchString);
|
---|
2184 | }
|
---|
2185 |
|
---|
2186 |
|
---|
2187 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryPasswordDef(PCFGMNODE pNode, const char *pszName, char *pszString, size_t cchString, const char *pszDef)
|
---|
2188 | {
|
---|
2189 | return pdmR3DevHlp_CFGMQueryStringDef(pNode, pszName, pszString, cchString, pszDef);
|
---|
2190 | }
|
---|
2191 |
|
---|
2192 |
|
---|
2193 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryBytes(PCFGMNODE pNode, const char *pszName, void *pvData, size_t cbData)
|
---|
2194 | {
|
---|
2195 | RT_NOREF(pNode, pszName, pvData, cbData);
|
---|
2196 |
|
---|
2197 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
2198 | AssertFailed();
|
---|
2199 | return VERR_NOT_IMPLEMENTED;
|
---|
2200 | #else
|
---|
2201 | memset(pvData, 0, cbData);
|
---|
2202 | return VINF_SUCCESS;
|
---|
2203 | #endif
|
---|
2204 | }
|
---|
2205 |
|
---|
2206 |
|
---|
2207 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryU64(PCFGMNODE pNode, const char *pszName, uint64_t *pu64)
|
---|
2208 | {
|
---|
2209 | return pdmR3DevHlp_CFGMQueryInteger(pNode, pszName, pu64);
|
---|
2210 | }
|
---|
2211 |
|
---|
2212 |
|
---|
2213 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryU64Def(PCFGMNODE pNode, const char *pszName, uint64_t *pu64, uint64_t u64Def)
|
---|
2214 | {
|
---|
2215 | return pdmR3DevHlp_CFGMQueryIntegerDef(pNode, pszName, pu64, u64Def);
|
---|
2216 | }
|
---|
2217 |
|
---|
2218 |
|
---|
2219 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryS64(PCFGMNODE pNode, const char *pszName, int64_t *pi64)
|
---|
2220 | {
|
---|
2221 | RT_NOREF(pNode, pszName, pi64);
|
---|
2222 | AssertFailed();
|
---|
2223 | return VERR_NOT_IMPLEMENTED;
|
---|
2224 | }
|
---|
2225 |
|
---|
2226 |
|
---|
2227 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryS64Def(PCFGMNODE pNode, const char *pszName, int64_t *pi64, int64_t i64Def)
|
---|
2228 | {
|
---|
2229 | RT_NOREF(pNode, pszName, pi64, i64Def);
|
---|
2230 | AssertFailed();
|
---|
2231 | return VERR_NOT_IMPLEMENTED;
|
---|
2232 | }
|
---|
2233 |
|
---|
2234 |
|
---|
2235 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryU32(PCFGMNODE pNode, const char *pszName, uint32_t *pu32)
|
---|
2236 | {
|
---|
2237 | uint64_t u64;
|
---|
2238 | int rc = pdmR3DevHlp_CFGMQueryInteger(pNode, pszName, &u64);
|
---|
2239 | if (RT_SUCCESS(rc))
|
---|
2240 | {
|
---|
2241 | if (!(u64 & UINT64_C(0xffffffff00000000)))
|
---|
2242 | *pu32 = (uint32_t)u64;
|
---|
2243 | else
|
---|
2244 | rc = VERR_CFGM_INTEGER_TOO_BIG;
|
---|
2245 | }
|
---|
2246 | return rc;
|
---|
2247 | }
|
---|
2248 |
|
---|
2249 |
|
---|
2250 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryU32Def(PCFGMNODE pNode, const char *pszName, uint32_t *pu32, uint32_t u32Def)
|
---|
2251 | {
|
---|
2252 | uint64_t u64;
|
---|
2253 | int rc = pdmR3DevHlp_CFGMQueryIntegerDef(pNode, pszName, &u64, u32Def);
|
---|
2254 | if (RT_SUCCESS(rc))
|
---|
2255 | {
|
---|
2256 | if (!(u64 & UINT64_C(0xffffffff00000000)))
|
---|
2257 | *pu32 = (uint32_t)u64;
|
---|
2258 | else
|
---|
2259 | rc = VERR_CFGM_INTEGER_TOO_BIG;
|
---|
2260 | }
|
---|
2261 | if (RT_FAILURE(rc))
|
---|
2262 | *pu32 = u32Def;
|
---|
2263 | return rc;
|
---|
2264 | }
|
---|
2265 |
|
---|
2266 |
|
---|
2267 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryS32(PCFGMNODE pNode, const char *pszName, int32_t *pi32)
|
---|
2268 | {
|
---|
2269 | uint64_t u64;
|
---|
2270 | int rc = pdmR3DevHlp_CFGMQueryInteger(pNode, pszName, &u64);
|
---|
2271 | if (RT_SUCCESS(rc))
|
---|
2272 | {
|
---|
2273 | if ( !(u64 & UINT64_C(0xffffffff80000000))
|
---|
2274 | || (u64 & UINT64_C(0xffffffff80000000)) == UINT64_C(0xffffffff80000000))
|
---|
2275 | *pi32 = (int32_t)u64;
|
---|
2276 | else
|
---|
2277 | rc = VERR_CFGM_INTEGER_TOO_BIG;
|
---|
2278 | }
|
---|
2279 | return rc;
|
---|
2280 | }
|
---|
2281 |
|
---|
2282 |
|
---|
2283 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryS32Def(PCFGMNODE pNode, const char *pszName, int32_t *pi32, int32_t i32Def)
|
---|
2284 | {
|
---|
2285 | uint64_t u64;
|
---|
2286 | int rc = pdmR3DevHlp_CFGMQueryIntegerDef(pNode, pszName, &u64, i32Def);
|
---|
2287 | if (RT_SUCCESS(rc))
|
---|
2288 | {
|
---|
2289 | if ( !(u64 & UINT64_C(0xffffffff80000000))
|
---|
2290 | || (u64 & UINT64_C(0xffffffff80000000)) == UINT64_C(0xffffffff80000000))
|
---|
2291 | *pi32 = (int32_t)u64;
|
---|
2292 | else
|
---|
2293 | rc = VERR_CFGM_INTEGER_TOO_BIG;
|
---|
2294 | }
|
---|
2295 | if (RT_FAILURE(rc))
|
---|
2296 | *pi32 = i32Def;
|
---|
2297 | return rc;
|
---|
2298 | }
|
---|
2299 |
|
---|
2300 |
|
---|
2301 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryU16(PCFGMNODE pNode, const char *pszName, uint16_t *pu16)
|
---|
2302 | {
|
---|
2303 | uint64_t u64;
|
---|
2304 | int rc = pdmR3DevHlp_CFGMQueryInteger(pNode, pszName, &u64);
|
---|
2305 | if (RT_SUCCESS(rc))
|
---|
2306 | {
|
---|
2307 | if (!(u64 & UINT64_C(0xffffffffffff0000)))
|
---|
2308 | *pu16 = (int16_t)u64;
|
---|
2309 | else
|
---|
2310 | rc = VERR_CFGM_INTEGER_TOO_BIG;
|
---|
2311 | }
|
---|
2312 | return rc;
|
---|
2313 | }
|
---|
2314 |
|
---|
2315 |
|
---|
2316 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryU16Def(PCFGMNODE pNode, const char *pszName, uint16_t *pu16, uint16_t u16Def)
|
---|
2317 | {
|
---|
2318 | uint64_t u64;
|
---|
2319 | int rc = pdmR3DevHlp_CFGMQueryIntegerDef(pNode, pszName, &u64, u16Def);
|
---|
2320 | if (RT_SUCCESS(rc))
|
---|
2321 | {
|
---|
2322 | if (!(u64 & UINT64_C(0xffffffffffff0000)))
|
---|
2323 | *pu16 = (int16_t)u64;
|
---|
2324 | else
|
---|
2325 | rc = VERR_CFGM_INTEGER_TOO_BIG;
|
---|
2326 | }
|
---|
2327 | if (RT_FAILURE(rc))
|
---|
2328 | *pu16 = u16Def;
|
---|
2329 | return rc;
|
---|
2330 | }
|
---|
2331 |
|
---|
2332 |
|
---|
2333 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryS16(PCFGMNODE pNode, const char *pszName, int16_t *pi16)
|
---|
2334 | {
|
---|
2335 | RT_NOREF(pNode, pszName, pi16);
|
---|
2336 | AssertFailed();
|
---|
2337 | return VERR_NOT_IMPLEMENTED;
|
---|
2338 | }
|
---|
2339 |
|
---|
2340 |
|
---|
2341 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryS16Def(PCFGMNODE pNode, const char *pszName, int16_t *pi16, int16_t i16Def)
|
---|
2342 | {
|
---|
2343 | RT_NOREF(pNode, pszName, pi16, i16Def);
|
---|
2344 | AssertFailed();
|
---|
2345 | return VERR_NOT_IMPLEMENTED;
|
---|
2346 | }
|
---|
2347 |
|
---|
2348 |
|
---|
2349 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryU8(PCFGMNODE pNode, const char *pszName, uint8_t *pu8)
|
---|
2350 | {
|
---|
2351 | uint64_t u64;
|
---|
2352 | int rc = pdmR3DevHlp_CFGMQueryInteger(pNode, pszName, &u64);
|
---|
2353 | if (RT_SUCCESS(rc))
|
---|
2354 | {
|
---|
2355 | if (!(u64 & UINT64_C(0xffffffffffffff00)))
|
---|
2356 | *pu8 = (uint8_t)u64;
|
---|
2357 | else
|
---|
2358 | rc = VERR_CFGM_INTEGER_TOO_BIG;
|
---|
2359 | }
|
---|
2360 | return rc;
|
---|
2361 | }
|
---|
2362 |
|
---|
2363 |
|
---|
2364 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryU8Def(PCFGMNODE pNode, const char *pszName, uint8_t *pu8, uint8_t u8Def)
|
---|
2365 | {
|
---|
2366 | uint64_t u64;
|
---|
2367 | int rc = pdmR3DevHlp_CFGMQueryIntegerDef(pNode, pszName, &u64, u8Def);
|
---|
2368 | if (RT_SUCCESS(rc))
|
---|
2369 | {
|
---|
2370 | if (!(u64 & UINT64_C(0xffffffffffffff00)))
|
---|
2371 | *pu8 = (uint8_t)u64;
|
---|
2372 | else
|
---|
2373 | rc = VERR_CFGM_INTEGER_TOO_BIG;
|
---|
2374 | }
|
---|
2375 | if (RT_FAILURE(rc))
|
---|
2376 | *pu8 = u8Def;
|
---|
2377 | return rc;
|
---|
2378 | }
|
---|
2379 |
|
---|
2380 |
|
---|
2381 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryS8(PCFGMNODE pNode, const char *pszName, int8_t *pi8)
|
---|
2382 | {
|
---|
2383 | RT_NOREF(pNode, pszName, pi8);
|
---|
2384 | AssertFailed();
|
---|
2385 | return VERR_NOT_IMPLEMENTED;
|
---|
2386 | }
|
---|
2387 |
|
---|
2388 |
|
---|
2389 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryS8Def(PCFGMNODE pNode, const char *pszName, int8_t *pi8, int8_t i8Def)
|
---|
2390 | {
|
---|
2391 | RT_NOREF(pNode, pszName, pi8, i8Def);
|
---|
2392 | AssertFailed();
|
---|
2393 | return VERR_NOT_IMPLEMENTED;
|
---|
2394 | }
|
---|
2395 |
|
---|
2396 |
|
---|
2397 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryBool(PCFGMNODE pNode, const char *pszName, bool *pf)
|
---|
2398 | {
|
---|
2399 | uint64_t u64;
|
---|
2400 | int rc = pdmR3DevHlp_CFGMQueryInteger(pNode, pszName, &u64);
|
---|
2401 | if (RT_SUCCESS(rc))
|
---|
2402 | *pf = u64 ? true : false;
|
---|
2403 | return rc;
|
---|
2404 | }
|
---|
2405 |
|
---|
2406 |
|
---|
2407 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryBoolDef(PCFGMNODE pNode, const char *pszName, bool *pf, bool fDef)
|
---|
2408 | {
|
---|
2409 | uint64_t u64;
|
---|
2410 | int rc = pdmR3DevHlp_CFGMQueryIntegerDef(pNode, pszName, &u64, fDef);
|
---|
2411 | *pf = u64 ? true : false;
|
---|
2412 | return rc;
|
---|
2413 | }
|
---|
2414 |
|
---|
2415 |
|
---|
2416 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryPort(PCFGMNODE pNode, const char *pszName, PRTIOPORT pPort)
|
---|
2417 | {
|
---|
2418 | RT_NOREF(pNode, pszName, pPort);
|
---|
2419 | AssertFailed();
|
---|
2420 | return VERR_NOT_IMPLEMENTED;
|
---|
2421 | }
|
---|
2422 |
|
---|
2423 |
|
---|
2424 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryPortDef(PCFGMNODE pNode, const char *pszName, PRTIOPORT pPort, RTIOPORT PortDef)
|
---|
2425 | {
|
---|
2426 | AssertCompileSize(RTIOPORT, 2);
|
---|
2427 | return pdmR3DevHlp_CFGMQueryU16Def(pNode, pszName, pPort, PortDef);
|
---|
2428 | }
|
---|
2429 |
|
---|
2430 |
|
---|
2431 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryUInt(PCFGMNODE pNode, const char *pszName, unsigned int *pu)
|
---|
2432 | {
|
---|
2433 | RT_NOREF(pNode, pszName, pu);
|
---|
2434 | AssertFailed();
|
---|
2435 | return VERR_NOT_IMPLEMENTED;
|
---|
2436 | }
|
---|
2437 |
|
---|
2438 |
|
---|
2439 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryUIntDef(PCFGMNODE pNode, const char *pszName, unsigned int *pu, unsigned int uDef)
|
---|
2440 | {
|
---|
2441 | RT_NOREF(pNode, pszName, pu, uDef);
|
---|
2442 | AssertFailed();
|
---|
2443 | return VERR_NOT_IMPLEMENTED;
|
---|
2444 | }
|
---|
2445 |
|
---|
2446 |
|
---|
2447 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQuerySInt(PCFGMNODE pNode, const char *pszName, signed int *pi)
|
---|
2448 | {
|
---|
2449 | RT_NOREF(pNode, pszName, pi);
|
---|
2450 | AssertFailed();
|
---|
2451 | return VERR_NOT_IMPLEMENTED;
|
---|
2452 | }
|
---|
2453 |
|
---|
2454 |
|
---|
2455 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQuerySIntDef(PCFGMNODE pNode, const char *pszName, signed int *pi, signed int iDef)
|
---|
2456 | {
|
---|
2457 | RT_NOREF(pNode, pszName, pi, iDef);
|
---|
2458 | AssertFailed();
|
---|
2459 | return VERR_NOT_IMPLEMENTED;
|
---|
2460 | }
|
---|
2461 |
|
---|
2462 |
|
---|
2463 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryPtr(PCFGMNODE pNode, const char *pszName, void **ppv)
|
---|
2464 | {
|
---|
2465 | uint64_t u64;
|
---|
2466 | int rc = pdmR3DevHlp_CFGMQueryInteger(pNode, pszName, &u64);
|
---|
2467 | if (RT_SUCCESS(rc))
|
---|
2468 | {
|
---|
2469 | uintptr_t u = (uintptr_t)u64;
|
---|
2470 | if (u64 == u)
|
---|
2471 | *ppv = (void *)u;
|
---|
2472 | else
|
---|
2473 | rc = VERR_CFGM_INTEGER_TOO_BIG;
|
---|
2474 | }
|
---|
2475 | return rc;
|
---|
2476 | }
|
---|
2477 |
|
---|
2478 |
|
---|
2479 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryPtrDef(PCFGMNODE pNode, const char *pszName, void **ppv, void *pvDef)
|
---|
2480 | {
|
---|
2481 | RT_NOREF(pNode, pszName, ppv, pvDef);
|
---|
2482 | AssertFailed();
|
---|
2483 | return VERR_NOT_IMPLEMENTED;
|
---|
2484 | }
|
---|
2485 |
|
---|
2486 |
|
---|
2487 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryGCPtr(PCFGMNODE pNode, const char *pszName, PRTGCPTR pGCPtr)
|
---|
2488 | {
|
---|
2489 | RT_NOREF(pNode, pszName, pGCPtr);
|
---|
2490 | AssertFailed();
|
---|
2491 | return VERR_NOT_IMPLEMENTED;
|
---|
2492 | }
|
---|
2493 |
|
---|
2494 |
|
---|
2495 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryGCPtrDef(PCFGMNODE pNode, const char *pszName, PRTGCPTR pGCPtr, RTGCPTR GCPtrDef)
|
---|
2496 | {
|
---|
2497 | RT_NOREF(pNode, pszName, pGCPtr, GCPtrDef);
|
---|
2498 | AssertFailed();
|
---|
2499 | return VERR_NOT_IMPLEMENTED;
|
---|
2500 | }
|
---|
2501 |
|
---|
2502 |
|
---|
2503 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryGCPtrU(PCFGMNODE pNode, const char *pszName, PRTGCUINTPTR pGCPtr)
|
---|
2504 | {
|
---|
2505 | RT_NOREF(pNode, pszName, pGCPtr);
|
---|
2506 | AssertFailed();
|
---|
2507 | return VERR_NOT_IMPLEMENTED;
|
---|
2508 | }
|
---|
2509 |
|
---|
2510 |
|
---|
2511 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryGCPtrUDef(PCFGMNODE pNode, const char *pszName, PRTGCUINTPTR pGCPtr, RTGCUINTPTR GCPtrDef)
|
---|
2512 | {
|
---|
2513 | RT_NOREF(pNode, pszName, pGCPtr, GCPtrDef);
|
---|
2514 | AssertFailed();
|
---|
2515 | return VERR_NOT_IMPLEMENTED;
|
---|
2516 | }
|
---|
2517 |
|
---|
2518 |
|
---|
2519 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryGCPtrS(PCFGMNODE pNode, const char *pszName, PRTGCINTPTR pGCPtr)
|
---|
2520 | {
|
---|
2521 | RT_NOREF(pNode, pszName, pGCPtr);
|
---|
2522 | AssertFailed();
|
---|
2523 | return VERR_NOT_IMPLEMENTED;
|
---|
2524 | }
|
---|
2525 |
|
---|
2526 |
|
---|
2527 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryGCPtrSDef(PCFGMNODE pNode, const char *pszName, PRTGCINTPTR pGCPtr, RTGCINTPTR GCPtrDef)
|
---|
2528 | {
|
---|
2529 | RT_NOREF(pNode, pszName, pGCPtr, GCPtrDef);
|
---|
2530 | AssertFailed();
|
---|
2531 | return VERR_NOT_IMPLEMENTED;
|
---|
2532 | }
|
---|
2533 |
|
---|
2534 |
|
---|
2535 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryStringAlloc(PCFGMNODE pNode, const char *pszName, char **ppszString)
|
---|
2536 | {
|
---|
2537 | if (!pNode)
|
---|
2538 | return VERR_CFGM_NO_PARENT;
|
---|
2539 |
|
---|
2540 | PCTSTDEVCFGITEM pCfgItem;
|
---|
2541 | int rc = tstDev_CfgmR3ResolveItem(pNode->pDut->pTest->paCfgItems, pNode->pDut->pTest->cCfgItems, pszName, &pCfgItem);
|
---|
2542 | if (RT_SUCCESS(rc))
|
---|
2543 | {
|
---|
2544 | switch (pCfgItem->enmType)
|
---|
2545 | {
|
---|
2546 | case TSTDEVCFGITEMTYPE_STRING:
|
---|
2547 | {
|
---|
2548 | *ppszString = (char *)RTMemDup(pCfgItem->u.psz, strlen(pCfgItem->u.psz) + 1);
|
---|
2549 | if (RT_LIKELY(*ppszString))
|
---|
2550 | rc = VINF_SUCCESS;
|
---|
2551 | else
|
---|
2552 | rc = VERR_NO_STR_MEMORY;
|
---|
2553 | break;
|
---|
2554 | }
|
---|
2555 | case TSTDEVCFGITEMTYPE_INTEGER:
|
---|
2556 | case TSTDEVCFGITEMTYPE_BYTES:
|
---|
2557 | default:
|
---|
2558 | rc = VERR_CFGM_IPE_1;
|
---|
2559 | AssertMsgFailed(("Invalid value type %d\n", pCfgItem->enmType));
|
---|
2560 | break;
|
---|
2561 | }
|
---|
2562 | }
|
---|
2563 | else
|
---|
2564 | rc = VERR_CFGM_VALUE_NOT_FOUND;
|
---|
2565 |
|
---|
2566 | return rc;
|
---|
2567 | }
|
---|
2568 |
|
---|
2569 |
|
---|
2570 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMQueryStringAllocDef(PCFGMNODE pNode, const char *pszName, char **ppszString, const char *pszDef)
|
---|
2571 | {
|
---|
2572 | if (!pNode)
|
---|
2573 | return VERR_CFGM_NO_PARENT;
|
---|
2574 |
|
---|
2575 | PCTSTDEVCFGITEM pCfgItem;
|
---|
2576 | int rc = tstDev_CfgmR3ResolveItem(pNode->pDut->pTest->paCfgItems, pNode->pDut->pTest->cCfgItems, pszName, &pCfgItem);
|
---|
2577 | if (RT_SUCCESS(rc))
|
---|
2578 | {
|
---|
2579 | switch (pCfgItem->enmType)
|
---|
2580 | {
|
---|
2581 | case TSTDEVCFGITEMTYPE_STRING:
|
---|
2582 | {
|
---|
2583 | *ppszString = (char *)RTMemDup(pCfgItem->u.psz, strlen(pCfgItem->u.psz) + 1);
|
---|
2584 | if (RT_LIKELY(*ppszString))
|
---|
2585 | rc = VINF_SUCCESS;
|
---|
2586 | else
|
---|
2587 | rc = VERR_NO_STR_MEMORY;
|
---|
2588 | break;
|
---|
2589 | }
|
---|
2590 | case TSTDEVCFGITEMTYPE_INTEGER:
|
---|
2591 | case TSTDEVCFGITEMTYPE_BYTES:
|
---|
2592 | default:
|
---|
2593 | rc = VERR_CFGM_IPE_1;
|
---|
2594 | AssertMsgFailed(("Invalid value type %d\n", pCfgItem->enmType));
|
---|
2595 | break;
|
---|
2596 | }
|
---|
2597 | }
|
---|
2598 | else
|
---|
2599 | {
|
---|
2600 | if (pszDef)
|
---|
2601 | {
|
---|
2602 | *ppszString = (char *)RTMemDup(pszDef, strlen(pszDef) + 1);
|
---|
2603 | if (RT_LIKELY(*ppszString))
|
---|
2604 | rc = VINF_SUCCESS;
|
---|
2605 | else
|
---|
2606 | rc = VERR_NO_STR_MEMORY;
|
---|
2607 | }
|
---|
2608 | else
|
---|
2609 | {
|
---|
2610 | *ppszString = NULL;
|
---|
2611 | rc = VINF_SUCCESS;
|
---|
2612 | }
|
---|
2613 | }
|
---|
2614 |
|
---|
2615 | return rc;
|
---|
2616 | }
|
---|
2617 |
|
---|
2618 |
|
---|
2619 | static DECLCALLBACK(PCFGMNODE) pdmR3DevHlp_CFGMGetParent(PCFGMNODE pNode)
|
---|
2620 | {
|
---|
2621 | RT_NOREF(pNode);
|
---|
2622 | AssertFailed();
|
---|
2623 | return NULL;
|
---|
2624 | }
|
---|
2625 |
|
---|
2626 |
|
---|
2627 | static DECLCALLBACK(PCFGMNODE) pdmR3DevHlp_CFGMGetChild(PCFGMNODE pNode, const char *pszPath)
|
---|
2628 | {
|
---|
2629 | RT_NOREF(pNode, pszPath);
|
---|
2630 | AssertFailed();
|
---|
2631 | return NULL;
|
---|
2632 | }
|
---|
2633 |
|
---|
2634 |
|
---|
2635 | static DECLCALLBACK(PCFGMNODE) pdmR3DevHlp_CFGMGetChildF(PCFGMNODE pNode, const char *pszPathFormat, ...) RT_IPRT_FORMAT_ATTR(2, 3)
|
---|
2636 | {
|
---|
2637 | RT_NOREF(pNode, pszPathFormat);
|
---|
2638 | AssertFailed();
|
---|
2639 | return NULL;
|
---|
2640 | }
|
---|
2641 |
|
---|
2642 |
|
---|
2643 | static DECLCALLBACK(PCFGMNODE) pdmR3DevHlp_CFGMGetChildFV(PCFGMNODE pNode, const char *pszPathFormat, va_list Args) RT_IPRT_FORMAT_ATTR(3, 0)
|
---|
2644 | {
|
---|
2645 | RT_NOREF(pNode, pszPathFormat, Args);
|
---|
2646 | AssertFailed();
|
---|
2647 | return NULL;
|
---|
2648 | }
|
---|
2649 |
|
---|
2650 |
|
---|
2651 | static DECLCALLBACK(PCFGMNODE) pdmR3DevHlp_CFGMGetFirstChild(PCFGMNODE pNode)
|
---|
2652 | {
|
---|
2653 | RT_NOREF(pNode);
|
---|
2654 | AssertFailed();
|
---|
2655 | return NULL;
|
---|
2656 | }
|
---|
2657 |
|
---|
2658 |
|
---|
2659 | static DECLCALLBACK(PCFGMNODE) pdmR3DevHlp_CFGMGetNextChild(PCFGMNODE pCur)
|
---|
2660 | {
|
---|
2661 | RT_NOREF(pCur);
|
---|
2662 | AssertFailed();
|
---|
2663 | return NULL;
|
---|
2664 | }
|
---|
2665 |
|
---|
2666 |
|
---|
2667 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMGetName(PCFGMNODE pCur, char *pszName, size_t cchName)
|
---|
2668 | {
|
---|
2669 | RT_NOREF(pCur, pszName, cchName);
|
---|
2670 | AssertFailed();
|
---|
2671 | return VERR_NOT_IMPLEMENTED;
|
---|
2672 | }
|
---|
2673 |
|
---|
2674 |
|
---|
2675 | static DECLCALLBACK(size_t) pdmR3DevHlp_CFGMGetNameLen(PCFGMNODE pCur)
|
---|
2676 | {
|
---|
2677 | RT_NOREF(pCur);
|
---|
2678 | AssertFailed();
|
---|
2679 | return 0;
|
---|
2680 | }
|
---|
2681 |
|
---|
2682 |
|
---|
2683 | static DECLCALLBACK(bool) pdmR3DevHlp_CFGMAreChildrenValid(PCFGMNODE pNode, const char *pszzValid)
|
---|
2684 | {
|
---|
2685 | RT_NOREF(pNode, pszzValid);
|
---|
2686 | AssertFailed();
|
---|
2687 | return false;
|
---|
2688 | }
|
---|
2689 |
|
---|
2690 |
|
---|
2691 | static DECLCALLBACK(PCFGMLEAF) pdmR3DevHlp_CFGMGetFirstValue(PCFGMNODE pCur)
|
---|
2692 | {
|
---|
2693 | RT_NOREF(pCur);
|
---|
2694 | AssertFailed();
|
---|
2695 | return NULL;
|
---|
2696 | }
|
---|
2697 |
|
---|
2698 |
|
---|
2699 | static DECLCALLBACK(PCFGMLEAF) pdmR3DevHlp_CFGMGetNextValue(PCFGMLEAF pCur)
|
---|
2700 | {
|
---|
2701 | RT_NOREF(pCur);
|
---|
2702 | AssertFailed();
|
---|
2703 | return NULL;
|
---|
2704 | }
|
---|
2705 |
|
---|
2706 |
|
---|
2707 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMGetValueName(PCFGMLEAF pCur, char *pszName, size_t cchName)
|
---|
2708 | {
|
---|
2709 | RT_NOREF(pCur, pszName, cchName);
|
---|
2710 | AssertFailed();
|
---|
2711 | return VERR_NOT_IMPLEMENTED;
|
---|
2712 | }
|
---|
2713 |
|
---|
2714 |
|
---|
2715 | static DECLCALLBACK(size_t) pdmR3DevHlp_CFGMGetValueNameLen(PCFGMLEAF pCur)
|
---|
2716 | {
|
---|
2717 | RT_NOREF(pCur);
|
---|
2718 | AssertFailed();
|
---|
2719 | return 0;
|
---|
2720 | }
|
---|
2721 |
|
---|
2722 |
|
---|
2723 | static DECLCALLBACK(CFGMVALUETYPE) pdmR3DevHlp_CFGMGetValueType(PCFGMLEAF pCur)
|
---|
2724 | {
|
---|
2725 | RT_NOREF(pCur);
|
---|
2726 | AssertFailed();
|
---|
2727 | return CFGMVALUETYPE_INTEGER;
|
---|
2728 | }
|
---|
2729 |
|
---|
2730 |
|
---|
2731 | static DECLCALLBACK(bool) pdmR3DevHlp_CFGMAreValuesValid(PCFGMNODE pNode, const char *pszzValid)
|
---|
2732 | {
|
---|
2733 | if (pNode && pNode->pDut->pTest->paCfgItems)
|
---|
2734 | {
|
---|
2735 | PCTSTDEVCFGITEM pDevCfgItem = pNode->pDut->pTest->paCfgItems;
|
---|
2736 | for (uint32_t i = 0; i < pNode->pDut->pTest->cCfgItems; i++)
|
---|
2737 | {
|
---|
2738 | size_t cchKey = strlen(pDevCfgItem->pszKey);
|
---|
2739 |
|
---|
2740 | /* search pszzValid for the name */
|
---|
2741 | const char *psz = pszzValid;
|
---|
2742 | while (*psz)
|
---|
2743 | {
|
---|
2744 | size_t cch = strlen(psz);
|
---|
2745 | if ( cch == cchKey
|
---|
2746 | && !memcmp(psz, pDevCfgItem->pszKey, cch))
|
---|
2747 | break;
|
---|
2748 |
|
---|
2749 | /* next */
|
---|
2750 | psz += cch + 1;
|
---|
2751 | }
|
---|
2752 |
|
---|
2753 | /* if at end of pszzValid we didn't find it => failure */
|
---|
2754 | if (!*psz)
|
---|
2755 | return false;
|
---|
2756 |
|
---|
2757 | pDevCfgItem++;
|
---|
2758 | }
|
---|
2759 | }
|
---|
2760 |
|
---|
2761 | return true;
|
---|
2762 | }
|
---|
2763 |
|
---|
2764 |
|
---|
2765 | static DECLCALLBACK(int) pdmR3DevHlp_CFGMValidateConfig(PCFGMNODE pNode, const char *pszNode,
|
---|
2766 | const char *pszValidValues, const char *pszValidNodes,
|
---|
2767 | const char *pszWho, uint32_t uInstance)
|
---|
2768 | {
|
---|
2769 | RT_NOREF(pNode, pszNode, pszValidValues, pszValidNodes, pszWho, uInstance);
|
---|
2770 | #if 1
|
---|
2771 | return VINF_SUCCESS;
|
---|
2772 | #else
|
---|
2773 | AssertFailed();
|
---|
2774 | return VERR_NOT_IMPLEMENTED;
|
---|
2775 | #endif
|
---|
2776 | }
|
---|
2777 |
|
---|
2778 |
|
---|
2779 | /** @interface_method_impl{PDMDEVHLPR3,pfnTMTimeVirtGet} */
|
---|
2780 | static DECLCALLBACK(uint64_t) pdmR3DevHlp_TMTimeVirtGet(PPDMDEVINS pDevIns)
|
---|
2781 | {
|
---|
2782 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
2783 | LogFlow(("pdmR3DevHlp_TMTimeVirtGet: caller='%s'/%d\n",
|
---|
2784 | pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
2785 |
|
---|
2786 | uint64_t u64Time = 0;
|
---|
2787 | AssertFailed();
|
---|
2788 |
|
---|
2789 | LogFlow(("pdmR3DevHlp_TMTimeVirtGet: caller='%s'/%d: returns %RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, u64Time));
|
---|
2790 | return u64Time;
|
---|
2791 | }
|
---|
2792 |
|
---|
2793 |
|
---|
2794 | /** @interface_method_impl{PDMDEVHLPR3,pfnTMTimeVirtGetFreq} */
|
---|
2795 | static DECLCALLBACK(uint64_t) pdmR3DevHlp_TMTimeVirtGetFreq(PPDMDEVINS pDevIns)
|
---|
2796 | {
|
---|
2797 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
2798 | LogFlow(("pdmR3DevHlp_TMTimeVirtGetFreq: caller='%s'/%d\n",
|
---|
2799 | pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
2800 |
|
---|
2801 | uint64_t u64Freq = 0;
|
---|
2802 | AssertFailed();
|
---|
2803 |
|
---|
2804 | LogFlow(("pdmR3DevHlp_TMTimeVirtGetFreq: caller='%s'/%d: returns %RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, u64Freq));
|
---|
2805 | return u64Freq;
|
---|
2806 | }
|
---|
2807 |
|
---|
2808 |
|
---|
2809 | /** @interface_method_impl{PDMDEVHLPR3,pfnTMTimeVirtGetNano} */
|
---|
2810 | static DECLCALLBACK(uint64_t) pdmR3DevHlp_TMTimeVirtGetNano(PPDMDEVINS pDevIns)
|
---|
2811 | {
|
---|
2812 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
2813 | LogFlow(("pdmR3DevHlp_TMTimeVirtGetNano: caller='%s'/%d\n",
|
---|
2814 | pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
2815 |
|
---|
2816 | uint64_t u64Nano = RTTimeNanoTS();
|
---|
2817 |
|
---|
2818 | LogFlow(("pdmR3DevHlp_TMTimeVirtGetNano: caller='%s'/%d: returns %RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, u64Nano));
|
---|
2819 | return u64Nano;
|
---|
2820 | }
|
---|
2821 |
|
---|
2822 |
|
---|
2823 | /** @interface_method_impl{PDMDEVHLPR3,pfnTMCpuTicksPerSecond} */
|
---|
2824 | static DECLCALLBACK(uint64_t) pdmR3DevHlp_TMCpuTicksPerSecond(PPDMDEVINS pDevIns)
|
---|
2825 | {
|
---|
2826 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
2827 | LogFlow(("pdmR3DevHlp_TMCpuTicksPerSecond: caller='%s'/%d\n",
|
---|
2828 | pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
2829 |
|
---|
2830 | AssertFailed();
|
---|
2831 | uint64_t u64CpuTicksPerSec = 0;
|
---|
2832 |
|
---|
2833 | LogFlow(("pdmR3DevHlp_TMCpuTicksPerSecond: caller='%s'/%d: returns %RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, u64CpuTicksPerSec));
|
---|
2834 | return u64CpuTicksPerSec;
|
---|
2835 | }
|
---|
2836 |
|
---|
2837 |
|
---|
2838 | /** @interface_method_impl{PDMDEVHLPR3,pfnGetSupDrvSession} */
|
---|
2839 | static DECLCALLBACK(PSUPDRVSESSION) pdmR3DevHlp_GetSupDrvSession(PPDMDEVINS pDevIns)
|
---|
2840 | {
|
---|
2841 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
2842 | LogFlow(("pdmR3DevHlp_GetSupDrvSession: caller='%s'/%d\n",
|
---|
2843 | pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
2844 |
|
---|
2845 | PSUPDRVSESSION pSession = NIL_RTR0PTR;
|
---|
2846 | AssertFailed();
|
---|
2847 |
|
---|
2848 | LogFlow(("pdmR3DevHlp_GetSupDrvSession: caller='%s'/%d: returns %#p\n", pDevIns->pReg->szName, pDevIns->iInstance, pSession));
|
---|
2849 | return pSession;
|
---|
2850 | }
|
---|
2851 |
|
---|
2852 |
|
---|
2853 | /** @interface_method_impl{PDMDEVHLPR3,pfnQueryGenericUserObject} */
|
---|
2854 | static DECLCALLBACK(void *) pdmR3DevHlp_QueryGenericUserObject(PPDMDEVINS pDevIns, PCRTUUID pUuid)
|
---|
2855 | {
|
---|
2856 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
2857 | LogFlow(("pdmR3DevHlp_QueryGenericUserObject: caller='%s'/%d: pUuid=%p:%RTuuid\n",
|
---|
2858 | pDevIns->pReg->szName, pDevIns->iInstance, pUuid, pUuid));
|
---|
2859 |
|
---|
2860 | #if defined(DEBUG_bird) || defined(DEBUG_ramshankar) || defined(DEBUG_sunlover) || defined(DEBUG_michael) || defined(DEBUG_andy)
|
---|
2861 | AssertMsgFailed(("'%s' wants %RTuuid - external only interface!\n", pDevIns->pReg->szName, pUuid));
|
---|
2862 | #endif
|
---|
2863 |
|
---|
2864 | void *pvRet = NULL;
|
---|
2865 | AssertFailed();
|
---|
2866 |
|
---|
2867 | LogRel(("pdmR3DevHlp_QueryGenericUserObject: caller='%s'/%d: returns %#p for %RTuuid\n",
|
---|
2868 | pDevIns->pReg->szName, pDevIns->iInstance, pvRet, pUuid));
|
---|
2869 | return pvRet;
|
---|
2870 | }
|
---|
2871 |
|
---|
2872 |
|
---|
2873 | /** @interface_method_impl{PDMDEVHLPR3,pfnPGMHandlerPhysicalTypeRegister} */
|
---|
2874 | static DECLCALLBACK(int) pdmR3DevHlp_PGMHandlerPhysicalTypeRegister(PPDMDEVINS pDevIns, PGMPHYSHANDLERKIND enmKind,
|
---|
2875 | R3PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR3,
|
---|
2876 | const char *pszHandlerR0, const char *pszPfHandlerR0,
|
---|
2877 | const char *pszHandlerRC, const char *pszPfHandlerRC,
|
---|
2878 | const char *pszDesc, PPGMPHYSHANDLERTYPE phType)
|
---|
2879 | {
|
---|
2880 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
2881 | RT_NOREF(enmKind, pfnHandlerR3, pszHandlerR0, pszPfHandlerR0, pszHandlerRC, pszPfHandlerRC, pszDesc, phType);
|
---|
2882 | LogFlow(("pdmR3DevHlp_PGMHandlerPhysicalTypeRegister: caller='%s'/%d: enmKind=%d pfnHandlerR3=%p pszHandlerR0=%p:{%s} pszPfHandlerR0=%p:{%s} pszHandlerRC=%p:{%s} pszPfHandlerRC=%p:{%s} pszDesc=%p:{%s} phType=%p\n",
|
---|
2883 | pDevIns->pReg->szName, pDevIns->iInstance, pfnHandlerR3,
|
---|
2884 | pszHandlerR0, pszHandlerR0, pszPfHandlerR0, pszPfHandlerR0,
|
---|
2885 | pszHandlerRC, pszHandlerRC, pszPfHandlerRC, pszPfHandlerRC,
|
---|
2886 | pszDesc, pszDesc, phType));
|
---|
2887 |
|
---|
2888 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
2889 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
2890 | AssertFailed();
|
---|
2891 | #else
|
---|
2892 | int rc = VINF_SUCCESS;
|
---|
2893 | #endif
|
---|
2894 |
|
---|
2895 | LogRel(("pdmR3DevHlp_PGMHandlerPhysicalTypeRegister: caller='%s'/%d: returns %Rrc\n",
|
---|
2896 | pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
2897 | return rc;
|
---|
2898 | }
|
---|
2899 |
|
---|
2900 |
|
---|
2901 | /** @interface_method_impl{PDMDEVHLPR3,pfnPhysRead} */
|
---|
2902 | static DECLCALLBACK(int) pdmR3DevHlp_PhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, uint32_t fFlags)
|
---|
2903 | {
|
---|
2904 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
2905 | LogFlow(("pdmR3DevHlp_PhysRead: caller='%s'/%d: GCPhys=%RGp pvBuf=%p cbRead=%#x fFlags=%#x\n",
|
---|
2906 | pDevIns->pReg->szName, pDevIns->iInstance, GCPhys, pvBuf, cbRead, fFlags));
|
---|
2907 |
|
---|
2908 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
2909 | VBOXSTRICTRC rcStrict = VERR_NOT_IMPLEMENTED;
|
---|
2910 | AssertFailed();
|
---|
2911 | #else
|
---|
2912 | RTRandBytes(pvBuf, cbRead);
|
---|
2913 | VBOXSTRICTRC rcStrict = VINF_SUCCESS;
|
---|
2914 | #endif
|
---|
2915 |
|
---|
2916 | Log(("pdmR3DevHlp_PhysRead: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VBOXSTRICTRC_VAL(rcStrict) ));
|
---|
2917 | return VBOXSTRICTRC_VAL(rcStrict);
|
---|
2918 | }
|
---|
2919 |
|
---|
2920 |
|
---|
2921 | /** @interface_method_impl{PDMDEVHLPR3,pfnPhysWrite} */
|
---|
2922 | static DECLCALLBACK(int) pdmR3DevHlp_PhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, uint32_t fFlags)
|
---|
2923 | {
|
---|
2924 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
2925 | LogFlow(("pdmR3DevHlp_PhysWrite: caller='%s'/%d: GCPhys=%RGp pvBuf=%p cbWrite=%#xfFlags=%#x\n",
|
---|
2926 | pDevIns->pReg->szName, pDevIns->iInstance, GCPhys, pvBuf, cbWrite, fFlags));
|
---|
2927 |
|
---|
2928 | VBOXSTRICTRC rcStrict = VERR_NOT_IMPLEMENTED;;
|
---|
2929 | AssertFailed();
|
---|
2930 |
|
---|
2931 | Log(("pdmR3DevHlp_PhysWrite: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VBOXSTRICTRC_VAL(rcStrict) ));
|
---|
2932 | return VBOXSTRICTRC_VAL(rcStrict);
|
---|
2933 | }
|
---|
2934 |
|
---|
2935 |
|
---|
2936 | /** @interface_method_impl{PDMDEVHLPR3,pfnPhysGCPhys2CCPtr} */
|
---|
2937 | static DECLCALLBACK(int) pdmR3DevHlp_PhysGCPhys2CCPtr(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t fFlags, void **ppv, PPGMPAGEMAPLOCK pLock)
|
---|
2938 | {
|
---|
2939 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
2940 | LogFlow(("pdmR3DevHlp_PhysGCPhys2CCPtr: caller='%s'/%d: GCPhys=%RGp fFlags=%#x ppv=%p pLock=%p\n",
|
---|
2941 | pDevIns->pReg->szName, pDevIns->iInstance, GCPhys, fFlags, ppv, pLock));
|
---|
2942 | AssertReturn(!fFlags, VERR_INVALID_PARAMETER);
|
---|
2943 |
|
---|
2944 | int rc = VERR_NOT_IMPLEMENTED;;
|
---|
2945 | AssertFailed();
|
---|
2946 |
|
---|
2947 | Log(("pdmR3DevHlp_PhysGCPhys2CCPtr: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
2948 | return rc;
|
---|
2949 | }
|
---|
2950 |
|
---|
2951 |
|
---|
2952 | /** @interface_method_impl{PDMDEVHLPR3,pfnPhysGCPhys2CCPtrReadOnly} */
|
---|
2953 | static DECLCALLBACK(int) pdmR3DevHlp_PhysGCPhys2CCPtrReadOnly(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t fFlags, const void **ppv, PPGMPAGEMAPLOCK pLock)
|
---|
2954 | {
|
---|
2955 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
2956 | LogFlow(("pdmR3DevHlp_PhysGCPhys2CCPtrReadOnly: caller='%s'/%d: GCPhys=%RGp fFlags=%#x ppv=%p pLock=%p\n",
|
---|
2957 | pDevIns->pReg->szName, pDevIns->iInstance, GCPhys, fFlags, ppv, pLock));
|
---|
2958 | AssertReturn(!fFlags, VERR_INVALID_PARAMETER);
|
---|
2959 |
|
---|
2960 | int rc = VERR_NOT_IMPLEMENTED;;
|
---|
2961 | AssertFailed();
|
---|
2962 |
|
---|
2963 | Log(("pdmR3DevHlp_PhysGCPhys2CCPtrReadOnly: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
2964 | return rc;
|
---|
2965 | }
|
---|
2966 |
|
---|
2967 |
|
---|
2968 | /** @interface_method_impl{PDMDEVHLPR3,pfnPhysReleasePageMappingLock} */
|
---|
2969 | static DECLCALLBACK(void) pdmR3DevHlp_PhysReleasePageMappingLock(PPDMDEVINS pDevIns, PPGMPAGEMAPLOCK pLock)
|
---|
2970 | {
|
---|
2971 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
2972 | LogFlow(("pdmR3DevHlp_PhysReleasePageMappingLock: caller='%s'/%d: pLock=%p\n",
|
---|
2973 | pDevIns->pReg->szName, pDevIns->iInstance, pLock));
|
---|
2974 |
|
---|
2975 | AssertFailed();
|
---|
2976 |
|
---|
2977 | Log(("pdmR3DevHlp_PhysReleasePageMappingLock: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
2978 | }
|
---|
2979 |
|
---|
2980 |
|
---|
2981 | /** @interface_method_impl{PDMDEVHLPR3,pfnPhysBulkGCPhys2CCPtr} */
|
---|
2982 | static DECLCALLBACK(int) pdmR3DevHlp_PhysBulkGCPhys2CCPtr(PPDMDEVINS pDevIns, uint32_t cPages, PCRTGCPHYS paGCPhysPages,
|
---|
2983 | uint32_t fFlags, void **papvPages, PPGMPAGEMAPLOCK paLocks)
|
---|
2984 | {
|
---|
2985 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
2986 | LogFlow(("pdmR3DevHlp_PhysBulkGCPhys2CCPtr: caller='%s'/%d: cPages=%#x paGCPhysPages=%p (%RGp,..) fFlags=%#x papvPages=%p paLocks=%p\n",
|
---|
2987 | pDevIns->pReg->szName, pDevIns->iInstance, cPages, paGCPhysPages, paGCPhysPages[0], fFlags, papvPages, paLocks));
|
---|
2988 | AssertReturn(!fFlags, VERR_INVALID_PARAMETER);
|
---|
2989 | AssertReturn(cPages > 0, VERR_INVALID_PARAMETER);
|
---|
2990 |
|
---|
2991 | int rc = VERR_NOT_IMPLEMENTED;;
|
---|
2992 | AssertFailed();
|
---|
2993 |
|
---|
2994 | Log(("pdmR3DevHlp_PhysBulkGCPhys2CCPtr: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
2995 | return rc;
|
---|
2996 | }
|
---|
2997 |
|
---|
2998 |
|
---|
2999 | /** @interface_method_impl{PDMDEVHLPR3,pfnPhysBulkGCPhys2CCPtrReadOnly} */
|
---|
3000 | static DECLCALLBACK(int) pdmR3DevHlp_PhysBulkGCPhys2CCPtrReadOnly(PPDMDEVINS pDevIns, uint32_t cPages, PCRTGCPHYS paGCPhysPages,
|
---|
3001 | uint32_t fFlags, const void **papvPages, PPGMPAGEMAPLOCK paLocks)
|
---|
3002 | {
|
---|
3003 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3004 | LogFlow(("pdmR3DevHlp_PhysBulkGCPhys2CCPtrReadOnly: caller='%s'/%d: cPages=%#x paGCPhysPages=%p (%RGp,...) fFlags=%#x papvPages=%p paLocks=%p\n",
|
---|
3005 | pDevIns->pReg->szName, pDevIns->iInstance, cPages, paGCPhysPages, paGCPhysPages[0], fFlags, papvPages, paLocks));
|
---|
3006 | AssertReturn(!fFlags, VERR_INVALID_PARAMETER);
|
---|
3007 | AssertReturn(cPages > 0, VERR_INVALID_PARAMETER);
|
---|
3008 |
|
---|
3009 | int rc = VERR_NOT_IMPLEMENTED;;
|
---|
3010 | AssertFailed();
|
---|
3011 |
|
---|
3012 | Log(("pdmR3DevHlp_PhysBulkGCPhys2CCPtrReadOnly: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3013 | return rc;
|
---|
3014 | }
|
---|
3015 |
|
---|
3016 |
|
---|
3017 | /** @interface_method_impl{PDMDEVHLPR3,pfnPhysBulkReleasePageMappingLocks} */
|
---|
3018 | static DECLCALLBACK(void) pdmR3DevHlp_PhysBulkReleasePageMappingLocks(PPDMDEVINS pDevIns, uint32_t cPages, PPGMPAGEMAPLOCK paLocks)
|
---|
3019 | {
|
---|
3020 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3021 | LogFlow(("pdmR3DevHlp_PhysBulkReleasePageMappingLocks: caller='%s'/%d: cPages=%#x paLocks=%p\n",
|
---|
3022 | pDevIns->pReg->szName, pDevIns->iInstance, cPages, paLocks));
|
---|
3023 | Assert(cPages > 0);
|
---|
3024 |
|
---|
3025 | AssertFailed();
|
---|
3026 |
|
---|
3027 | Log(("pdmR3DevHlp_PhysBulkReleasePageMappingLocks: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
3028 | }
|
---|
3029 |
|
---|
3030 |
|
---|
3031 | /** @interface_method_impl{PDMDEVHLPR3,pfnPhysIsGCPhysNormal} */
|
---|
3032 | static DECLCALLBACK(bool) pdmR3DevHlp_PhysIsGCPhysNormal(PPDMDEVINS pDevIns, RTGCPHYS GCPhys)
|
---|
3033 | {
|
---|
3034 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3035 | LogFlow(("pdmR3DevHlp_PhysIsGCPhysNormal: caller='%s'/%d: GCPhys=%RGp\n",
|
---|
3036 | pDevIns->pReg->szName, pDevIns->iInstance, GCPhys));
|
---|
3037 |
|
---|
3038 | bool fNormal = true;
|
---|
3039 | AssertFailed();
|
---|
3040 |
|
---|
3041 | Log(("pdmR3DevHlp_PhysIsGCPhysNormal: caller='%s'/%d: returns %RTbool\n", pDevIns->pReg->szName, pDevIns->iInstance, fNormal));
|
---|
3042 | return fNormal;
|
---|
3043 | }
|
---|
3044 |
|
---|
3045 |
|
---|
3046 | /** @interface_method_impl{PDMDEVHLPR3,pfnPhysChangeMemBalloon} */
|
---|
3047 | static DECLCALLBACK(int) pdmR3DevHlp_PhysChangeMemBalloon(PPDMDEVINS pDevIns, bool fInflate, unsigned cPages, RTGCPHYS *paPhysPage)
|
---|
3048 | {
|
---|
3049 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3050 | LogFlow(("pdmR3DevHlp_PhysChangeMemBalloon: caller='%s'/%d: fInflate=%RTbool cPages=%u paPhysPage=%p\n",
|
---|
3051 | pDevIns->pReg->szName, pDevIns->iInstance, fInflate, cPages, paPhysPage));
|
---|
3052 |
|
---|
3053 | int rc = VERR_NOT_IMPLEMENTED;;
|
---|
3054 | AssertFailed();
|
---|
3055 |
|
---|
3056 | Log(("pdmR3DevHlp_PhysChangeMemBalloon: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3057 | return rc;
|
---|
3058 | }
|
---|
3059 |
|
---|
3060 |
|
---|
3061 | /** @interface_method_impl{PDMDEVHLPR3,pfnCpuGetGuestMicroarch} */
|
---|
3062 | static DECLCALLBACK(CPUMMICROARCH) pdmR3DevHlp_CpuGetGuestMicroarch(PPDMDEVINS pDevIns)
|
---|
3063 | {
|
---|
3064 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3065 | LogFlow(("pdmR3DevHlp_CpuGetGuestMicroarch: caller='%s'/%d\n",
|
---|
3066 | pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
3067 |
|
---|
3068 | CPUMMICROARCH enmMicroarch = kCpumMicroarch_Intel_P6;
|
---|
3069 |
|
---|
3070 | Log(("pdmR3DevHlp_CpuGetGuestMicroarch: caller='%s'/%d: returns %u\n", pDevIns->pReg->szName, pDevIns->iInstance, enmMicroarch));
|
---|
3071 | return enmMicroarch;
|
---|
3072 | }
|
---|
3073 |
|
---|
3074 |
|
---|
3075 | /** @interface_method_impl{PDMDEVHLPR3,pfnCpuGetGuestAddrWidths} */
|
---|
3076 | static DECLCALLBACK(void) pdmR3DevHlp_CpuGetGuestAddrWidths(PPDMDEVINS pDevIns, uint8_t *pcPhysAddrWidth,
|
---|
3077 | uint8_t *pcLinearAddrWidth)
|
---|
3078 | {
|
---|
3079 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3080 | LogFlow(("pdmR3DevHlp_CpuGetGuestAddrWidths: caller='%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
3081 | AssertPtrReturnVoid(pcPhysAddrWidth);
|
---|
3082 | AssertPtrReturnVoid(pcLinearAddrWidth);
|
---|
3083 |
|
---|
3084 | AssertFailed();
|
---|
3085 |
|
---|
3086 | Log(("pdmR3DevHlp_CpuGetGuestAddrWidths: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
3087 | }
|
---|
3088 |
|
---|
3089 |
|
---|
3090 | /** @interface_method_impl{PDMDEVHLPR3,pfnCpuGetGuestScalableBusFrequency} */
|
---|
3091 | static DECLCALLBACK(uint64_t) pdmR3DevHlp_CpuGetGuestScalableBusFrequency(PPDMDEVINS pDevIns)
|
---|
3092 | {
|
---|
3093 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3094 | LogFlow(("pdmR3DevHlp_CpuGetGuestScalableBusFrequency: caller='%s'/%d\n",
|
---|
3095 | pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
3096 |
|
---|
3097 | AssertFailed();
|
---|
3098 | uint64_t u64Fsb = 0;
|
---|
3099 |
|
---|
3100 | Log(("pdmR3DevHlp_CpuGetGuestScalableBusFrequency: caller='%s'/%d: returns %#RX64\n", pDevIns->pReg->szName, pDevIns->iInstance, u64Fsb));
|
---|
3101 | return u64Fsb;
|
---|
3102 | }
|
---|
3103 |
|
---|
3104 |
|
---|
3105 | /** @interface_method_impl{PDMDEVHLPR3,pfnPhysReadGCVirt} */
|
---|
3106 | static DECLCALLBACK(int) pdmR3DevHlp_PhysReadGCVirt(PPDMDEVINS pDevIns, void *pvDst, RTGCPTR GCVirtSrc, size_t cb)
|
---|
3107 | {
|
---|
3108 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3109 | LogFlow(("pdmR3DevHlp_PhysReadGCVirt: caller='%s'/%d: pvDst=%p GCVirt=%RGv cb=%#x\n",
|
---|
3110 | pDevIns->pReg->szName, pDevIns->iInstance, pvDst, GCVirtSrc, cb));
|
---|
3111 |
|
---|
3112 | int rc = VERR_NOT_IMPLEMENTED;;
|
---|
3113 | AssertFailed();
|
---|
3114 |
|
---|
3115 | LogFlow(("pdmR3DevHlp_PhysReadGCVirt: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3116 |
|
---|
3117 | return rc;
|
---|
3118 | }
|
---|
3119 |
|
---|
3120 |
|
---|
3121 | /** @interface_method_impl{PDMDEVHLPR3,pfnPhysWriteGCVirt} */
|
---|
3122 | static DECLCALLBACK(int) pdmR3DevHlp_PhysWriteGCVirt(PPDMDEVINS pDevIns, RTGCPTR GCVirtDst, const void *pvSrc, size_t cb)
|
---|
3123 | {
|
---|
3124 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3125 | LogFlow(("pdmR3DevHlp_PhysWriteGCVirt: caller='%s'/%d: GCVirtDst=%RGv pvSrc=%p cb=%#x\n",
|
---|
3126 | pDevIns->pReg->szName, pDevIns->iInstance, GCVirtDst, pvSrc, cb));
|
---|
3127 |
|
---|
3128 | int rc = VERR_NOT_IMPLEMENTED;;
|
---|
3129 | AssertFailed();
|
---|
3130 |
|
---|
3131 | LogFlow(("pdmR3DevHlp_PhysWriteGCVirt: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3132 |
|
---|
3133 | return rc;
|
---|
3134 | }
|
---|
3135 |
|
---|
3136 |
|
---|
3137 | /** @interface_method_impl{PDMDEVHLPR3,pfnPhysGCPtr2GCPhys} */
|
---|
3138 | static DECLCALLBACK(int) pdmR3DevHlp_PhysGCPtr2GCPhys(PPDMDEVINS pDevIns, RTGCPTR GCPtr, PRTGCPHYS pGCPhys)
|
---|
3139 | {
|
---|
3140 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3141 | LogFlow(("pdmR3DevHlp_PhysGCPtr2GCPhys: caller='%s'/%d: GCPtr=%RGv pGCPhys=%p\n",
|
---|
3142 | pDevIns->pReg->szName, pDevIns->iInstance, GCPtr, pGCPhys));
|
---|
3143 |
|
---|
3144 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3145 | AssertFailed();
|
---|
3146 |
|
---|
3147 | LogFlow(("pdmR3DevHlp_PhysGCPtr2GCPhys: caller='%s'/%d: returns %Rrc *pGCPhys=%RGp\n", pDevIns->pReg->szName, pDevIns->iInstance, rc, *pGCPhys));
|
---|
3148 |
|
---|
3149 | return rc;
|
---|
3150 | }
|
---|
3151 |
|
---|
3152 |
|
---|
3153 | /** @interface_method_impl{PDMDEVHLPR3,pfnMMHeapAlloc} */
|
---|
3154 | static DECLCALLBACK(void *) pdmR3DevHlp_MMHeapAlloc(PPDMDEVINS pDevIns, size_t cb)
|
---|
3155 | {
|
---|
3156 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3157 | LogFlow(("pdmR3DevHlp_MMHeapAlloc: caller='%s'/%d: cb=%#x\n", pDevIns->pReg->szName, pDevIns->iInstance, cb));
|
---|
3158 |
|
---|
3159 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
3160 | void *pv = NULL;
|
---|
3161 | AssertFailed();
|
---|
3162 | #else
|
---|
3163 | void *pv = RTMemAlloc(cb);
|
---|
3164 | #endif
|
---|
3165 |
|
---|
3166 | LogFlow(("pdmR3DevHlp_MMHeapAlloc: caller='%s'/%d: returns %p\n", pDevIns->pReg->szName, pDevIns->iInstance, pv));
|
---|
3167 | return pv;
|
---|
3168 | }
|
---|
3169 |
|
---|
3170 |
|
---|
3171 | /** @interface_method_impl{PDMDEVHLPR3,pfnMMHeapAllocZ} */
|
---|
3172 | static DECLCALLBACK(void *) pdmR3DevHlp_MMHeapAllocZ(PPDMDEVINS pDevIns, size_t cb)
|
---|
3173 | {
|
---|
3174 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3175 | LogFlow(("pdmR3DevHlp_MMHeapAllocZ: caller='%s'/%d: cb=%#x\n", pDevIns->pReg->szName, pDevIns->iInstance, cb));
|
---|
3176 |
|
---|
3177 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
3178 | void *pv = NULL;
|
---|
3179 | AssertFailed();
|
---|
3180 | #else
|
---|
3181 | void *pv = RTMemAllocZ(cb);
|
---|
3182 | #endif
|
---|
3183 |
|
---|
3184 | LogFlow(("pdmR3DevHlp_MMHeapAllocZ: caller='%s'/%d: returns %p\n", pDevIns->pReg->szName, pDevIns->iInstance, pv));
|
---|
3185 | return pv;
|
---|
3186 | }
|
---|
3187 |
|
---|
3188 |
|
---|
3189 | /** @interface_method_impl{PDMDEVHLPR3,pfnMMHeapAPrintfV} */
|
---|
3190 | static DECLCALLBACK(char *) pdmR3DevHlp_MMHeapAPrintfV(PPDMDEVINS pDevIns, MMTAG enmTag, const char *pszFormat, va_list va)
|
---|
3191 | {
|
---|
3192 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3193 | LogFlow(("pdmR3DevHlp_MMHeapAPrintfV: caller='%s'/%d: enmTag=%u pszFormat=%p:{%s}\n",
|
---|
3194 | pDevIns->pReg->szName, pDevIns->iInstance, enmTag, pszFormat, pszFormat));
|
---|
3195 |
|
---|
3196 | RT_NOREF(va);
|
---|
3197 | AssertFailed();
|
---|
3198 | char *psz = NULL;
|
---|
3199 |
|
---|
3200 | LogFlow(("pdmR3DevHlp_MMHeapAPrintfV: caller='%s'/%d: returns %p:{%s}\n",
|
---|
3201 | pDevIns->pReg->szName, pDevIns->iInstance, psz, psz));
|
---|
3202 | return psz;
|
---|
3203 | }
|
---|
3204 |
|
---|
3205 |
|
---|
3206 | /** @interface_method_impl{PDMDEVHLPR3,pfnMMHeapFree} */
|
---|
3207 | static DECLCALLBACK(void) pdmR3DevHlp_MMHeapFree(PPDMDEVINS pDevIns, void *pv)
|
---|
3208 | {
|
---|
3209 | PDMDEV_ASSERT_DEVINS(pDevIns); RT_NOREF_PV(pDevIns);
|
---|
3210 | LogFlow(("pdmR3DevHlp_MMHeapFree: caller='%s'/%d: pv=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pv));
|
---|
3211 |
|
---|
3212 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
3213 | PTSTDEVMMHEAPALLOC pHeapAlloc = (PTSTDEVMMHEAPALLOC)((uint8_t *)pv - RT_UOFFSETOF(TSTDEVMMHEAPALLOC, abAlloc[0]));
|
---|
3214 | PTSTDEVDUTINT pThis = pHeapAlloc->pDut;
|
---|
3215 |
|
---|
3216 | tstDevDutLockExcl(pThis);
|
---|
3217 | RTListNodeRemove(&pHeapAlloc->NdMmHeap);
|
---|
3218 | tstDevDutUnlockExcl(pThis);
|
---|
3219 |
|
---|
3220 | /* Poison */
|
---|
3221 | memset(&pHeapAlloc->abAlloc[0], 0xfc, pHeapAlloc->cbAlloc);
|
---|
3222 | RTMemFree(pHeapAlloc);
|
---|
3223 | #else
|
---|
3224 | RTMemFree(pv);
|
---|
3225 | #endif
|
---|
3226 |
|
---|
3227 | LogFlow(("pdmR3DevHlp_MMHeapAlloc: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
3228 | }
|
---|
3229 |
|
---|
3230 |
|
---|
3231 | /** @interface_method_impl{PDMDEVHLPR3,pfnMMPhysGetRamSize} */
|
---|
3232 | static DECLCALLBACK(uint64_t) pdmR3DevHlp_MMPhysGetRamSize(PPDMDEVINS pDevIns)
|
---|
3233 | {
|
---|
3234 | PDMDEV_ASSERT_DEVINS(pDevIns); RT_NOREF_PV(pDevIns);
|
---|
3235 | LogFlow(("pdmR3DevHlp_MMPhysGetRamSize: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
3236 |
|
---|
3237 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
3238 | AssertFailed();
|
---|
3239 | uint64_t cb = 0;
|
---|
3240 | #else
|
---|
3241 | uint64_t cb = _4G;
|
---|
3242 | #endif
|
---|
3243 |
|
---|
3244 | LogFlow(("pdmR3DevHlp_MMPhysGetRamSize: caller='%s'/%d: returns %RU64\n",
|
---|
3245 | pDevIns->pReg->szName, pDevIns->iInstance, cb));
|
---|
3246 | return cb;
|
---|
3247 | }
|
---|
3248 |
|
---|
3249 |
|
---|
3250 | /** @interface_method_impl{PDMDEVHLPR3,pfnMMPhysGetRamSizeBelow4GB} */
|
---|
3251 | static DECLCALLBACK(uint32_t) pdmR3DevHlp_MMPhysGetRamSizeBelow4GB(PPDMDEVINS pDevIns)
|
---|
3252 | {
|
---|
3253 | PDMDEV_ASSERT_DEVINS(pDevIns); RT_NOREF_PV(pDevIns);
|
---|
3254 | LogFlow(("pdmR3DevHlp_MMPhysGetRamSizeBelow4GB: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
3255 |
|
---|
3256 | AssertFailed();
|
---|
3257 | uint32_t cb = 0;
|
---|
3258 |
|
---|
3259 | LogFlow(("pdmR3DevHlp_MMPhysGetRamSizeBelow4GB: caller='%s'/%d: returns %RU32\n",
|
---|
3260 | pDevIns->pReg->szName, pDevIns->iInstance, cb));
|
---|
3261 | return cb;
|
---|
3262 | }
|
---|
3263 |
|
---|
3264 |
|
---|
3265 | /** @interface_method_impl{PDMDEVHLPR3,pfnMMPhysGetRamSizeAbove4GB} */
|
---|
3266 | static DECLCALLBACK(uint64_t) pdmR3DevHlp_MMPhysGetRamSizeAbove4GB(PPDMDEVINS pDevIns)
|
---|
3267 | {
|
---|
3268 | PDMDEV_ASSERT_DEVINS(pDevIns); RT_NOREF_PV(pDevIns);
|
---|
3269 | LogFlow(("pdmR3DevHlp_MMPhysGetRamSizeAbove4GB: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
3270 |
|
---|
3271 | AssertFailed();
|
---|
3272 | uint64_t cb = 0;
|
---|
3273 |
|
---|
3274 | LogFlow(("pdmR3DevHlp_MMPhysGetRamSizeAbove4GB: caller='%s'/%d: returns %RU64\n",
|
---|
3275 | pDevIns->pReg->szName, pDevIns->iInstance, cb));
|
---|
3276 | return cb;
|
---|
3277 | }
|
---|
3278 |
|
---|
3279 |
|
---|
3280 | /** @interface_method_impl{PDMDEVHLPR3,pfnVMState} */
|
---|
3281 | static DECLCALLBACK(VMSTATE) pdmR3DevHlp_VMState(PPDMDEVINS pDevIns)
|
---|
3282 | {
|
---|
3283 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3284 |
|
---|
3285 | VMSTATE enmVMState = VMSTATE_CREATING;
|
---|
3286 | AssertFailed();
|
---|
3287 |
|
---|
3288 | LogFlow(("pdmR3DevHlp_VMState: caller='%s'/%d: returns %d\n", pDevIns->pReg->szName, pDevIns->iInstance,
|
---|
3289 | enmVMState));
|
---|
3290 | return enmVMState;
|
---|
3291 | }
|
---|
3292 |
|
---|
3293 |
|
---|
3294 | /** @interface_method_impl{PDMDEVHLPR3,pfnVMTeleportedAndNotFullyResumedYet} */
|
---|
3295 | static DECLCALLBACK(bool) pdmR3DevHlp_VMTeleportedAndNotFullyResumedYet(PPDMDEVINS pDevIns)
|
---|
3296 | {
|
---|
3297 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3298 |
|
---|
3299 | bool fRc = false;
|
---|
3300 |
|
---|
3301 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
3302 | AssertFailed();
|
---|
3303 | #endif
|
---|
3304 |
|
---|
3305 | LogFlow(("pdmR3DevHlp_VMState: caller='%s'/%d: returns %RTbool\n", pDevIns->pReg->szName, pDevIns->iInstance,
|
---|
3306 | fRc));
|
---|
3307 | return fRc;
|
---|
3308 | }
|
---|
3309 |
|
---|
3310 |
|
---|
3311 | /** @interface_method_impl{PDMDEVHLPR3,pfnVMSetErrorV} */
|
---|
3312 | static DECLCALLBACK(int) pdmR3DevHlp_VMSetErrorV(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)
|
---|
3313 | {
|
---|
3314 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3315 |
|
---|
3316 | RT_NOREF(pDevIns, rc, RT_SRC_POS_ARGS, pszFormat, va);
|
---|
3317 | AssertFailed();
|
---|
3318 |
|
---|
3319 | return VERR_NOT_IMPLEMENTED;
|
---|
3320 | }
|
---|
3321 |
|
---|
3322 |
|
---|
3323 | /** @interface_method_impl{PDMDEVHLPR3,pfnVMSetRuntimeErrorV} */
|
---|
3324 | static DECLCALLBACK(int) pdmR3DevHlp_VMSetRuntimeErrorV(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va)
|
---|
3325 | {
|
---|
3326 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3327 |
|
---|
3328 | RT_NOREF(pDevIns, fFlags, pszErrorId, pszFormat, va);
|
---|
3329 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3330 | AssertFailed();
|
---|
3331 |
|
---|
3332 | return rc;
|
---|
3333 | }
|
---|
3334 |
|
---|
3335 |
|
---|
3336 | /** @interface_method_impl{PDMDEVHLPR3,pfnVMWaitForDeviceReady} */
|
---|
3337 | static DECLCALLBACK(int) pdmR3DevHlp_VMWaitForDeviceReady(PPDMDEVINS pDevIns, VMCPUID idCpu)
|
---|
3338 | {
|
---|
3339 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3340 | LogFlow(("pdmR3DevHlp_VMWaitForDeviceReady: caller='%s'/%d: idCpu=%u\n", pDevIns->pReg->szName, pDevIns->iInstance, idCpu));
|
---|
3341 |
|
---|
3342 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3343 | AssertFailed();
|
---|
3344 |
|
---|
3345 | LogFlow(("pdmR3DevHlp_VMWaitForDeviceReady: caller='%s'/%d: returns %Rrc\n",
|
---|
3346 | pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3347 | return rc;
|
---|
3348 | }
|
---|
3349 |
|
---|
3350 |
|
---|
3351 | /** @interface_method_impl{PDMDEVHLPR3,pfnVMNotifyCpuDeviceReady} */
|
---|
3352 | static DECLCALLBACK(int) pdmR3DevHlp_VMNotifyCpuDeviceReady(PPDMDEVINS pDevIns, VMCPUID idCpu)
|
---|
3353 | {
|
---|
3354 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3355 | LogFlow(("pdmR3DevHlp_VMNotifyCpuDeviceReady: caller='%s'/%d: idCpu=%u\n", pDevIns->pReg->szName, pDevIns->iInstance, idCpu));
|
---|
3356 |
|
---|
3357 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3358 | AssertFailed();
|
---|
3359 |
|
---|
3360 | LogFlow(("pdmR3DevHlp_VMNotifyCpuDeviceReady: caller='%s'/%d: returns %Rrc\n",
|
---|
3361 | pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3362 | return rc;
|
---|
3363 | }
|
---|
3364 |
|
---|
3365 |
|
---|
3366 | /** @interface_method_impl{PDMDEVHLPR3,pfnVMReqCallNoWaitV} */
|
---|
3367 | static DECLCALLBACK(int) pdmR3DevHlp_VMReqCallNoWaitV(PPDMDEVINS pDevIns, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, va_list Args)
|
---|
3368 | {
|
---|
3369 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3370 | LogFlow(("pdmR3DevHlp_VMReqCallNoWaitV: caller='%s'/%d: idDstCpu=%u pfnFunction=%p cArgs=%u\n",
|
---|
3371 | pDevIns->pReg->szName, pDevIns->iInstance, idDstCpu, pfnFunction, cArgs));
|
---|
3372 |
|
---|
3373 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3374 | AssertFailed(); RT_NOREF(Args);
|
---|
3375 |
|
---|
3376 | LogFlow(("pdmR3DevHlp_VMReqCallNoWaitV: caller='%s'/%d: returns %Rrc\n",
|
---|
3377 | pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3378 | return rc;
|
---|
3379 | }
|
---|
3380 |
|
---|
3381 |
|
---|
3382 | /** @interface_method_impl{PDMDEVHLPR3,pfnVMReqPriorityCallWaitV} */
|
---|
3383 | static DECLCALLBACK(int) pdmR3DevHlp_VMReqPriorityCallWaitV(PPDMDEVINS pDevIns, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, va_list Args)
|
---|
3384 | {
|
---|
3385 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3386 | LogFlow(("pdmR3DevHlp_VMReqCallNoWaitV: caller='%s'/%d: idDstCpu=%u pfnFunction=%p cArgs=%u\n",
|
---|
3387 | pDevIns->pReg->szName, pDevIns->iInstance, idDstCpu, pfnFunction, cArgs));
|
---|
3388 |
|
---|
3389 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3390 | AssertFailed(); RT_NOREF(Args);
|
---|
3391 |
|
---|
3392 | LogFlow(("pdmR3DevHlp_VMReqCallNoWaitV: caller='%s'/%d: returns %Rrc\n",
|
---|
3393 | pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3394 | return rc;
|
---|
3395 | }
|
---|
3396 |
|
---|
3397 |
|
---|
3398 | /** @interface_method_impl{PDMDEVHLPR3,pfnDBGFStopV} */
|
---|
3399 | static DECLCALLBACK(int) pdmR3DevHlp_DBGFStopV(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction, const char *pszFormat, va_list args)
|
---|
3400 | {
|
---|
3401 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3402 | #ifdef LOG_ENABLED
|
---|
3403 | va_list va2;
|
---|
3404 | va_copy(va2, args);
|
---|
3405 | LogFlow(("pdmR3DevHlp_DBGFStopV: caller='%s'/%d: pszFile=%p:{%s} iLine=%d pszFunction=%p:{%s} pszFormat=%p:{%s} (%N)\n",
|
---|
3406 | pDevIns->pReg->szName, pDevIns->iInstance, pszFile, pszFile, iLine, pszFunction, pszFunction, pszFormat, pszFormat, pszFormat, &va2));
|
---|
3407 | va_end(va2);
|
---|
3408 | #endif
|
---|
3409 |
|
---|
3410 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3411 | AssertFailed();
|
---|
3412 |
|
---|
3413 | LogFlow(("pdmR3DevHlp_DBGFStopV: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3414 | return rc;
|
---|
3415 | }
|
---|
3416 |
|
---|
3417 |
|
---|
3418 | /** @interface_method_impl{PDMDEVHLPR3,pfnDBGFInfoRegister} */
|
---|
3419 | static DECLCALLBACK(int) pdmR3DevHlp_DBGFInfoRegister(PPDMDEVINS pDevIns, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDEV pfnHandler)
|
---|
3420 | {
|
---|
3421 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3422 | LogFlow(("pdmR3DevHlp_DBGFInfoRegister: caller='%s'/%d: pszName=%p:{%s} pszDesc=%p:{%s} pfnHandler=%p\n",
|
---|
3423 | pDevIns->pReg->szName, pDevIns->iInstance, pszName, pszName, pszDesc, pszDesc, pfnHandler));
|
---|
3424 |
|
---|
3425 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
3426 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3427 | AssertFailed();
|
---|
3428 | #else
|
---|
3429 | int rc = VINF_SUCCESS;
|
---|
3430 | #endif
|
---|
3431 |
|
---|
3432 |
|
---|
3433 | LogFlow(("pdmR3DevHlp_DBGFInfoRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3434 | return rc;
|
---|
3435 | }
|
---|
3436 |
|
---|
3437 |
|
---|
3438 | /** @interface_method_impl{PDMDEVHLPR3,pfnDBGFInfoRegisterArgv} */
|
---|
3439 | static DECLCALLBACK(int) pdmR3DevHlp_DBGFInfoRegisterArgv(PPDMDEVINS pDevIns, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVDEV pfnHandler)
|
---|
3440 | {
|
---|
3441 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3442 | LogFlow(("pdmR3DevHlp_DBGFInfoRegisterArgv: caller='%s'/%d: pszName=%p:{%s} pszDesc=%p:{%s} pfnHandler=%p\n",
|
---|
3443 | pDevIns->pReg->szName, pDevIns->iInstance, pszName, pszName, pszDesc, pszDesc, pfnHandler));
|
---|
3444 |
|
---|
3445 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
3446 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3447 | AssertFailed();
|
---|
3448 | #else
|
---|
3449 | int rc = VINF_SUCCESS;
|
---|
3450 | #endif
|
---|
3451 |
|
---|
3452 | LogFlow(("pdmR3DevHlp_DBGFInfoRegisterArgv: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3453 | return rc;
|
---|
3454 | }
|
---|
3455 |
|
---|
3456 |
|
---|
3457 | /** @interface_method_impl{PDMDEVHLPR3,pfnDBGFRegRegister} */
|
---|
3458 | static DECLCALLBACK(int) pdmR3DevHlp_DBGFRegRegister(PPDMDEVINS pDevIns, PCDBGFREGDESC paRegisters)
|
---|
3459 | {
|
---|
3460 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3461 | LogFlow(("pdmR3DevHlp_DBGFRegRegister: caller='%s'/%d: paRegisters=%p\n",
|
---|
3462 | pDevIns->pReg->szName, pDevIns->iInstance, paRegisters));
|
---|
3463 |
|
---|
3464 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3465 | AssertFailed();
|
---|
3466 |
|
---|
3467 | LogFlow(("pdmR3DevHlp_DBGFRegRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3468 | return rc;
|
---|
3469 | }
|
---|
3470 |
|
---|
3471 |
|
---|
3472 | /** @interface_method_impl{PDMDEVHLPR3,pfnDBGFTraceBuf} */
|
---|
3473 | static DECLCALLBACK(RTTRACEBUF) pdmR3DevHlp_DBGFTraceBuf(PPDMDEVINS pDevIns)
|
---|
3474 | {
|
---|
3475 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3476 | RTTRACEBUF hTraceBuf = NIL_RTTRACEBUF;
|
---|
3477 | AssertFailed();
|
---|
3478 | LogFlow(("pdmR3DevHlp_DBGFTraceBuf: caller='%s'/%d: returns %p\n", pDevIns->pReg->szName, pDevIns->iInstance, hTraceBuf));
|
---|
3479 | return hTraceBuf;
|
---|
3480 | }
|
---|
3481 |
|
---|
3482 |
|
---|
3483 | /** @interface_method_impl{PDMDEVHLPR3,pfnDBGFReportBugCheck} */
|
---|
3484 | static DECLCALLBACK(VBOXSTRICTRC) pdmR3DevHlp_DBGFReportBugCheck(PPDMDEVINS pDevIns, DBGFEVENTTYPE enmEvent, uint64_t uBugCheck,
|
---|
3485 | uint64_t uP1, uint64_t uP2, uint64_t uP3, uint64_t uP4)
|
---|
3486 | {
|
---|
3487 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3488 | LogFlow(("pdmR3DevHlp_DBGFReportBugCheck: caller='%s'/%d: enmEvent=%u uBugCheck=%#x uP1=%#x uP2=%#x uP3=%#x uP4=%#x\n",
|
---|
3489 | pDevIns->pReg->szName, pDevIns->iInstance, enmEvent, uBugCheck, uP1, uP2, uP3, uP4));
|
---|
3490 |
|
---|
3491 | AssertFailed();
|
---|
3492 | VBOXSTRICTRC rcStrict = VERR_NOT_IMPLEMENTED;
|
---|
3493 |
|
---|
3494 | LogFlow(("pdmR3DevHlp_DBGFReportBugCheck: caller='%s'/%d: returns %Rrc\n",
|
---|
3495 | pDevIns->pReg->szName, pDevIns->iInstance, VBOXSTRICTRC_VAL(rcStrict)));
|
---|
3496 | return rcStrict;
|
---|
3497 | }
|
---|
3498 |
|
---|
3499 |
|
---|
3500 | /** @interface_method_impl{PDMDEVHLPR3,pfnDBGFCoreWrite} */
|
---|
3501 | static DECLCALLBACK(int) pdmR3DevHlp_DBGFCoreWrite(PPDMDEVINS pDevIns, const char *pszFilename, bool fReplaceFile)
|
---|
3502 | {
|
---|
3503 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3504 | LogFlow(("pdmR3DevHlp_DBGFCoreWrite: caller='%s'/%d: pszFilename=%p:{%s} fReplaceFile=%RTbool\n",
|
---|
3505 | pDevIns->pReg->szName, pDevIns->iInstance, pszFilename, pszFilename, fReplaceFile));
|
---|
3506 |
|
---|
3507 | AssertFailed();
|
---|
3508 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3509 |
|
---|
3510 | LogFlow(("pdmR3DevHlp_DBGFCoreWrite: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3511 | return rc;
|
---|
3512 | }
|
---|
3513 |
|
---|
3514 |
|
---|
3515 | /** @interface_method_impl{PDMDEVHLPR3,pfnDBGFInfoLogHlp} */
|
---|
3516 | static DECLCALLBACK(PCDBGFINFOHLP) pdmR3DevHlp_DBGFInfoLogHlp(PPDMDEVINS pDevIns)
|
---|
3517 | {
|
---|
3518 | PDMDEV_ASSERT_DEVINS(pDevIns); RT_NOREF(pDevIns);
|
---|
3519 | LogFlow(("pdmR3DevHlp_DBGFInfoLogHlp: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
3520 |
|
---|
3521 | AssertFailed();
|
---|
3522 | PCDBGFINFOHLP pHlp = NULL;
|
---|
3523 |
|
---|
3524 | LogFlow(("pdmR3DevHlp_DBGFInfoLogHlp: caller='%s'/%d: returns %p\n", pDevIns->pReg->szName, pDevIns->iInstance, pHlp));
|
---|
3525 | return pHlp;
|
---|
3526 | }
|
---|
3527 |
|
---|
3528 |
|
---|
3529 | /** @interface_method_impl{PDMDEVHLPR3,pfnDBGFRegNmQueryU64} */
|
---|
3530 | static DECLCALLBACK(int) pdmR3DevHlp_DBGFRegNmQueryU64(PPDMDEVINS pDevIns, VMCPUID idDefCpu, const char *pszReg, uint64_t *pu64)
|
---|
3531 | {
|
---|
3532 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3533 | LogFlow(("pdmR3DevHlp_DBGFRegNmQueryU64: caller='%s'/%d: idDefCpu=%u pszReg=%p:{%s} pu64=%p\n",
|
---|
3534 | pDevIns->pReg->szName, pDevIns->iInstance, idDefCpu, pszReg, pszReg, pu64));
|
---|
3535 |
|
---|
3536 | AssertFailed();
|
---|
3537 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3538 |
|
---|
3539 | LogFlow(("pdmR3DevHlp_DBGFRegNmQueryU64: caller='%s'/%d: returns %Rrc *pu64=%#RX64\n",
|
---|
3540 | pDevIns->pReg->szName, pDevIns->iInstance, rc, *pu64));
|
---|
3541 | return rc;
|
---|
3542 | }
|
---|
3543 |
|
---|
3544 |
|
---|
3545 | /** @interface_method_impl{PDMDEVHLPR3,pfnDBGFRegPrintfV} */
|
---|
3546 | static DECLCALLBACK(int) pdmR3DevHlp_DBGFRegPrintfV(PPDMDEVINS pDevIns, VMCPUID idCpu, char *pszBuf, size_t cbBuf,
|
---|
3547 | const char *pszFormat, va_list va)
|
---|
3548 | {
|
---|
3549 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3550 | LogFlow(("pdmR3DevHlp_DBGFRegPrintfV: caller='%s'/%d: idCpu=%u pszBuf=%p cbBuf=%u pszFormat=%p:{%s}\n",
|
---|
3551 | pDevIns->pReg->szName, pDevIns->iInstance, idCpu, pszBuf, cbBuf, pszFormat, pszFormat));
|
---|
3552 |
|
---|
3553 | AssertFailed();
|
---|
3554 | RT_NOREF(va);
|
---|
3555 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3556 |
|
---|
3557 | LogFlow(("pdmR3DevHlp_DBGFRegPrintfV: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3558 | return rc;
|
---|
3559 | }
|
---|
3560 |
|
---|
3561 |
|
---|
3562 | /** @interface_method_impl{PDMDEVHLPR3,pfnSTAMRegister} */
|
---|
3563 | static DECLCALLBACK(void) pdmR3DevHlp_STAMRegister(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, const char *pszName,
|
---|
3564 | STAMUNIT enmUnit, const char *pszDesc)
|
---|
3565 | {
|
---|
3566 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3567 |
|
---|
3568 | RT_NOREF(pDevIns, pvSample, enmType, pszName, enmUnit, pszDesc);
|
---|
3569 |
|
---|
3570 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
3571 | AssertFailed();
|
---|
3572 | #endif
|
---|
3573 | }
|
---|
3574 |
|
---|
3575 |
|
---|
3576 | /** @interface_method_impl{PDMDEVHLPR3,pfnSTAMRegisterV} */
|
---|
3577 | static DECLCALLBACK(void) pdmR3DevHlp_STAMRegisterV(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
|
---|
3578 | STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list args)
|
---|
3579 | {
|
---|
3580 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3581 |
|
---|
3582 | RT_NOREF(pDevIns, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, args);
|
---|
3583 |
|
---|
3584 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
3585 | AssertFailed();
|
---|
3586 | #endif
|
---|
3587 | }
|
---|
3588 |
|
---|
3589 |
|
---|
3590 | /**
|
---|
3591 | * @interface_method_impl{PDMDEVHLPR3,pfnPCIRegister}
|
---|
3592 | */
|
---|
3593 | static DECLCALLBACK(int) pdmR3DevHlp_PCIRegister(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t fFlags,
|
---|
3594 | uint8_t uPciDevNo, uint8_t uPciFunNo, const char *pszName)
|
---|
3595 | {
|
---|
3596 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3597 | LogFlow(("pdmR3DevHlp_PCIRegister: caller='%s'/%d: pPciDev=%p:{.config={%#.256Rhxs} fFlags=%#x uPciDevNo=%#x uPciFunNo=%#x pszName=%p:{%s}\n",
|
---|
3598 | pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev->abConfig, fFlags, uPciDevNo, uPciFunNo, pszName, pszName ? pszName : ""));
|
---|
3599 |
|
---|
3600 | /*
|
---|
3601 | * Validate input.
|
---|
3602 | */
|
---|
3603 | AssertLogRelMsgReturn(pDevIns->pReg->cMaxPciDevices > 0,
|
---|
3604 | ("'%s'/%d: cMaxPciDevices is 0\n", pDevIns->pReg->szName, pDevIns->iInstance),
|
---|
3605 | VERR_WRONG_ORDER);
|
---|
3606 | AssertLogRelMsgReturn(RT_VALID_PTR(pPciDev),
|
---|
3607 | ("'%s'/%d: Invalid pPciDev value: %p\n", pDevIns->pReg->szName, pDevIns->iInstance, pPciDev),
|
---|
3608 | VERR_INVALID_POINTER);
|
---|
3609 | AssertLogRelMsgReturn(PDMPciDevGetVendorId(pPciDev),
|
---|
3610 | ("'%s'/%d: Vendor ID is not set!\n", pDevIns->pReg->szName, pDevIns->iInstance),
|
---|
3611 | VERR_INVALID_POINTER);
|
---|
3612 | AssertLogRelMsgReturn( uPciDevNo < 32
|
---|
3613 | || uPciDevNo == PDMPCIDEVREG_DEV_NO_FIRST_UNUSED
|
---|
3614 | || uPciDevNo == PDMPCIDEVREG_DEV_NO_SAME_AS_PREV,
|
---|
3615 | ("'%s'/%d: Invalid PCI device number: %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, uPciDevNo),
|
---|
3616 | VERR_INVALID_PARAMETER);
|
---|
3617 | AssertLogRelMsgReturn( uPciFunNo < 8
|
---|
3618 | || uPciFunNo == PDMPCIDEVREG_FUN_NO_FIRST_UNUSED,
|
---|
3619 | ("'%s'/%d: Invalid PCI funcion number: %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, uPciFunNo),
|
---|
3620 | VERR_INVALID_PARAMETER);
|
---|
3621 | AssertLogRelMsgReturn(!(fFlags & ~PDMPCIDEVREG_F_VALID_MASK),
|
---|
3622 | ("'%s'/%d: Invalid flags: %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, fFlags),
|
---|
3623 | VERR_INVALID_FLAGS);
|
---|
3624 | if (!pszName)
|
---|
3625 | pszName = pDevIns->pReg->szName;
|
---|
3626 |
|
---|
3627 | #if 0
|
---|
3628 | AssertLogRelReturn(RT_VALID_PTR(pszName), VERR_INVALID_POINTER);
|
---|
3629 | AssertLogRelReturn(!pPciDev->Int.s.fRegistered, VERR_PDM_NOT_PCI_DEVICE);
|
---|
3630 | AssertLogRelReturn(pPciDev == PDMDEV_GET_PPCIDEV(pDevIns, pPciDev->Int.s.idxSubDev), VERR_PDM_NOT_PCI_DEVICE);
|
---|
3631 | AssertLogRelReturn(pPciDev == PDMDEV_CALC_PPCIDEV(pDevIns, pPciDev->Int.s.idxSubDev), VERR_PDM_NOT_PCI_DEVICE);
|
---|
3632 | AssertMsgReturn(pPciDev->u32Magic == PDMPCIDEV_MAGIC, ("%#x\n", pPciDev->u32Magic), VERR_PDM_NOT_PCI_DEVICE);
|
---|
3633 | #endif
|
---|
3634 |
|
---|
3635 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
3636 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3637 | AssertFailed();
|
---|
3638 | #else
|
---|
3639 | int rc = VINF_SUCCESS;
|
---|
3640 | #endif
|
---|
3641 |
|
---|
3642 | LogFlow(("pdmR3DevHlp_PCIRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3643 | return rc;
|
---|
3644 | }
|
---|
3645 |
|
---|
3646 |
|
---|
3647 | /** @interface_method_impl{PDMDEVHLPR3,pfnPCIRegisterMsi} */
|
---|
3648 | static DECLCALLBACK(int) pdmR3DevHlp_PCIRegisterMsi(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, PPDMMSIREG pMsiReg)
|
---|
3649 | {
|
---|
3650 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3651 | if (!pPciDev) /* NULL is an alias for the default PCI device. */
|
---|
3652 | pPciDev = pDevIns->apPciDevs[0];
|
---|
3653 | AssertReturn(pPciDev, VERR_PDM_NOT_PCI_DEVICE);
|
---|
3654 | LogFlow(("pdmR3DevHlp_PCIRegisterMsi: caller='%s'/%d: pPciDev=%p:{%#x} pMsgReg=%p:{cMsiVectors=%d, cMsixVectors=%d}\n",
|
---|
3655 | pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev->uDevFn, pMsiReg, pMsiReg->cMsiVectors, pMsiReg->cMsixVectors));
|
---|
3656 | PDMPCIDEV_ASSERT_VALID_RET(pDevIns, pPciDev);
|
---|
3657 |
|
---|
3658 | AssertLogRelMsgReturn(pDevIns->pReg->cMaxPciDevices > 0,
|
---|
3659 | ("'%s'/%d: cMaxPciDevices is 0\n", pDevIns->pReg->szName, pDevIns->iInstance),
|
---|
3660 | VERR_WRONG_ORDER);
|
---|
3661 | AssertLogRelMsgReturn(pMsiReg->cMsixVectors <= pDevIns->pReg->cMaxMsixVectors,
|
---|
3662 | ("'%s'/%d: cMsixVectors=%u cMaxMsixVectors=%u\n",
|
---|
3663 | pDevIns->pReg->szName, pDevIns->iInstance, pMsiReg->cMsixVectors, pDevIns->pReg->cMaxMsixVectors),
|
---|
3664 | VERR_INVALID_FLAGS);
|
---|
3665 |
|
---|
3666 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
3667 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3668 | AssertFailed();
|
---|
3669 | #else
|
---|
3670 | int rc = VINF_SUCCESS;
|
---|
3671 | #endif
|
---|
3672 |
|
---|
3673 |
|
---|
3674 | LogFlow(("pdmR3DevHlp_PCIRegisterMsi: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3675 | return rc;
|
---|
3676 | }
|
---|
3677 |
|
---|
3678 |
|
---|
3679 | /** @interface_method_impl{PDMDEVHLPR3,pfnPCIIORegionRegister} */
|
---|
3680 | static DECLCALLBACK(int) pdmR3DevHlp_PCIIORegionRegister(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion,
|
---|
3681 | RTGCPHYS cbRegion, PCIADDRESSSPACE enmType, uint32_t fFlags,
|
---|
3682 | uint64_t hHandle, PFNPCIIOREGIONMAP pfnMapUnmap)
|
---|
3683 | {
|
---|
3684 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3685 | if (!pPciDev) /* NULL is an alias for the default PCI device. */
|
---|
3686 | pPciDev = pDevIns->apPciDevs[0];
|
---|
3687 | AssertReturn(pPciDev, VERR_PDM_NOT_PCI_DEVICE);
|
---|
3688 | LogFlow(("pdmR3DevHlp_PCIIORegionRegister: caller='%s'/%d: pPciDev=%p:{%#x} iRegion=%d cbRegion=%RGp enmType=%d fFlags=%#x, hHandle=%#RX64 pfnMapUnmap=%p\n",
|
---|
3689 | pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev->uDevFn, iRegion, cbRegion, enmType, fFlags, hHandle, pfnMapUnmap));
|
---|
3690 |
|
---|
3691 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
3692 | PDMPCIDEV_ASSERT_VALID_RET(pDevIns, pPciDev);
|
---|
3693 | #endif
|
---|
3694 |
|
---|
3695 | /*
|
---|
3696 | * Validate input.
|
---|
3697 | */
|
---|
3698 | if (iRegion >= VBOX_PCI_NUM_REGIONS)
|
---|
3699 | {
|
---|
3700 | Assert(iRegion < VBOX_PCI_NUM_REGIONS);
|
---|
3701 | LogFlow(("pdmR3DevHlp_PCIIORegionRegister: caller='%s'/%d: returns %Rrc (iRegion)\n", pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER));
|
---|
3702 | return VERR_INVALID_PARAMETER;
|
---|
3703 | }
|
---|
3704 |
|
---|
3705 | switch ((int)enmType)
|
---|
3706 | {
|
---|
3707 | case PCI_ADDRESS_SPACE_IO:
|
---|
3708 | /*
|
---|
3709 | * Sanity check: don't allow to register more than 32K of the PCI I/O space.
|
---|
3710 | */
|
---|
3711 | AssertLogRelMsgReturn(cbRegion <= _32K,
|
---|
3712 | ("caller='%s'/%d: %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, cbRegion),
|
---|
3713 | VERR_INVALID_PARAMETER);
|
---|
3714 | break;
|
---|
3715 |
|
---|
3716 | case PCI_ADDRESS_SPACE_MEM:
|
---|
3717 | case PCI_ADDRESS_SPACE_MEM_PREFETCH:
|
---|
3718 | /*
|
---|
3719 | * Sanity check: Don't allow to register more than 2GB of the PCI MMIO space.
|
---|
3720 | */
|
---|
3721 | AssertLogRelMsgReturn(cbRegion <= MM_MMIO_32_MAX,
|
---|
3722 | ("caller='%s'/%d: %RGp (max %RGp)\n",
|
---|
3723 | pDevIns->pReg->szName, pDevIns->iInstance, cbRegion, (RTGCPHYS)MM_MMIO_32_MAX),
|
---|
3724 | VERR_OUT_OF_RANGE);
|
---|
3725 | break;
|
---|
3726 |
|
---|
3727 | case PCI_ADDRESS_SPACE_BAR64 | PCI_ADDRESS_SPACE_MEM:
|
---|
3728 | case PCI_ADDRESS_SPACE_BAR64 | PCI_ADDRESS_SPACE_MEM_PREFETCH:
|
---|
3729 | /*
|
---|
3730 | * Sanity check: Don't allow to register more than 64GB of the 64-bit PCI MMIO space.
|
---|
3731 | */
|
---|
3732 | AssertLogRelMsgReturn(cbRegion <= MM_MMIO_64_MAX,
|
---|
3733 | ("caller='%s'/%d: %RGp (max %RGp)\n",
|
---|
3734 | pDevIns->pReg->szName, pDevIns->iInstance, cbRegion, MM_MMIO_64_MAX),
|
---|
3735 | VERR_OUT_OF_RANGE);
|
---|
3736 | break;
|
---|
3737 |
|
---|
3738 | default:
|
---|
3739 | AssertMsgFailed(("enmType=%#x is unknown\n", enmType));
|
---|
3740 | LogFlow(("pdmR3DevHlp_PCIIORegionRegister: caller='%s'/%d: returns %Rrc (enmType)\n", pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER));
|
---|
3741 | return VERR_INVALID_PARAMETER;
|
---|
3742 | }
|
---|
3743 |
|
---|
3744 | AssertMsgReturn( pfnMapUnmap
|
---|
3745 | || ( hHandle != UINT64_MAX
|
---|
3746 | && (fFlags & PDMPCIDEV_IORGN_F_HANDLE_MASK) != PDMPCIDEV_IORGN_F_NO_HANDLE),
|
---|
3747 | ("caller='%s'/%d: fFlags=%#x hHandle=%#RX64\n", pDevIns->pReg->szName, pDevIns->iInstance, fFlags, hHandle),
|
---|
3748 | VERR_INVALID_PARAMETER);
|
---|
3749 |
|
---|
3750 | AssertMsgReturn(!(fFlags & ~PDMPCIDEV_IORGN_F_VALID_MASK), ("fFlags=%#x\n", fFlags), VERR_INVALID_FLAGS);
|
---|
3751 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
3752 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3753 | AssertFailed();
|
---|
3754 | #else
|
---|
3755 | int rc = VINF_SUCCESS;
|
---|
3756 | #endif
|
---|
3757 |
|
---|
3758 | LogFlow(("pdmR3DevHlp_PCIIORegionRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3759 | return rc;
|
---|
3760 | }
|
---|
3761 |
|
---|
3762 |
|
---|
3763 | /** @interface_method_impl{PDMDEVHLPR3,pfnPCIInterceptConfigAccesses} */
|
---|
3764 | static DECLCALLBACK(int) pdmR3DevHlp_PCIInterceptConfigAccesses(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev,
|
---|
3765 | PFNPCICONFIGREAD pfnRead, PFNPCICONFIGWRITE pfnWrite)
|
---|
3766 | {
|
---|
3767 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3768 | if (!pPciDev) /* NULL is an alias for the default PCI device. */
|
---|
3769 | pPciDev = pDevIns->apPciDevs[0];
|
---|
3770 | AssertReturn(pPciDev, VERR_PDM_NOT_PCI_DEVICE);
|
---|
3771 | LogFlow(("pdmR3DevHlp_PCIInterceptConfigAccesses: caller='%s'/%d: pPciDev=%p pfnRead=%p pfnWrite=%p\n",
|
---|
3772 | pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pfnRead, pfnWrite));
|
---|
3773 |
|
---|
3774 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
3775 | PDMPCIDEV_ASSERT_VALID_RET(pDevIns, pPciDev);
|
---|
3776 |
|
---|
3777 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3778 | AssertFailed();
|
---|
3779 | #else
|
---|
3780 | int rc = VINF_SUCCESS;
|
---|
3781 | #endif
|
---|
3782 |
|
---|
3783 | LogFlow(("pdmR3DevHlp_PCIInterceptConfigAccesses: caller='%s'/%d: returns %Rrc\n",
|
---|
3784 | pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
3785 | return rc;
|
---|
3786 | }
|
---|
3787 |
|
---|
3788 |
|
---|
3789 | /** @interface_method_impl{PDMDEVHLPR3,pfnPCIConfigWrite} */
|
---|
3790 | static DECLCALLBACK(VBOXSTRICTRC)
|
---|
3791 | pdmR3DevHlp_PCIConfigWrite(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t uAddress, unsigned cb, uint32_t u32Value)
|
---|
3792 | {
|
---|
3793 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3794 | AssertPtrReturn(pPciDev, VERR_PDM_NOT_PCI_DEVICE);
|
---|
3795 | LogFlow(("pdmR3DevHlp_PCIConfigWrite: caller='%s'/%d: pPciDev=%p uAddress=%#x cd=%d u32Value=%#x\n",
|
---|
3796 | pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, uAddress, cb, u32Value));
|
---|
3797 |
|
---|
3798 | VBOXSTRICTRC rcStrict = VERR_NOT_IMPLEMENTED;
|
---|
3799 | AssertFailed();
|
---|
3800 |
|
---|
3801 | LogFlow(("pdmR3DevHlp_PCIConfigWrite: caller='%s'/%d: returns %Rrc\n",
|
---|
3802 | pDevIns->pReg->szName, pDevIns->iInstance, VBOXSTRICTRC_VAL(rcStrict)));
|
---|
3803 | return rcStrict;
|
---|
3804 | }
|
---|
3805 |
|
---|
3806 |
|
---|
3807 | /** @interface_method_impl{PDMDEVHLPR3,pfnPCIConfigRead} */
|
---|
3808 | static DECLCALLBACK(VBOXSTRICTRC)
|
---|
3809 | pdmR3DevHlp_PCIConfigRead(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t uAddress, unsigned cb, uint32_t *pu32Value)
|
---|
3810 | {
|
---|
3811 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3812 | AssertPtrReturn(pPciDev, VERR_PDM_NOT_PCI_DEVICE);
|
---|
3813 | LogFlow(("pdmR3DevHlp_PCIConfigRead: caller='%s'/%d: pPciDev=%p uAddress=%#x cd=%d pu32Value=%p:{%#x}\n",
|
---|
3814 | pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, uAddress, cb, pu32Value, *pu32Value));
|
---|
3815 |
|
---|
3816 | VBOXSTRICTRC rcStrict = VERR_NOT_IMPLEMENTED;
|
---|
3817 | AssertFailed();
|
---|
3818 |
|
---|
3819 | LogFlow(("pdmR3DevHlp_PCIConfigRead: caller='%s'/%d: returns %Rrc (*pu32Value=%#x)\n",
|
---|
3820 | pDevIns->pReg->szName, pDevIns->iInstance, VBOXSTRICTRC_VAL(rcStrict), *pu32Value));
|
---|
3821 | return rcStrict;
|
---|
3822 | }
|
---|
3823 |
|
---|
3824 |
|
---|
3825 | /** @interface_method_impl{PDMDEVHLPR3,pfnPCIPhysRead} */
|
---|
3826 | static DECLCALLBACK(int)
|
---|
3827 | pdmR3DevHlp_PCIPhysRead(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, uint32_t fFlags)
|
---|
3828 | {
|
---|
3829 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3830 | if (!pPciDev) /* NULL is an alias for the default PCI device. */
|
---|
3831 | pPciDev = pDevIns->apPciDevs[0];
|
---|
3832 | AssertReturn(pPciDev, VERR_PDM_NOT_PCI_DEVICE);
|
---|
3833 | //PDMPCIDEV_ASSERT_VALID_AND_REGISTERED(pDevIns, pPciDev);
|
---|
3834 |
|
---|
3835 | #ifndef PDM_DO_NOT_RESPECT_PCI_BM_BIT
|
---|
3836 | /*
|
---|
3837 | * Just check the busmaster setting here and forward the request to the generic read helper.
|
---|
3838 | */
|
---|
3839 | if (PCIDevIsBusmaster(pPciDev))
|
---|
3840 | { /* likely */ }
|
---|
3841 | else
|
---|
3842 | {
|
---|
3843 | Log(("pdmR3DevHlp_PCIPhysRead: caller='%s'/%d: returns %Rrc - Not bus master! GCPhys=%RGp cbRead=%#zx\n",
|
---|
3844 | pDevIns->pReg->szName, pDevIns->iInstance, VERR_PDM_NOT_PCI_BUS_MASTER, GCPhys, cbRead));
|
---|
3845 | memset(pvBuf, 0xff, cbRead);
|
---|
3846 | return VERR_PDM_NOT_PCI_BUS_MASTER;
|
---|
3847 | }
|
---|
3848 | #endif
|
---|
3849 |
|
---|
3850 | RT_NOREF(fFlags);
|
---|
3851 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
3852 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3853 | AssertFailed();
|
---|
3854 | #else
|
---|
3855 | RTRandBytes(pvBuf, cbRead);
|
---|
3856 | int rc = VINF_SUCCESS;
|
---|
3857 | #endif
|
---|
3858 |
|
---|
3859 | return rc;
|
---|
3860 | }
|
---|
3861 |
|
---|
3862 |
|
---|
3863 | /** @interface_method_impl{PDMDEVHLPR3,pfnPCIPhysWrite} */
|
---|
3864 | static DECLCALLBACK(int)
|
---|
3865 | pdmR3DevHlp_PCIPhysWrite(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, uint32_t fFlags)
|
---|
3866 | {
|
---|
3867 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3868 | if (!pPciDev) /* NULL is an alias for the default PCI device. */
|
---|
3869 | pPciDev = pDevIns->apPciDevs[0];
|
---|
3870 | AssertReturn(pPciDev, VERR_PDM_NOT_PCI_DEVICE);
|
---|
3871 | //PDMPCIDEV_ASSERT_VALID_AND_REGISTERED(pDevIns, pPciDev);
|
---|
3872 |
|
---|
3873 | #ifndef PDM_DO_NOT_RESPECT_PCI_BM_BIT
|
---|
3874 | /*
|
---|
3875 | * Just check the busmaster setting here and forward the request to the generic read helper.
|
---|
3876 | */
|
---|
3877 | if (PCIDevIsBusmaster(pPciDev))
|
---|
3878 | { /* likely */ }
|
---|
3879 | else
|
---|
3880 | {
|
---|
3881 | Log(("pdmR3DevHlp_PCIPhysWrite: caller='%s'/%d: returns %Rrc - Not bus master! GCPhys=%RGp cbWrite=%#zx\n",
|
---|
3882 | pDevIns->pReg->szName, pDevIns->iInstance, VERR_PDM_NOT_PCI_BUS_MASTER, GCPhys, cbWrite));
|
---|
3883 | return VERR_PDM_NOT_PCI_BUS_MASTER;
|
---|
3884 | }
|
---|
3885 | #endif
|
---|
3886 |
|
---|
3887 | RT_NOREF(GCPhys, pvBuf, cbWrite, fFlags);
|
---|
3888 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
3889 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
3890 | AssertFailed();
|
---|
3891 | #else
|
---|
3892 | int rc = VINF_SUCCESS;
|
---|
3893 | #endif
|
---|
3894 | return rc;
|
---|
3895 | }
|
---|
3896 |
|
---|
3897 |
|
---|
3898 | /** @interface_method_impl{PDMDEVHLPR3,pfnPCIPhysGCPhys2CCPtr} */
|
---|
3899 | static DECLCALLBACK(int) pdmR3DevHlp_PCIPhysGCPhys2CCPtr(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys,
|
---|
3900 | uint32_t fFlags, void **ppv, PPGMPAGEMAPLOCK pLock)
|
---|
3901 | {
|
---|
3902 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3903 | if (!pPciDev) /* NULL is an alias for the default PCI device. */
|
---|
3904 | pPciDev = pDevIns->apPciDevs[0];
|
---|
3905 | AssertReturn(pPciDev, VERR_PDM_NOT_PCI_DEVICE);
|
---|
3906 | PDMPCIDEV_ASSERT_VALID_AND_REGISTERED(pDevIns, pPciDev);
|
---|
3907 |
|
---|
3908 | #ifndef PDM_DO_NOT_RESPECT_PCI_BM_BIT
|
---|
3909 | if (PCIDevIsBusmaster(pPciDev))
|
---|
3910 | { /* likely */ }
|
---|
3911 | else
|
---|
3912 | {
|
---|
3913 | LogFunc(("caller='%s'/%d: returns %Rrc - Not bus master! GCPhys=%RGp fFlags=%#RX32\n",
|
---|
3914 | pDevIns->pReg->szName, pDevIns->iInstance, VERR_PDM_NOT_PCI_BUS_MASTER, GCPhys, fFlags));
|
---|
3915 | return VERR_PDM_NOT_PCI_BUS_MASTER;
|
---|
3916 | }
|
---|
3917 | #endif
|
---|
3918 |
|
---|
3919 | AssertFailed(); RT_NOREF(ppv, pLock);
|
---|
3920 | return VERR_NOT_IMPLEMENTED;
|
---|
3921 | }
|
---|
3922 |
|
---|
3923 |
|
---|
3924 | /** @interface_method_impl{PDMDEVHLPR3,pfnPCIPhysGCPhys2CCPtrReadOnly} */
|
---|
3925 | static DECLCALLBACK(int) pdmR3DevHlp_PCIPhysGCPhys2CCPtrReadOnly(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys,
|
---|
3926 | uint32_t fFlags, void const **ppv, PPGMPAGEMAPLOCK pLock)
|
---|
3927 | {
|
---|
3928 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3929 | if (!pPciDev) /* NULL is an alias for the default PCI device. */
|
---|
3930 | pPciDev = pDevIns->apPciDevs[0];
|
---|
3931 | AssertReturn(pPciDev, VERR_PDM_NOT_PCI_DEVICE);
|
---|
3932 | PDMPCIDEV_ASSERT_VALID_AND_REGISTERED(pDevIns, pPciDev);
|
---|
3933 |
|
---|
3934 | #ifndef PDM_DO_NOT_RESPECT_PCI_BM_BIT
|
---|
3935 | if (PCIDevIsBusmaster(pPciDev))
|
---|
3936 | { /* likely */ }
|
---|
3937 | else
|
---|
3938 | {
|
---|
3939 | LogFunc(("caller='%s'/%d: returns %Rrc - Not bus master! GCPhys=%RGp fFlags=%#RX32\n",
|
---|
3940 | pDevIns->pReg->szName, pDevIns->iInstance, VERR_PDM_NOT_PCI_BUS_MASTER, GCPhys, fFlags));
|
---|
3941 | return VERR_PDM_NOT_PCI_BUS_MASTER;
|
---|
3942 | }
|
---|
3943 | #endif
|
---|
3944 |
|
---|
3945 | AssertFailed(); RT_NOREF(ppv, pLock);
|
---|
3946 | return VERR_NOT_IMPLEMENTED;
|
---|
3947 | }
|
---|
3948 |
|
---|
3949 |
|
---|
3950 | /** @interface_method_impl{PDMDEVHLPR3,pfnPCIPhysBulkGCPhys2CCPtr} */
|
---|
3951 | static DECLCALLBACK(int) pdmR3DevHlp_PCIPhysBulkGCPhys2CCPtr(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t cPages,
|
---|
3952 | PCRTGCPHYS paGCPhysPages, uint32_t fFlags, void **papvPages,
|
---|
3953 | PPGMPAGEMAPLOCK paLocks)
|
---|
3954 | {
|
---|
3955 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3956 | if (!pPciDev) /* NULL is an alias for the default PCI device. */
|
---|
3957 | pPciDev = pDevIns->apPciDevs[0];
|
---|
3958 | AssertReturn(pPciDev, VERR_PDM_NOT_PCI_DEVICE);
|
---|
3959 | PDMPCIDEV_ASSERT_VALID_AND_REGISTERED(pDevIns, pPciDev);
|
---|
3960 |
|
---|
3961 | #ifndef PDM_DO_NOT_RESPECT_PCI_BM_BIT
|
---|
3962 | if (PCIDevIsBusmaster(pPciDev))
|
---|
3963 | { /* likely */ }
|
---|
3964 | else
|
---|
3965 | {
|
---|
3966 | LogFunc(("caller='%s'/%d: returns %Rrc - Not bus master! cPages=%zu fFlags=%#RX32\n",
|
---|
3967 | pDevIns->pReg->szName, pDevIns->iInstance, VERR_PDM_NOT_PCI_BUS_MASTER, cPages, fFlags));
|
---|
3968 | return VERR_PDM_NOT_PCI_BUS_MASTER;
|
---|
3969 | }
|
---|
3970 | #endif
|
---|
3971 |
|
---|
3972 | AssertFailed(); RT_NOREF(paGCPhysPages, fFlags, papvPages, paLocks);
|
---|
3973 | return VERR_NOT_IMPLEMENTED;
|
---|
3974 | }
|
---|
3975 |
|
---|
3976 |
|
---|
3977 | /** @interface_method_impl{PDMDEVHLPR3,pfnPCIPhysBulkGCPhys2CCPtrReadOnly} */
|
---|
3978 | static DECLCALLBACK(int) pdmR3DevHlp_PCIPhysBulkGCPhys2CCPtrReadOnly(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t cPages,
|
---|
3979 | PCRTGCPHYS paGCPhysPages, uint32_t fFlags,
|
---|
3980 | const void **papvPages, PPGMPAGEMAPLOCK paLocks)
|
---|
3981 | {
|
---|
3982 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
3983 | if (!pPciDev) /* NULL is an alias for the default PCI device. */
|
---|
3984 | pPciDev = pDevIns->apPciDevs[0];
|
---|
3985 | AssertReturn(pPciDev, VERR_PDM_NOT_PCI_DEVICE);
|
---|
3986 | PDMPCIDEV_ASSERT_VALID_AND_REGISTERED(pDevIns, pPciDev);
|
---|
3987 |
|
---|
3988 | #ifndef PDM_DO_NOT_RESPECT_PCI_BM_BIT
|
---|
3989 | if (PCIDevIsBusmaster(pPciDev))
|
---|
3990 | { /* likely */ }
|
---|
3991 | else
|
---|
3992 | {
|
---|
3993 | LogFunc(("caller='%s'/%d: returns %Rrc - Not bus master! cPages=%zu fFlags=%#RX32\n",
|
---|
3994 | pDevIns->pReg->szName, pDevIns->iInstance, VERR_PDM_NOT_PCI_BUS_MASTER, cPages, fFlags));
|
---|
3995 | return VERR_PDM_NOT_PCI_BUS_MASTER;
|
---|
3996 | }
|
---|
3997 | #endif
|
---|
3998 |
|
---|
3999 | AssertFailed(); RT_NOREF(paGCPhysPages, fFlags, papvPages, paLocks);
|
---|
4000 | return VERR_NOT_IMPLEMENTED;
|
---|
4001 | }
|
---|
4002 |
|
---|
4003 |
|
---|
4004 | /** @interface_method_impl{PDMDEVHLPR3,pfnPCISetIrq} */
|
---|
4005 | static DECLCALLBACK(void) pdmR3DevHlp_PCISetIrq(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iIrq, int iLevel)
|
---|
4006 | {
|
---|
4007 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4008 | if (!pPciDev) /* NULL is an alias for the default PCI device. */
|
---|
4009 | pPciDev = pDevIns->apPciDevs[0];
|
---|
4010 | AssertReturnVoid(pPciDev);
|
---|
4011 | LogFlow(("pdmR3DevHlp_PCISetIrq: caller='%s'/%d: pPciDev=%p:{%#x} iIrq=%d iLevel=%d\n",
|
---|
4012 | pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev->uDevFn, iIrq, iLevel));
|
---|
4013 | //PDMPCIDEV_ASSERT_VALID_AND_REGISTERED(pDevIns, pPciDev);
|
---|
4014 |
|
---|
4015 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
4016 | RT_NOREF(iIrq, iLevel);
|
---|
4017 | AssertFailed();
|
---|
4018 | #endif
|
---|
4019 |
|
---|
4020 | LogFlow(("pdmR3DevHlp_PCISetIrq: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
4021 | }
|
---|
4022 |
|
---|
4023 |
|
---|
4024 | /** @interface_method_impl{PDMDEVHLPR3,pfnPCISetIrqNoWait} */
|
---|
4025 | static DECLCALLBACK(void) pdmR3DevHlp_PCISetIrqNoWait(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iIrq, int iLevel)
|
---|
4026 | {
|
---|
4027 | pdmR3DevHlp_PCISetIrq(pDevIns, pPciDev, iIrq, iLevel);
|
---|
4028 | }
|
---|
4029 |
|
---|
4030 |
|
---|
4031 | /** @interface_method_impl{PDMDEVHLPR3,pfnISASetIrq} */
|
---|
4032 | static DECLCALLBACK(void) pdmR3DevHlp_ISASetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel)
|
---|
4033 | {
|
---|
4034 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4035 | LogFlow(("pdmR3DevHlp_ISASetIrq: caller='%s'/%d: iIrq=%d iLevel=%d\n", pDevIns->pReg->szName, pDevIns->iInstance, iIrq, iLevel));
|
---|
4036 |
|
---|
4037 | /*
|
---|
4038 | * Validate input.
|
---|
4039 | */
|
---|
4040 | Assert(iIrq < 16);
|
---|
4041 | Assert((uint32_t)iLevel <= PDM_IRQ_LEVEL_FLIP_FLOP);
|
---|
4042 |
|
---|
4043 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
4044 | AssertFailed();
|
---|
4045 | #endif
|
---|
4046 |
|
---|
4047 | LogFlow(("pdmR3DevHlp_ISASetIrq: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
4048 | }
|
---|
4049 |
|
---|
4050 |
|
---|
4051 | /** @interface_method_impl{PDMDEVHLPR3,pfnISASetIrqNoWait} */
|
---|
4052 | static DECLCALLBACK(void) pdmR3DevHlp_ISASetIrqNoWait(PPDMDEVINS pDevIns, int iIrq, int iLevel)
|
---|
4053 | {
|
---|
4054 | pdmR3DevHlp_ISASetIrq(pDevIns, iIrq, iLevel);
|
---|
4055 | }
|
---|
4056 |
|
---|
4057 |
|
---|
4058 | /** @interface_method_impl{PDMDEVHLPR3,pfnDriverAttach} */
|
---|
4059 | static DECLCALLBACK(int) pdmR3DevHlp_DriverAttach(PPDMDEVINS pDevIns, uint32_t iLun, PPDMIBASE pBaseInterface, PPDMIBASE *ppBaseInterface, const char *pszDesc)
|
---|
4060 | {
|
---|
4061 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4062 | LogFlow(("pdmR3DevHlp_DriverAttach: caller='%s'/%d: iLun=%d pBaseInterface=%p ppBaseInterface=%p pszDesc=%p:{%s}\n",
|
---|
4063 | pDevIns->pReg->szName, pDevIns->iInstance, iLun, pBaseInterface, ppBaseInterface, pszDesc, pszDesc));
|
---|
4064 |
|
---|
4065 | #if 1
|
---|
4066 | int rc = VINF_SUCCESS;
|
---|
4067 | if (iLun == PDM_STATUS_LUN)
|
---|
4068 | *ppBaseInterface = &pDevIns->Internal.s.pDut->IBaseSts;
|
---|
4069 | else
|
---|
4070 | rc = VERR_PDM_NO_ATTACHED_DRIVER;
|
---|
4071 | #else
|
---|
4072 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4073 | AssertFailed();
|
---|
4074 | #endif
|
---|
4075 |
|
---|
4076 | LogFlow(("pdmR3DevHlp_DriverAttach: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4077 | return rc;
|
---|
4078 | }
|
---|
4079 |
|
---|
4080 |
|
---|
4081 | /** @interface_method_impl{PDMDEVHLPR3,pfnDriverDetach} */
|
---|
4082 | static DECLCALLBACK(int) pdmR3DevHlp_DriverDetach(PPDMDEVINS pDevIns, PPDMDRVINS pDrvIns, uint32_t fFlags)
|
---|
4083 | {
|
---|
4084 | PDMDEV_ASSERT_DEVINS(pDevIns); RT_NOREF_PV(pDevIns);
|
---|
4085 | LogFlow(("pdmR3DevHlp_DriverDetach: caller='%s'/%d: pDrvIns=%p\n",
|
---|
4086 | pDevIns->pReg->szName, pDevIns->iInstance, pDrvIns));
|
---|
4087 |
|
---|
4088 | RT_NOREF(fFlags);
|
---|
4089 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4090 | AssertFailed();
|
---|
4091 |
|
---|
4092 | LogFlow(("pdmR3DevHlp_DriverDetach: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4093 | return rc;
|
---|
4094 | }
|
---|
4095 |
|
---|
4096 |
|
---|
4097 | /** @interface_method_impl{PDMDEVHLPR3,pfnDriverReconfigure} */
|
---|
4098 | static DECLCALLBACK(int) pdmR3DevHlp_DriverReconfigure(PPDMDEVINS pDevIns, uint32_t iLun, uint32_t cDepth,
|
---|
4099 | const char * const *papszDrivers, PCFGMNODE *papConfigs, uint32_t fFlags)
|
---|
4100 | {
|
---|
4101 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4102 | LogFlow(("pdmR3DevHlp_DriverReconfigure: caller='%s'/%d: iLun=%u cDepth=%u fFlags=%#x\n",
|
---|
4103 | pDevIns->pReg->szName, pDevIns->iInstance, iLun, cDepth, fFlags));
|
---|
4104 |
|
---|
4105 | /*
|
---|
4106 | * Validate input.
|
---|
4107 | */
|
---|
4108 | AssertReturn(cDepth <= 8, VERR_INVALID_PARAMETER);
|
---|
4109 | AssertPtrReturn(papszDrivers, VERR_INVALID_POINTER);
|
---|
4110 | AssertPtrNullReturn(papConfigs, VERR_INVALID_POINTER);
|
---|
4111 | for (uint32_t i = 0; i < cDepth; i++)
|
---|
4112 | {
|
---|
4113 | AssertPtrReturn(papszDrivers[i], VERR_INVALID_POINTER);
|
---|
4114 | size_t cchDriver = strlen(papszDrivers[i]);
|
---|
4115 | AssertReturn(cchDriver > 0 && cchDriver < RT_SIZEOFMEMB(PDMDRVREG, szName), VERR_OUT_OF_RANGE);
|
---|
4116 |
|
---|
4117 | if (papConfigs)
|
---|
4118 | AssertPtrNullReturn(papConfigs[i], VERR_INVALID_POINTER);
|
---|
4119 | }
|
---|
4120 | AssertReturn(fFlags == 0, VERR_INVALID_FLAGS);
|
---|
4121 |
|
---|
4122 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4123 | AssertFailed();
|
---|
4124 |
|
---|
4125 | LogFlow(("pdmR3DevHlp_DriverReconfigure: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4126 | return rc;
|
---|
4127 | }
|
---|
4128 |
|
---|
4129 |
|
---|
4130 | /** @interface_method_impl{PDMDEVHLPR3,pfnQueueCreate} */
|
---|
4131 | static DECLCALLBACK(int) pdmR3DevHlp_QueueCreate(PPDMDEVINS pDevIns, size_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
|
---|
4132 | PFNPDMQUEUEDEV pfnCallback, bool fRZEnabled, const char *pszName,
|
---|
4133 | PDMQUEUEHANDLE *phQueue)
|
---|
4134 | {
|
---|
4135 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4136 | LogFlow(("pdmR3DevHlp_QueueCreate: caller='%s'/%d: cbItem=%#x cItems=%#x cMilliesInterval=%u pfnCallback=%p fRZEnabled=%RTbool pszName=%p:{%s} phQueue=%p\n",
|
---|
4137 | pDevIns->pReg->szName, pDevIns->iInstance, cbItem, cItems, cMilliesInterval, pfnCallback, fRZEnabled, pszName, pszName, phQueue));
|
---|
4138 |
|
---|
4139 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4140 | AssertFailed();
|
---|
4141 |
|
---|
4142 | LogFlow(("pdmR3DevHlp_QueueCreate: caller='%s'/%d: returns %Rrc *ppQueue=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, rc, *phQueue));
|
---|
4143 | return rc;
|
---|
4144 | }
|
---|
4145 |
|
---|
4146 |
|
---|
4147 | /** @interface_method_impl{PDMDEVHLPR3,pfnQueueAlloc} */
|
---|
4148 | static DECLCALLBACK(PPDMQUEUEITEMCORE) pdmR3DevHlp_QueueAlloc(PPDMDEVINS pDevIns, PDMQUEUEHANDLE hQueue)
|
---|
4149 | {
|
---|
4150 | RT_NOREF(pDevIns, hQueue);
|
---|
4151 | AssertFailed();
|
---|
4152 | return NULL;
|
---|
4153 | }
|
---|
4154 |
|
---|
4155 |
|
---|
4156 | /** @interface_method_impl{PDMDEVHLPR3,pfnQueueInsert} */
|
---|
4157 | static DECLCALLBACK(void) pdmR3DevHlp_QueueInsert(PPDMDEVINS pDevIns, PDMQUEUEHANDLE hQueue, PPDMQUEUEITEMCORE pItem)
|
---|
4158 | {
|
---|
4159 | RT_NOREF(pDevIns, hQueue, pItem);
|
---|
4160 | AssertFailed();
|
---|
4161 | }
|
---|
4162 |
|
---|
4163 |
|
---|
4164 | /** @interface_method_impl{PDMDEVHLPR3,pfnQueueFlushIfNecessary} */
|
---|
4165 | static DECLCALLBACK(bool) pdmR3DevHlp_QueueFlushIfNecessary(PPDMDEVINS pDevIns, PDMQUEUEHANDLE hQueue)
|
---|
4166 | {
|
---|
4167 | RT_NOREF(pDevIns, hQueue);
|
---|
4168 | AssertFailed();
|
---|
4169 | return false;
|
---|
4170 | }
|
---|
4171 |
|
---|
4172 |
|
---|
4173 | /** @interface_method_impl{PDMDEVHLPR3,pfnTaskCreate} */
|
---|
4174 | static DECLCALLBACK(int) pdmR3DevHlp_TaskCreate(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszName,
|
---|
4175 | PFNPDMTASKDEV pfnCallback, void *pvUser, PDMTASKHANDLE *phTask)
|
---|
4176 | {
|
---|
4177 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4178 | LogFlow(("pdmR3DevHlp_TaskTrigger: caller='%s'/%d: pfnCallback=%p fFlags=%#x pszName=%p:{%s} phTask=%p\n",
|
---|
4179 | pDevIns->pReg->szName, pDevIns->iInstance, pfnCallback, fFlags, pszName, pszName, phTask));
|
---|
4180 |
|
---|
4181 | RT_NOREF(pDevIns, fFlags, pszName, pfnCallback, pvUser, phTask);
|
---|
4182 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
4183 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4184 | AssertFailed();
|
---|
4185 | #else
|
---|
4186 | int rc = VINF_SUCCESS;
|
---|
4187 | #endif
|
---|
4188 |
|
---|
4189 | LogFlow(("pdmR3DevHlp_TaskTrigger: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4190 | return rc;
|
---|
4191 | }
|
---|
4192 |
|
---|
4193 |
|
---|
4194 | /** @interface_method_impl{PDMDEVHLPR3,pfnTaskTrigger} */
|
---|
4195 | static DECLCALLBACK(int) pdmR3DevHlp_TaskTrigger(PPDMDEVINS pDevIns, PDMTASKHANDLE hTask)
|
---|
4196 | {
|
---|
4197 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4198 | LogFlow(("pdmR3DevHlp_TaskTrigger: caller='%s'/%d: hTask=%RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, hTask));
|
---|
4199 |
|
---|
4200 | RT_NOREF(pDevIns, hTask);
|
---|
4201 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
4202 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4203 | AssertFailed();
|
---|
4204 | #else
|
---|
4205 | int rc = VINF_SUCCESS;
|
---|
4206 | #endif
|
---|
4207 |
|
---|
4208 | LogFlow(("pdmR3DevHlp_TaskTrigger: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4209 | return rc;
|
---|
4210 | }
|
---|
4211 |
|
---|
4212 |
|
---|
4213 | /** @interface_method_impl{PDMDEVHLPR3,pfnSUPSemEventCreate} */
|
---|
4214 | static DECLCALLBACK(int) pdmR3DevHlp_SUPSemEventCreate(PPDMDEVINS pDevIns, PSUPSEMEVENT phEvent)
|
---|
4215 | {
|
---|
4216 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4217 | LogFlow(("pdmR3DevHlp_SUPSemEventCreate: caller='%s'/%d: phEvent=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, phEvent));
|
---|
4218 |
|
---|
4219 | RTSEMEVENT hEvt;
|
---|
4220 | int rc = RTSemEventCreate(&hEvt);
|
---|
4221 | if (RT_SUCCESS(rc))
|
---|
4222 | *phEvent = (SUPSEMEVENT)hEvt;
|
---|
4223 |
|
---|
4224 | LogFlow(("pdmR3DevHlp_SUPSemEventCreate: caller='%s'/%d: returns %Rrc *phEvent=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, rc, *phEvent));
|
---|
4225 | return rc;
|
---|
4226 | }
|
---|
4227 |
|
---|
4228 |
|
---|
4229 | /** @interface_method_impl{PDMDEVHLPR3,pfnSUPSemEventClose} */
|
---|
4230 | static DECLCALLBACK(int) pdmR3DevHlp_SUPSemEventClose(PPDMDEVINS pDevIns, SUPSEMEVENT hEvent)
|
---|
4231 | {
|
---|
4232 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4233 | LogFlow(("pdmR3DevHlp_SUPSemEventClose: caller='%s'/%d: hEvent=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, hEvent));
|
---|
4234 |
|
---|
4235 | int rc = RTSemEventDestroy((RTSEMEVENT)hEvent);
|
---|
4236 |
|
---|
4237 | LogFlow(("pdmR3DevHlp_SUPSemEventClose: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4238 | return rc;
|
---|
4239 | }
|
---|
4240 |
|
---|
4241 |
|
---|
4242 | /** @interface_method_impl{PDMDEVHLPR3,pfnSUPSemEventSignal} */
|
---|
4243 | static DECLCALLBACK(int) pdmR3DevHlp_SUPSemEventSignal(PPDMDEVINS pDevIns, SUPSEMEVENT hEvent)
|
---|
4244 | {
|
---|
4245 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4246 | LogFlow(("pdmR3DevHlp_SUPSemEventSignal: caller='%s'/%d: hEvent=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, hEvent));
|
---|
4247 |
|
---|
4248 | int rc = RTSemEventSignal((RTSEMEVENT)hEvent);
|
---|
4249 |
|
---|
4250 | LogFlow(("pdmR3DevHlp_SUPSemEventSignal: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4251 | return rc;
|
---|
4252 | }
|
---|
4253 |
|
---|
4254 |
|
---|
4255 | /** @interface_method_impl{PDMDEVHLPR3,pfnSUPSemEventWaitNoResume} */
|
---|
4256 | static DECLCALLBACK(int) pdmR3DevHlp_SUPSemEventWaitNoResume(PPDMDEVINS pDevIns, SUPSEMEVENT hEvent, uint32_t cMillies)
|
---|
4257 | {
|
---|
4258 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4259 | LogFlow(("pdmR3DevHlp_SUPSemEventWaitNoResume: caller='%s'/%d: hEvent=%p cNsTimeout=%RU32\n",
|
---|
4260 | pDevIns->pReg->szName, pDevIns->iInstance, hEvent, cMillies));
|
---|
4261 |
|
---|
4262 | int rc = RTSemEventWaitNoResume((RTSEMEVENT)hEvent, cMillies);
|
---|
4263 |
|
---|
4264 | LogFlow(("pdmR3DevHlp_SUPSemEventWaitNoResume: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4265 | return rc;
|
---|
4266 | }
|
---|
4267 |
|
---|
4268 |
|
---|
4269 | /** @interface_method_impl{PDMDEVHLPR3,pfnSUPSemEventWaitNsAbsIntr} */
|
---|
4270 | static DECLCALLBACK(int) pdmR3DevHlp_SUPSemEventWaitNsAbsIntr(PPDMDEVINS pDevIns, SUPSEMEVENT hEvent, uint64_t uNsTimeout)
|
---|
4271 | {
|
---|
4272 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4273 | LogFlow(("pdmR3DevHlp_SUPSemEventWaitNsAbsIntr: caller='%s'/%d: hEvent=%p uNsTimeout=%RU64\n",
|
---|
4274 | pDevIns->pReg->szName, pDevIns->iInstance, hEvent, uNsTimeout));
|
---|
4275 |
|
---|
4276 | int rc = RTSemEventWait((RTSEMEVENT)hEvent, uNsTimeout / RT_NS_1MS);
|
---|
4277 |
|
---|
4278 | LogFlow(("pdmR3DevHlp_SUPSemEventWaitNsAbsIntr: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4279 | return rc;
|
---|
4280 | }
|
---|
4281 |
|
---|
4282 |
|
---|
4283 | /** @interface_method_impl{PDMDEVHLPR3,pfnSUPSemEventWaitNsRelIntr} */
|
---|
4284 | static DECLCALLBACK(int) pdmR3DevHlp_SUPSemEventWaitNsRelIntr(PPDMDEVINS pDevIns, SUPSEMEVENT hEvent, uint64_t cNsTimeout)
|
---|
4285 | {
|
---|
4286 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4287 | LogFlow(("pdmR3DevHlp_SUPSemEventWaitNsRelIntr: caller='%s'/%d: hEvent=%p cNsTimeout=%RU64\n",
|
---|
4288 | pDevIns->pReg->szName, pDevIns->iInstance, hEvent, cNsTimeout));
|
---|
4289 |
|
---|
4290 | int rc = RTSemEventWait((RTSEMEVENT)hEvent, cNsTimeout / RT_NS_1MS);
|
---|
4291 |
|
---|
4292 | LogFlow(("pdmR3DevHlp_SUPSemEventWaitNsRelIntr: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4293 | return rc;
|
---|
4294 | }
|
---|
4295 |
|
---|
4296 |
|
---|
4297 | /** @interface_method_impl{PDMDEVHLPR3,pfnSUPSemEventGetResolution} */
|
---|
4298 | static DECLCALLBACK(uint32_t) pdmR3DevHlp_SUPSemEventGetResolution(PPDMDEVINS pDevIns)
|
---|
4299 | {
|
---|
4300 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4301 | LogFlow(("pdmR3DevHlp_SUPSemEventGetResolution: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
4302 |
|
---|
4303 | RT_NOREF(pDevIns);
|
---|
4304 | uint32_t cNsResolution = 0;
|
---|
4305 | AssertFailed();
|
---|
4306 |
|
---|
4307 | LogFlow(("pdmR3DevHlp_SUPSemEventGetResolution: caller='%s'/%d: returns %u\n", pDevIns->pReg->szName, pDevIns->iInstance, cNsResolution));
|
---|
4308 | return cNsResolution;
|
---|
4309 | }
|
---|
4310 |
|
---|
4311 |
|
---|
4312 | /** @interface_method_impl{PDMDEVHLPR3,pfnSUPSemEventMultiCreate} */
|
---|
4313 | static DECLCALLBACK(int) pdmR3DevHlp_SUPSemEventMultiCreate(PPDMDEVINS pDevIns, PSUPSEMEVENTMULTI phEventMulti)
|
---|
4314 | {
|
---|
4315 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4316 | LogFlow(("pdmR3DevHlp_SUPSemEventMultiCreate: caller='%s'/%d: phEventMulti=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, phEventMulti));
|
---|
4317 |
|
---|
4318 | RT_NOREF(pDevIns, phEventMulti);
|
---|
4319 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
4320 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4321 | AssertFailed();
|
---|
4322 | #else
|
---|
4323 | int rc = VINF_SUCCESS;
|
---|
4324 | #endif
|
---|
4325 |
|
---|
4326 | LogFlow(("pdmR3DevHlp_SUPSemEventMultiCreate: caller='%s'/%d: returns %Rrc *phEventMulti=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, rc, *phEventMulti));
|
---|
4327 | return rc;
|
---|
4328 | }
|
---|
4329 |
|
---|
4330 |
|
---|
4331 | /** @interface_method_impl{PDMDEVHLPR3,pfnSUPSemEventMultiClose} */
|
---|
4332 | static DECLCALLBACK(int) pdmR3DevHlp_SUPSemEventMultiClose(PPDMDEVINS pDevIns, SUPSEMEVENTMULTI hEventMulti)
|
---|
4333 | {
|
---|
4334 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4335 | LogFlow(("pdmR3DevHlp_SUPSemEventMultiClose: caller='%s'/%d: hEventMulti=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, hEventMulti));
|
---|
4336 |
|
---|
4337 | RT_NOREF(pDevIns, hEventMulti);
|
---|
4338 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
4339 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4340 | AssertFailed();
|
---|
4341 | #else
|
---|
4342 | int rc = VINF_SUCCESS;
|
---|
4343 | #endif
|
---|
4344 |
|
---|
4345 | LogFlow(("pdmR3DevHlp_SUPSemEventMultiClose: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4346 | return rc;
|
---|
4347 | }
|
---|
4348 |
|
---|
4349 |
|
---|
4350 | /** @interface_method_impl{PDMDEVHLPR3,pfnSUPSemEventMultiSignal} */
|
---|
4351 | static DECLCALLBACK(int) pdmR3DevHlp_SUPSemEventMultiSignal(PPDMDEVINS pDevIns, SUPSEMEVENTMULTI hEventMulti)
|
---|
4352 | {
|
---|
4353 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4354 | LogFlow(("pdmR3DevHlp_SUPSemEventMultiSignal: caller='%s'/%d: hEventMulti=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, hEventMulti));
|
---|
4355 |
|
---|
4356 | RT_NOREF(pDevIns, hEventMulti);
|
---|
4357 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
4358 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4359 | AssertFailed();
|
---|
4360 | #else
|
---|
4361 | int rc = VINF_SUCCESS;
|
---|
4362 | #endif
|
---|
4363 |
|
---|
4364 | LogFlow(("pdmR3DevHlp_SUPSemEventMultiSignal: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4365 | return rc;
|
---|
4366 | }
|
---|
4367 |
|
---|
4368 |
|
---|
4369 | /** @interface_method_impl{PDMDEVHLPR3,pfnSUPSemEventMultiReset} */
|
---|
4370 | static DECLCALLBACK(int) pdmR3DevHlp_SUPSemEventMultiReset(PPDMDEVINS pDevIns, SUPSEMEVENTMULTI hEventMulti)
|
---|
4371 | {
|
---|
4372 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4373 | LogFlow(("pdmR3DevHlp_SUPSemEventMultiReset: caller='%s'/%d: hEventMulti=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, hEventMulti));
|
---|
4374 |
|
---|
4375 | RT_NOREF(pDevIns, hEventMulti);
|
---|
4376 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
4377 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4378 | AssertFailed();
|
---|
4379 | #else
|
---|
4380 | int rc = VINF_SUCCESS;
|
---|
4381 | #endif
|
---|
4382 |
|
---|
4383 | LogFlow(("pdmR3DevHlp_SUPSemEventMultiReset: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4384 | return rc;
|
---|
4385 | }
|
---|
4386 |
|
---|
4387 |
|
---|
4388 | /** @interface_method_impl{PDMDEVHLPR3,pfnSUPSemEventMultiWaitNoResume} */
|
---|
4389 | static DECLCALLBACK(int) pdmR3DevHlp_SUPSemEventMultiWaitNoResume(PPDMDEVINS pDevIns, SUPSEMEVENTMULTI hEventMulti,
|
---|
4390 | uint32_t cMillies)
|
---|
4391 | {
|
---|
4392 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4393 | LogFlow(("pdmR3DevHlp_SUPSemEventMultiWaitNoResume: caller='%s'/%d: hEventMulti=%p cMillies=%RU32\n",
|
---|
4394 | pDevIns->pReg->szName, pDevIns->iInstance, hEventMulti, cMillies));
|
---|
4395 |
|
---|
4396 | RT_NOREF(pDevIns, hEventMulti, cMillies);
|
---|
4397 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
4398 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4399 | AssertFailed();
|
---|
4400 | #else
|
---|
4401 | int rc = VINF_SUCCESS;
|
---|
4402 | #endif
|
---|
4403 | LogFlow(("pdmR3DevHlp_SUPSemEventMultiWaitNoResume: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4404 | return rc;
|
---|
4405 | }
|
---|
4406 |
|
---|
4407 |
|
---|
4408 | /** @interface_method_impl{PDMDEVHLPR3,pfnSUPSemEventMultiWaitNsAbsIntr} */
|
---|
4409 | static DECLCALLBACK(int) pdmR3DevHlp_SUPSemEventMultiWaitNsAbsIntr(PPDMDEVINS pDevIns, SUPSEMEVENTMULTI hEventMulti,
|
---|
4410 | uint64_t uNsTimeout)
|
---|
4411 | {
|
---|
4412 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4413 | LogFlow(("pdmR3DevHlp_SUPSemEventMultiWaitNsAbsIntr: caller='%s'/%d: hEventMulti=%p uNsTimeout=%RU64\n",
|
---|
4414 | pDevIns->pReg->szName, pDevIns->iInstance, hEventMulti, uNsTimeout));
|
---|
4415 |
|
---|
4416 | RT_NOREF(pDevIns, hEventMulti, uNsTimeout);
|
---|
4417 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
4418 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4419 | AssertFailed();
|
---|
4420 | #else
|
---|
4421 | int rc = VINF_SUCCESS;
|
---|
4422 | #endif
|
---|
4423 |
|
---|
4424 | LogFlow(("pdmR3DevHlp_SUPSemEventMultiWaitNsAbsIntr: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4425 | return rc;
|
---|
4426 | }
|
---|
4427 |
|
---|
4428 |
|
---|
4429 | /** @interface_method_impl{PDMDEVHLPR3,pfnSUPSemEventMultiWaitNsRelIntr} */
|
---|
4430 | static DECLCALLBACK(int) pdmR3DevHlp_SUPSemEventMultiWaitNsRelIntr(PPDMDEVINS pDevIns, SUPSEMEVENTMULTI hEventMulti,
|
---|
4431 | uint64_t cNsTimeout)
|
---|
4432 | {
|
---|
4433 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4434 | LogFlow(("pdmR3DevHlp_SUPSemEventMultiWaitNsRelIntr: caller='%s'/%d: hEventMulti=%p cNsTimeout=%RU64\n",
|
---|
4435 | pDevIns->pReg->szName, pDevIns->iInstance, hEventMulti, cNsTimeout));
|
---|
4436 |
|
---|
4437 | RT_NOREF(pDevIns, hEventMulti, cNsTimeout);
|
---|
4438 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
4439 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4440 | AssertFailed();
|
---|
4441 | #else
|
---|
4442 | int rc = VINF_SUCCESS;
|
---|
4443 | #endif
|
---|
4444 |
|
---|
4445 | LogFlow(("pdmR3DevHlp_SUPSemEventMultiWaitNsRelIntr: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4446 | return rc;
|
---|
4447 | }
|
---|
4448 |
|
---|
4449 |
|
---|
4450 | /** @interface_method_impl{PDMDEVHLPR3,pfnSUPSemEventMultiGetResolution} */
|
---|
4451 | static DECLCALLBACK(uint32_t) pdmR3DevHlp_SUPSemEventMultiGetResolution(PPDMDEVINS pDevIns)
|
---|
4452 | {
|
---|
4453 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4454 | LogFlow(("pdmR3DevHlp_SUPSemEventMultiGetResolution: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
4455 |
|
---|
4456 | uint32_t cNsResolution = 0;
|
---|
4457 | AssertFailed();
|
---|
4458 |
|
---|
4459 | LogFlow(("pdmR3DevHlp_SUPSemEventMultiGetResolution: caller='%s'/%d: returns %u\n", pDevIns->pReg->szName, pDevIns->iInstance, cNsResolution));
|
---|
4460 | return cNsResolution;
|
---|
4461 | }
|
---|
4462 |
|
---|
4463 |
|
---|
4464 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectInit} */
|
---|
4465 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectInit(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, RT_SRC_POS_DECL,
|
---|
4466 | const char *pszNameFmt, va_list va)
|
---|
4467 | {
|
---|
4468 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4469 | LogFlow(("pdmR3DevHlp_CritSectInit: caller='%s'/%d: pCritSect=%p pszNameFmt=%p:{%s}\n",
|
---|
4470 | pDevIns->pReg->szName, pDevIns->iInstance, pCritSect, pszNameFmt, pszNameFmt));
|
---|
4471 |
|
---|
4472 | RT_NOREF(RT_SRC_POS_ARGS, pszNameFmt, va);
|
---|
4473 | int rc = RTCritSectInit(&pCritSect->s.CritSect);
|
---|
4474 |
|
---|
4475 | LogFlow(("pdmR3DevHlp_CritSectInit: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4476 | return rc;
|
---|
4477 | }
|
---|
4478 |
|
---|
4479 |
|
---|
4480 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectGetNop} */
|
---|
4481 | static DECLCALLBACK(PPDMCRITSECT) pdmR3DevHlp_CritSectGetNop(PPDMDEVINS pDevIns)
|
---|
4482 | {
|
---|
4483 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4484 |
|
---|
4485 | PPDMCRITSECT pCritSect = &pDevIns->Internal.s.pDut->CritSectNop;
|
---|
4486 |
|
---|
4487 | LogFlow(("pdmR3DevHlp_CritSectGetNop: caller='%s'/%d: return %p\n",
|
---|
4488 | pDevIns->pReg->szName, pDevIns->iInstance, pCritSect));
|
---|
4489 | return pCritSect;
|
---|
4490 | }
|
---|
4491 |
|
---|
4492 |
|
---|
4493 | /** @interface_method_impl{PDMDEVHLPR3,pfnSetDeviceCritSect} */
|
---|
4494 | static DECLCALLBACK(int) pdmR3DevHlp_SetDeviceCritSect(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect)
|
---|
4495 | {
|
---|
4496 | /*
|
---|
4497 | * Validate input.
|
---|
4498 | */
|
---|
4499 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4500 | AssertPtrReturn(pCritSect, VERR_INVALID_POINTER);
|
---|
4501 |
|
---|
4502 | LogFlow(("pdmR3DevHlp_SetDeviceCritSect: caller='%s'/%d: pCritSect=%p\n",
|
---|
4503 | pDevIns->pReg->szName, pDevIns->iInstance, pCritSect));
|
---|
4504 |
|
---|
4505 | pDevIns->pCritSectRoR3 = pCritSect;
|
---|
4506 | LogFlow(("pdmR3DevHlp_SetDeviceCritSect: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
|
---|
4507 | return VINF_SUCCESS;
|
---|
4508 | }
|
---|
4509 |
|
---|
4510 |
|
---|
4511 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectYield} */
|
---|
4512 | static DECLCALLBACK(bool) pdmR3DevHlp_CritSectYield(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect)
|
---|
4513 | {
|
---|
4514 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4515 |
|
---|
4516 | RT_NOREF(pDevIns, pCritSect);
|
---|
4517 | AssertFailed();
|
---|
4518 | return false;
|
---|
4519 | }
|
---|
4520 |
|
---|
4521 |
|
---|
4522 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectEnter} */
|
---|
4523 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectEnter(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, int rcBusy)
|
---|
4524 | {
|
---|
4525 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4526 |
|
---|
4527 | RT_NOREF(pDevIns, rcBusy);
|
---|
4528 | return RTCritSectEnter(&pCritSect->s.CritSect);
|
---|
4529 | }
|
---|
4530 |
|
---|
4531 |
|
---|
4532 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectEnterDebug} */
|
---|
4533 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectEnterDebug(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL)
|
---|
4534 | {
|
---|
4535 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4536 |
|
---|
4537 | RT_NOREF(pDevIns, rcBusy, uId, RT_SRC_POS_ARGS);
|
---|
4538 | return RTCritSectEnter(&pCritSect->s.CritSect);
|
---|
4539 | }
|
---|
4540 |
|
---|
4541 |
|
---|
4542 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectTryEnter} */
|
---|
4543 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectTryEnter(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect)
|
---|
4544 | {
|
---|
4545 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4546 |
|
---|
4547 | RT_NOREF(pDevIns, pCritSect);
|
---|
4548 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4549 | AssertFailed();
|
---|
4550 | return rc;
|
---|
4551 | }
|
---|
4552 |
|
---|
4553 |
|
---|
4554 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectTryEnterDebug} */
|
---|
4555 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectTryEnterDebug(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL)
|
---|
4556 | {
|
---|
4557 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4558 |
|
---|
4559 | RT_NOREF(pDevIns, pCritSect, uId, RT_SRC_POS_ARGS);
|
---|
4560 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4561 | AssertFailed();
|
---|
4562 | return rc;
|
---|
4563 | }
|
---|
4564 |
|
---|
4565 |
|
---|
4566 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectLeave} */
|
---|
4567 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectLeave(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect)
|
---|
4568 | {
|
---|
4569 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4570 |
|
---|
4571 | return RTCritSectLeave(&pCritSect->s.CritSect);
|
---|
4572 | }
|
---|
4573 |
|
---|
4574 |
|
---|
4575 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectIsOwner} */
|
---|
4576 | static DECLCALLBACK(bool) pdmR3DevHlp_CritSectIsOwner(PPDMDEVINS pDevIns, PCPDMCRITSECT pCritSect)
|
---|
4577 | {
|
---|
4578 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4579 |
|
---|
4580 | return RTCritSectIsOwner(&pCritSect->s.CritSect);
|
---|
4581 | }
|
---|
4582 |
|
---|
4583 |
|
---|
4584 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectIsInitialized} */
|
---|
4585 | static DECLCALLBACK(bool) pdmR3DevHlp_CritSectIsInitialized(PPDMDEVINS pDevIns, PCPDMCRITSECT pCritSect)
|
---|
4586 | {
|
---|
4587 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4588 |
|
---|
4589 | RT_NOREF(pDevIns, pCritSect);
|
---|
4590 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
4591 | AssertFailed();
|
---|
4592 | return false;
|
---|
4593 | #else
|
---|
4594 | return true;
|
---|
4595 | #endif
|
---|
4596 | }
|
---|
4597 |
|
---|
4598 |
|
---|
4599 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectHasWaiters} */
|
---|
4600 | static DECLCALLBACK(bool) pdmR3DevHlp_CritSectHasWaiters(PPDMDEVINS pDevIns, PCPDMCRITSECT pCritSect)
|
---|
4601 | {
|
---|
4602 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4603 | RT_NOREF(pDevIns, pCritSect);
|
---|
4604 | AssertFailed();
|
---|
4605 | return false;
|
---|
4606 | }
|
---|
4607 |
|
---|
4608 |
|
---|
4609 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectGetRecursion} */
|
---|
4610 | static DECLCALLBACK(uint32_t) pdmR3DevHlp_CritSectGetRecursion(PPDMDEVINS pDevIns, PCPDMCRITSECT pCritSect)
|
---|
4611 | {
|
---|
4612 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4613 |
|
---|
4614 | RT_NOREF(pDevIns, pCritSect);
|
---|
4615 | AssertFailed();
|
---|
4616 | return 0;
|
---|
4617 | }
|
---|
4618 |
|
---|
4619 |
|
---|
4620 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectScheduleExitEvent} */
|
---|
4621 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectScheduleExitEvent(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect,
|
---|
4622 | SUPSEMEVENT hEventToSignal)
|
---|
4623 | {
|
---|
4624 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4625 |
|
---|
4626 | RT_NOREF(pDevIns, pCritSect, hEventToSignal);
|
---|
4627 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4628 | AssertFailed();
|
---|
4629 | return rc;
|
---|
4630 | }
|
---|
4631 |
|
---|
4632 |
|
---|
4633 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectDelete} */
|
---|
4634 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectDelete(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect)
|
---|
4635 | {
|
---|
4636 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4637 |
|
---|
4638 | RT_NOREF(pDevIns, pCritSect);
|
---|
4639 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4640 | AssertFailed();
|
---|
4641 | return rc;
|
---|
4642 | }
|
---|
4643 |
|
---|
4644 |
|
---|
4645 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwInit} */
|
---|
4646 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectRwInit(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect, RT_SRC_POS_DECL,
|
---|
4647 | const char *pszNameFmt, va_list va)
|
---|
4648 | {
|
---|
4649 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4650 | LogFlow(("pdmR3DevHlp_CritSectRwInit: caller='%s'/%d: pCritSect=%p pszNameFmt=%p:{%s}\n",
|
---|
4651 | pDevIns->pReg->szName, pDevIns->iInstance, pCritSect, pszNameFmt, pszNameFmt));
|
---|
4652 |
|
---|
4653 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4654 | AssertFailed(); RT_NOREF(RT_SRC_POS_ARGS, va);
|
---|
4655 |
|
---|
4656 | LogFlow(("pdmR3DevHlp_CritSectInit: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4657 | return rc;
|
---|
4658 | }
|
---|
4659 |
|
---|
4660 |
|
---|
4661 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwDelete} */
|
---|
4662 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectRwDelete(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
|
---|
4663 | {
|
---|
4664 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4665 | AssertFailed(); RT_NOREF(pCritSect);
|
---|
4666 | return VERR_NOT_IMPLEMENTED;
|
---|
4667 | }
|
---|
4668 |
|
---|
4669 |
|
---|
4670 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwEnterShared} */
|
---|
4671 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectRwEnterShared(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect, int rcBusy)
|
---|
4672 | {
|
---|
4673 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4674 | AssertFailed(); RT_NOREF(pCritSect, rcBusy);
|
---|
4675 | return VERR_NOT_IMPLEMENTED;
|
---|
4676 | }
|
---|
4677 |
|
---|
4678 |
|
---|
4679 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwEnterSharedDebug} */
|
---|
4680 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectRwEnterSharedDebug(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect, int rcBusy,
|
---|
4681 | RTHCUINTPTR uId, RT_SRC_POS_DECL)
|
---|
4682 | {
|
---|
4683 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4684 | AssertFailed(); RT_NOREF(pCritSect, rcBusy, uId, RT_SRC_POS_ARGS);
|
---|
4685 | return VERR_NOT_IMPLEMENTED;
|
---|
4686 | }
|
---|
4687 |
|
---|
4688 |
|
---|
4689 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwTryEnterShared} */
|
---|
4690 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectRwTryEnterShared(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
|
---|
4691 | {
|
---|
4692 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4693 | AssertFailed(); RT_NOREF(pCritSect);
|
---|
4694 | return VERR_NOT_IMPLEMENTED;
|
---|
4695 | }
|
---|
4696 |
|
---|
4697 |
|
---|
4698 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwTryEnterSharedDebug} */
|
---|
4699 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectRwTryEnterSharedDebug(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect,
|
---|
4700 | RTHCUINTPTR uId, RT_SRC_POS_DECL)
|
---|
4701 | {
|
---|
4702 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4703 | AssertFailed(); RT_NOREF(pCritSect, uId, RT_SRC_POS_ARGS);
|
---|
4704 | return VERR_NOT_IMPLEMENTED;
|
---|
4705 | }
|
---|
4706 |
|
---|
4707 |
|
---|
4708 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwLeaveShared} */
|
---|
4709 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectRwLeaveShared(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
|
---|
4710 | {
|
---|
4711 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4712 | AssertFailed(); RT_NOREF(pCritSect);
|
---|
4713 | return VERR_NOT_IMPLEMENTED;
|
---|
4714 | }
|
---|
4715 |
|
---|
4716 |
|
---|
4717 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwEnterExcl} */
|
---|
4718 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectRwEnterExcl(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect, int rcBusy)
|
---|
4719 | {
|
---|
4720 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4721 | AssertFailed(); RT_NOREF(pCritSect, rcBusy);
|
---|
4722 | return VERR_NOT_IMPLEMENTED;
|
---|
4723 | }
|
---|
4724 |
|
---|
4725 |
|
---|
4726 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwEnterExclDebug} */
|
---|
4727 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectRwEnterExclDebug(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect, int rcBusy,
|
---|
4728 | RTHCUINTPTR uId, RT_SRC_POS_DECL)
|
---|
4729 | {
|
---|
4730 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4731 | AssertFailed(); RT_NOREF(pCritSect, rcBusy, uId, RT_SRC_POS_ARGS);
|
---|
4732 | return VERR_NOT_IMPLEMENTED;
|
---|
4733 | }
|
---|
4734 |
|
---|
4735 |
|
---|
4736 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwTryEnterExcl} */
|
---|
4737 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectRwTryEnterExcl(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
|
---|
4738 | {
|
---|
4739 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4740 | AssertFailed(); RT_NOREF(pCritSect);
|
---|
4741 | return VERR_NOT_IMPLEMENTED;
|
---|
4742 | }
|
---|
4743 |
|
---|
4744 |
|
---|
4745 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwTryEnterExclDebug} */
|
---|
4746 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectRwTryEnterExclDebug(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect,
|
---|
4747 | RTHCUINTPTR uId, RT_SRC_POS_DECL)
|
---|
4748 | {
|
---|
4749 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4750 | AssertFailed(); RT_NOREF(pCritSect, uId, RT_SRC_POS_ARGS);
|
---|
4751 | return VERR_NOT_IMPLEMENTED;
|
---|
4752 | }
|
---|
4753 |
|
---|
4754 |
|
---|
4755 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwLeaveExcl} */
|
---|
4756 | static DECLCALLBACK(int) pdmR3DevHlp_CritSectRwLeaveExcl(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
|
---|
4757 | {
|
---|
4758 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4759 | AssertFailed(); RT_NOREF(pCritSect);
|
---|
4760 | return VERR_NOT_IMPLEMENTED;
|
---|
4761 | }
|
---|
4762 |
|
---|
4763 |
|
---|
4764 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwIsWriteOwner} */
|
---|
4765 | static DECLCALLBACK(bool) pdmR3DevHlp_CritSectRwIsWriteOwner(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
|
---|
4766 | {
|
---|
4767 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4768 | AssertFailed(); RT_NOREF(pCritSect);
|
---|
4769 | return VERR_NOT_IMPLEMENTED;
|
---|
4770 | }
|
---|
4771 |
|
---|
4772 |
|
---|
4773 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwIsReadOwner} */
|
---|
4774 | static DECLCALLBACK(bool) pdmR3DevHlp_CritSectRwIsReadOwner(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect, bool fWannaHear)
|
---|
4775 | {
|
---|
4776 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4777 | AssertFailed(); RT_NOREF(pCritSect, fWannaHear);
|
---|
4778 | return VERR_NOT_IMPLEMENTED;
|
---|
4779 | }
|
---|
4780 |
|
---|
4781 |
|
---|
4782 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwGetWriteRecursion} */
|
---|
4783 | static DECLCALLBACK(uint32_t) pdmR3DevHlp_CritSectRwGetWriteRecursion(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
|
---|
4784 | {
|
---|
4785 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4786 | RT_NOREF(pDevIns, pCritSect);
|
---|
4787 | AssertFailed();
|
---|
4788 | return VERR_NOT_IMPLEMENTED;
|
---|
4789 | }
|
---|
4790 |
|
---|
4791 |
|
---|
4792 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwGetWriterReadRecursion} */
|
---|
4793 | static DECLCALLBACK(uint32_t) pdmR3DevHlp_CritSectRwGetWriterReadRecursion(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
|
---|
4794 | {
|
---|
4795 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4796 | RT_NOREF(pDevIns, pCritSect);
|
---|
4797 | AssertFailed();
|
---|
4798 | return VERR_NOT_IMPLEMENTED;
|
---|
4799 | }
|
---|
4800 |
|
---|
4801 |
|
---|
4802 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwGetReadCount} */
|
---|
4803 | static DECLCALLBACK(uint32_t) pdmR3DevHlp_CritSectRwGetReadCount(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
|
---|
4804 | {
|
---|
4805 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4806 | RT_NOREF(pDevIns, pCritSect);
|
---|
4807 | AssertFailed();
|
---|
4808 | return VERR_NOT_IMPLEMENTED;
|
---|
4809 | }
|
---|
4810 |
|
---|
4811 |
|
---|
4812 | /** @interface_method_impl{PDMDEVHLPR3,pfnCritSectRwIsInitialized} */
|
---|
4813 | static DECLCALLBACK(bool) pdmR3DevHlp_CritSectRwIsInitialized(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
|
---|
4814 | {
|
---|
4815 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4816 | RT_NOREF(pDevIns, pCritSect);
|
---|
4817 | AssertFailed();
|
---|
4818 | return VERR_NOT_IMPLEMENTED;
|
---|
4819 | }
|
---|
4820 |
|
---|
4821 |
|
---|
4822 | static DECLCALLBACK(int) pdmR3DevHlp_ThreadCreate(PPDMDEVINS pDevIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDEV pfnThread,
|
---|
4823 | PFNPDMTHREADWAKEUPDEV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)
|
---|
4824 | {
|
---|
4825 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4826 | LogFlow(("pdmR3DevHlp_ThreadCreate: caller='%s'/%d: ppThread=%p pvUser=%p pfnThread=%p pfnWakeup=%p cbStack=%#zx enmType=%d pszName=%p:{%s}\n",
|
---|
4827 | pDevIns->pReg->szName, pDevIns->iInstance, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName, pszName));
|
---|
4828 |
|
---|
4829 | int rc = tstDevPdmR3ThreadCreateDevice(pDevIns->Internal.s.pDut, pDevIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
|
---|
4830 |
|
---|
4831 | LogFlow(("pdmR3DevHlp_ThreadCreate: caller='%s'/%d: returns %Rrc *ppThread=%RTthrd\n", pDevIns->pReg->szName, pDevIns->iInstance,
|
---|
4832 | rc, *ppThread));
|
---|
4833 | return rc;
|
---|
4834 | }
|
---|
4835 |
|
---|
4836 |
|
---|
4837 | static DECLCALLBACK(int) pdmR3DevHlp_ThreadDestroy(PPDMTHREAD pThread, int *pRcThread)
|
---|
4838 | {
|
---|
4839 | return tstDevPdmR3ThreadDestroy(pThread, pRcThread);
|
---|
4840 | }
|
---|
4841 |
|
---|
4842 |
|
---|
4843 | static DECLCALLBACK(int) pdmR3DevHlp_ThreadIAmSuspending(PPDMTHREAD pThread)
|
---|
4844 | {
|
---|
4845 | return tstDevPdmR3ThreadIAmSuspending(pThread);
|
---|
4846 | }
|
---|
4847 |
|
---|
4848 |
|
---|
4849 | static DECLCALLBACK(int) pdmR3DevHlp_ThreadIamRunning(PPDMTHREAD pThread)
|
---|
4850 | {
|
---|
4851 | return tstDevPdmR3ThreadIAmRunning(pThread);
|
---|
4852 | }
|
---|
4853 |
|
---|
4854 |
|
---|
4855 | static DECLCALLBACK(int) pdmR3DevHlp_ThreadSleep(PPDMTHREAD pThread, RTMSINTERVAL cMillies)
|
---|
4856 | {
|
---|
4857 | return tstDevPdmR3ThreadSleep(pThread, cMillies);
|
---|
4858 | }
|
---|
4859 |
|
---|
4860 |
|
---|
4861 | static DECLCALLBACK(int) pdmR3DevHlp_ThreadSuspend(PPDMTHREAD pThread)
|
---|
4862 | {
|
---|
4863 | return tstDevPdmR3ThreadSuspend(pThread);
|
---|
4864 | }
|
---|
4865 |
|
---|
4866 |
|
---|
4867 | static DECLCALLBACK(int) pdmR3DevHlp_ThreadResume(PPDMTHREAD pThread)
|
---|
4868 | {
|
---|
4869 | return tstDevPdmR3ThreadResume(pThread);
|
---|
4870 | }
|
---|
4871 |
|
---|
4872 |
|
---|
4873 | /** @interface_method_impl{PDMDEVHLPR3,pfnSetAsyncNotification} */
|
---|
4874 | static DECLCALLBACK(int) pdmR3DevHlp_SetAsyncNotification(PPDMDEVINS pDevIns, PFNPDMDEVASYNCNOTIFY pfnAsyncNotify)
|
---|
4875 | {
|
---|
4876 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4877 | LogFlow(("pdmR3DevHlp_SetAsyncNotification: caller='%s'/%d: pfnAsyncNotify=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pfnAsyncNotify));
|
---|
4878 |
|
---|
4879 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4880 | AssertStmt(pfnAsyncNotify, rc = VERR_INVALID_PARAMETER);
|
---|
4881 | #if 0
|
---|
4882 | AssertStmt(!pDevIns->Internal.s.pfnAsyncNotify, rc = VERR_WRONG_ORDER);
|
---|
4883 | AssertStmt(pDevIns->Internal.s.fIntFlags & (PDMDEVINSINT_FLAGS_SUSPENDED | PDMDEVINSINT_FLAGS_RESET), rc = VERR_WRONG_ORDER);
|
---|
4884 | #endif
|
---|
4885 |
|
---|
4886 | AssertFailed();
|
---|
4887 |
|
---|
4888 | LogFlow(("pdmR3DevHlp_SetAsyncNotification: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4889 | return rc;
|
---|
4890 | }
|
---|
4891 |
|
---|
4892 |
|
---|
4893 | /** @interface_method_impl{PDMDEVHLPR3,pfnAsyncNotificationCompleted} */
|
---|
4894 | static DECLCALLBACK(void) pdmR3DevHlp_AsyncNotificationCompleted(PPDMDEVINS pDevIns)
|
---|
4895 | {
|
---|
4896 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4897 |
|
---|
4898 | AssertFailed();
|
---|
4899 | }
|
---|
4900 |
|
---|
4901 |
|
---|
4902 | /** @interface_method_impl{PDMDEVHLPR3,pfnRTCRegister} */
|
---|
4903 | static DECLCALLBACK(int) pdmR3DevHlp_RTCRegister(PPDMDEVINS pDevIns, PCPDMRTCREG pRtcReg, PCPDMRTCHLP *ppRtcHlp)
|
---|
4904 | {
|
---|
4905 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4906 | LogFlow(("pdmR3DevHlp_RTCRegister: caller='%s'/%d: pRtcReg=%p:{.u32Version=%#x, .pfnWrite=%p, .pfnRead=%p} ppRtcHlp=%p\n",
|
---|
4907 | pDevIns->pReg->szName, pDevIns->iInstance, pRtcReg, pRtcReg->u32Version, pRtcReg->pfnWrite,
|
---|
4908 | pRtcReg->pfnWrite, ppRtcHlp));
|
---|
4909 |
|
---|
4910 | /*
|
---|
4911 | * Validate input.
|
---|
4912 | */
|
---|
4913 | if (pRtcReg->u32Version != PDM_RTCREG_VERSION)
|
---|
4914 | {
|
---|
4915 | AssertMsgFailed(("u32Version=%#x expected %#x\n", pRtcReg->u32Version,
|
---|
4916 | PDM_RTCREG_VERSION));
|
---|
4917 | LogFlow(("pdmR3DevHlp_RTCRegister: caller='%s'/%d: returns %Rrc (version)\n",
|
---|
4918 | pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER));
|
---|
4919 | return VERR_INVALID_PARAMETER;
|
---|
4920 | }
|
---|
4921 | if ( !pRtcReg->pfnWrite
|
---|
4922 | || !pRtcReg->pfnRead)
|
---|
4923 | {
|
---|
4924 | Assert(pRtcReg->pfnWrite);
|
---|
4925 | Assert(pRtcReg->pfnRead);
|
---|
4926 | LogFlow(("pdmR3DevHlp_RTCRegister: caller='%s'/%d: returns %Rrc (callbacks)\n",
|
---|
4927 | pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER));
|
---|
4928 | return VERR_INVALID_PARAMETER;
|
---|
4929 | }
|
---|
4930 |
|
---|
4931 | if (!ppRtcHlp)
|
---|
4932 | {
|
---|
4933 | Assert(ppRtcHlp);
|
---|
4934 | LogFlow(("pdmR3DevHlp_RTCRegister: caller='%s'/%d: returns %Rrc (ppRtcHlp)\n",
|
---|
4935 | pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER));
|
---|
4936 | return VERR_INVALID_PARAMETER;
|
---|
4937 | }
|
---|
4938 |
|
---|
4939 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4940 | AssertFailed();
|
---|
4941 |
|
---|
4942 | LogFlow(("pdmR3DevHlp_RTCRegister: caller='%s'/%d: returns %Rrc\n",
|
---|
4943 | pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4944 | return rc;
|
---|
4945 | }
|
---|
4946 |
|
---|
4947 |
|
---|
4948 | /** @interface_method_impl{PDMDEVHLPR3,pfnDMARegister} */
|
---|
4949 | static DECLCALLBACK(int) pdmR3DevHlp_DMARegister(PPDMDEVINS pDevIns, unsigned uChannel, PFNDMATRANSFERHANDLER pfnTransferHandler, void *pvUser)
|
---|
4950 | {
|
---|
4951 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4952 | LogFlow(("pdmR3DevHlp_DMARegister: caller='%s'/%d: uChannel=%d pfnTransferHandler=%p pvUser=%p\n",
|
---|
4953 | pDevIns->pReg->szName, pDevIns->iInstance, uChannel, pfnTransferHandler, pvUser));
|
---|
4954 |
|
---|
4955 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
4956 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4957 | AssertFailed();
|
---|
4958 | #else
|
---|
4959 | int rc = VINF_SUCCESS;
|
---|
4960 | #endif
|
---|
4961 |
|
---|
4962 | LogFlow(("pdmR3DevHlp_DMARegister: caller='%s'/%d: returns %Rrc\n",
|
---|
4963 | pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4964 | return rc;
|
---|
4965 | }
|
---|
4966 |
|
---|
4967 |
|
---|
4968 | /** @interface_method_impl{PDMDEVHLPR3,pfnDMAReadMemory} */
|
---|
4969 | static DECLCALLBACK(int) pdmR3DevHlp_DMAReadMemory(PPDMDEVINS pDevIns, unsigned uChannel, void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbRead)
|
---|
4970 | {
|
---|
4971 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4972 | LogFlow(("pdmR3DevHlp_DMAReadMemory: caller='%s'/%d: uChannel=%d pvBuffer=%p off=%#x cbBlock=%#x pcbRead=%p\n",
|
---|
4973 | pDevIns->pReg->szName, pDevIns->iInstance, uChannel, pvBuffer, off, cbBlock, pcbRead));
|
---|
4974 |
|
---|
4975 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4976 | AssertFailed();
|
---|
4977 |
|
---|
4978 | LogFlow(("pdmR3DevHlp_DMAReadMemory: caller='%s'/%d: returns %Rrc\n",
|
---|
4979 | pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4980 | return rc;
|
---|
4981 | }
|
---|
4982 |
|
---|
4983 |
|
---|
4984 | /** @interface_method_impl{PDMDEVHLPR3,pfnDMAWriteMemory} */
|
---|
4985 | static DECLCALLBACK(int) pdmR3DevHlp_DMAWriteMemory(PPDMDEVINS pDevIns, unsigned uChannel, const void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbWritten)
|
---|
4986 | {
|
---|
4987 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
4988 | LogFlow(("pdmR3DevHlp_DMAWriteMemory: caller='%s'/%d: uChannel=%d pvBuffer=%p off=%#x cbBlock=%#x pcbWritten=%p\n",
|
---|
4989 | pDevIns->pReg->szName, pDevIns->iInstance, uChannel, pvBuffer, off, cbBlock, pcbWritten));
|
---|
4990 |
|
---|
4991 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
4992 | AssertFailed();
|
---|
4993 |
|
---|
4994 | LogFlow(("pdmR3DevHlp_DMAWriteMemory: caller='%s'/%d: returns %Rrc\n",
|
---|
4995 | pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
4996 | return rc;
|
---|
4997 | }
|
---|
4998 |
|
---|
4999 |
|
---|
5000 | /** @interface_method_impl{PDMDEVHLPR3,pfnDMASetDREQ} */
|
---|
5001 | static DECLCALLBACK(int) pdmR3DevHlp_DMASetDREQ(PPDMDEVINS pDevIns, unsigned uChannel, unsigned uLevel)
|
---|
5002 | {
|
---|
5003 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
5004 | LogFlow(("pdmR3DevHlp_DMASetDREQ: caller='%s'/%d: uChannel=%d uLevel=%d\n",
|
---|
5005 | pDevIns->pReg->szName, pDevIns->iInstance, uChannel, uLevel));
|
---|
5006 |
|
---|
5007 | #ifndef VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS
|
---|
5008 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
5009 | AssertFailed();
|
---|
5010 | #else
|
---|
5011 | int rc = VINF_SUCCESS;
|
---|
5012 | #endif
|
---|
5013 |
|
---|
5014 | LogFlow(("pdmR3DevHlp_DMASetDREQ: caller='%s'/%d: returns %Rrc\n",
|
---|
5015 | pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
5016 | return rc;
|
---|
5017 | }
|
---|
5018 |
|
---|
5019 | /** @interface_method_impl{PDMDEVHLPR3,pfnDMAGetChannelMode} */
|
---|
5020 | static DECLCALLBACK(uint8_t) pdmR3DevHlp_DMAGetChannelMode(PPDMDEVINS pDevIns, unsigned uChannel)
|
---|
5021 | {
|
---|
5022 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
5023 | LogFlow(("pdmR3DevHlp_DMAGetChannelMode: caller='%s'/%d: uChannel=%d\n",
|
---|
5024 | pDevIns->pReg->szName, pDevIns->iInstance, uChannel));
|
---|
5025 |
|
---|
5026 | uint8_t u8Mode = (3 << 2); /* Invalid mode. */
|
---|
5027 | AssertFailed();
|
---|
5028 |
|
---|
5029 | LogFlow(("pdmR3DevHlp_DMAGetChannelMode: caller='%s'/%d: returns %#04x\n",
|
---|
5030 | pDevIns->pReg->szName, pDevIns->iInstance, u8Mode));
|
---|
5031 | return u8Mode;
|
---|
5032 | }
|
---|
5033 |
|
---|
5034 | /** @interface_method_impl{PDMDEVHLPR3,pfnDMASchedule} */
|
---|
5035 | static DECLCALLBACK(void) pdmR3DevHlp_DMASchedule(PPDMDEVINS pDevIns)
|
---|
5036 | {
|
---|
5037 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
5038 | LogFlow(("pdmR3DevHlp_DMASchedule: caller='%s'/%d\n",
|
---|
5039 | pDevIns->pReg->szName, pDevIns->iInstance));
|
---|
5040 |
|
---|
5041 | AssertFailed();
|
---|
5042 | }
|
---|
5043 |
|
---|
5044 |
|
---|
5045 | /** @interface_method_impl{PDMDEVHLPR3,pfnCMOSWrite} */
|
---|
5046 | static DECLCALLBACK(int) pdmR3DevHlp_CMOSWrite(PPDMDEVINS pDevIns, unsigned iReg, uint8_t u8Value)
|
---|
5047 | {
|
---|
5048 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
5049 | LogFlow(("pdmR3DevHlp_CMOSWrite: caller='%s'/%d: iReg=%#04x u8Value=%#04x\n",
|
---|
5050 | pDevIns->pReg->szName, pDevIns->iInstance, iReg, u8Value));
|
---|
5051 |
|
---|
5052 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
5053 | AssertFailed();
|
---|
5054 |
|
---|
5055 | LogFlow(("pdmR3DevHlp_CMOSWrite: caller='%s'/%d: return %Rrc\n",
|
---|
5056 | pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
5057 | return rc;
|
---|
5058 | }
|
---|
5059 |
|
---|
5060 |
|
---|
5061 | /** @interface_method_impl{PDMDEVHLPR3,pfnCMOSRead} */
|
---|
5062 | static DECLCALLBACK(int) pdmR3DevHlp_CMOSRead(PPDMDEVINS pDevIns, unsigned iReg, uint8_t *pu8Value)
|
---|
5063 | {
|
---|
5064 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
5065 | LogFlow(("pdmR3DevHlp_CMOSWrite: caller='%s'/%d: iReg=%#04x pu8Value=%p\n",
|
---|
5066 | pDevIns->pReg->szName, pDevIns->iInstance, iReg, pu8Value));
|
---|
5067 |
|
---|
5068 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
5069 | AssertFailed();
|
---|
5070 |
|
---|
5071 | LogFlow(("pdmR3DevHlp_CMOSWrite: caller='%s'/%d: return %Rrc\n",
|
---|
5072 | pDevIns->pReg->szName, pDevIns->iInstance, rc));
|
---|
5073 | return rc;
|
---|
5074 | }
|
---|
5075 |
|
---|
5076 |
|
---|
5077 | /** @interface_method_impl{PDMDEVHLPR3,pfnAssertEMT} */
|
---|
5078 | static DECLCALLBACK(bool) pdmR3DevHlp_AssertEMT(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction)
|
---|
5079 | {
|
---|
5080 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
5081 |
|
---|
5082 | char szMsg[100];
|
---|
5083 | RTStrPrintf(szMsg, sizeof(szMsg), "AssertEMT '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance);
|
---|
5084 | RTAssertMsg1Weak(szMsg, iLine, pszFile, pszFunction);
|
---|
5085 | AssertBreakpoint();
|
---|
5086 | return false;
|
---|
5087 | }
|
---|
5088 |
|
---|
5089 |
|
---|
5090 | /** @interface_method_impl{PDMDEVHLPR3,pfnAssertOther} */
|
---|
5091 | static DECLCALLBACK(bool) pdmR3DevHlp_AssertOther(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction)
|
---|
5092 | {
|
---|
5093 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
5094 |
|
---|
5095 | char szMsg[100];
|
---|
5096 | RTStrPrintf(szMsg, sizeof(szMsg), "AssertOther '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance);
|
---|
5097 | RTAssertMsg1Weak(szMsg, iLine, pszFile, pszFunction);
|
---|
5098 | AssertBreakpoint();
|
---|
5099 | return false;
|
---|
5100 | }
|
---|
5101 |
|
---|
5102 |
|
---|
5103 | /** @interface_method_impl{PDMDEVHLPR3,pfnLdrGetRCInterfaceSymbols} */
|
---|
5104 | static DECLCALLBACK(int) pdmR3DevHlp_LdrGetRCInterfaceSymbols(PPDMDEVINS pDevIns, void *pvInterface, size_t cbInterface,
|
---|
5105 | const char *pszSymPrefix, const char *pszSymList)
|
---|
5106 | {
|
---|
5107 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
5108 | LogFlow(("pdmR3DevHlp_PDMLdrGetRCInterfaceSymbols: caller='%s'/%d: pvInterface=%p cbInterface=%zu pszSymPrefix=%p:{%s} pszSymList=%p:{%s}\n",
|
---|
5109 | pDevIns->pReg->szName, pDevIns->iInstance, pvInterface, cbInterface, pszSymPrefix, pszSymPrefix, pszSymList, pszSymList));
|
---|
5110 |
|
---|
5111 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
5112 | AssertFailed();
|
---|
5113 |
|
---|
5114 | LogFlow(("pdmR3DevHlp_PDMLdrGetRCInterfaceSymbols: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName,
|
---|
5115 | pDevIns->iInstance, rc));
|
---|
5116 | return rc;
|
---|
5117 | }
|
---|
5118 |
|
---|
5119 |
|
---|
5120 | /** @interface_method_impl{PDMDEVHLPR3,pfnLdrGetR0InterfaceSymbols} */
|
---|
5121 | static DECLCALLBACK(int) pdmR3DevHlp_LdrGetR0InterfaceSymbols(PPDMDEVINS pDevIns, void *pvInterface, size_t cbInterface,
|
---|
5122 | const char *pszSymPrefix, const char *pszSymList)
|
---|
5123 | {
|
---|
5124 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
5125 | LogFlow(("pdmR3DevHlp_PDMLdrGetR0InterfaceSymbols: caller='%s'/%d: pvInterface=%p cbInterface=%zu pszSymPrefix=%p:{%s} pszSymList=%p:{%s}\n",
|
---|
5126 | pDevIns->pReg->szName, pDevIns->iInstance, pvInterface, cbInterface, pszSymPrefix, pszSymPrefix, pszSymList, pszSymList));
|
---|
5127 |
|
---|
5128 | int rc = VERR_NOT_IMPLEMENTED;
|
---|
5129 | AssertFailed();
|
---|
5130 |
|
---|
5131 | LogFlow(("pdmR3DevHlp_PDMLdrGetR0InterfaceSymbols: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName,
|
---|
5132 | pDevIns->iInstance, rc));
|
---|
5133 | return rc;
|
---|
5134 | }
|
---|
5135 |
|
---|
5136 |
|
---|
5137 | /** @interface_method_impl{PDMDEVHLPR3,pfnCallR0} */
|
---|
5138 | static DECLCALLBACK(int) pdmR3DevHlp_CallR0(PPDMDEVINS pDevIns, uint32_t uOperation, uint64_t u64Arg)
|
---|
5139 | {
|
---|
5140 | PDMDEV_ASSERT_DEVINS(pDevIns);
|
---|
5141 | LogFlow(("pdmR3DevHlp_CallR0: caller='%s'/%d: uOperation=%#x u64Arg=%#RX64\n",
|
---|
5142 | pDevIns->pReg->szName, pDevIns->iInstance, uOperation, u64Arg));
|
---|
5143 |
|
---|
5144 | int rc = |
---|