VirtualBox

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

Last change on this file since 88956 was 84715, checked in by vboxsync, 4 years ago

AMD IOMMU: bugref:9654 PDM: Remove duplicate pfnIoApicSendMsi interface functions.

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