VirtualBox

source: vbox/trunk/src/VBox/Devices/testcase/tstDevicePdmDevHlp.cpp@ 92404

Last change on this file since 92404 was 92124, checked in by vboxsync, 3 years ago

Devices/testcase/tstDevice: Fuzz ring-0 device handlers as well, bugref:9006

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette