VirtualBox

source: vbox/trunk/src/VBox/Devices/testcase/tstDevicePdmDevHlpR0.cpp@ 92280

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

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

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 59.2 KB
Line 
1/* $Id: tstDevicePdmDevHlpR0.cpp 92124 2021-10-28 07:32:42Z vboxsync $ */
2/** @file
3 * tstDevice - Test framework for PDM devices/drivers, PDM fake R0 helper implementation.
4 */
5
6/*
7 * Copyright (C) 2021 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#undef IN_RING3
24#undef IN_SUP_R3
25#define IN_RING0
26#define IN_SUP_R0
27#define LINUX_VERSION_CODE 0
28#define KERNEL_VERSION(a,b,c) 1
29#include <VBox/types.h>
30#include <VBox/version.h>
31#include <VBox/vmm/pdmpci.h>
32
33#include <iprt/assert.h>
34#include <iprt/mem.h>
35#include <iprt/rand.h>
36#include <iprt/string.h>
37
38#include "tstDeviceInternal.h"
39
40
41/*********************************************************************************************************************************
42* Defined Constants And Macros *
43*********************************************************************************************************************************/
44
45/* Temporarily until the stubs got implemented. */
46#define VBOX_TSTDEV_NOT_IMPLEMENTED_STUBS_FAKE_SUCCESS 1
47
48/** @def PDMDEV_ASSERT_DEVINS
49 * Asserts the validity of the device instance.
50 */
51#ifdef VBOX_STRICT
52# define PDMDEV_ASSERT_DEVINS(pDevIns) \
53 do { \
54 AssertPtr(pDevIns); \
55 Assert(pDevIns->u32Version == PDM_DEVINS_VERSION); \
56 Assert(pDevIns->CTX_SUFF(pvInstanceDataFor) == (void *)&pDevIns->achInstanceData[0]); \
57 } while (0)
58#else
59# define PDMDEV_ASSERT_DEVINS(pDevIns) do { } while (0)
60#endif
61
62
63/** Frequency of the real clock. */
64#define TMCLOCK_FREQ_REAL UINT32_C(1000)
65/** Frequency of the virtual clock. */
66#define TMCLOCK_FREQ_VIRTUAL UINT32_C(1000000000)
67
68#undef RT_VALID_PTR
69#define RT_VALID_PTR(ptr) true
70
71
72/*********************************************************************************************************************************
73* Structures and Typedefs *
74*********************************************************************************************************************************/
75
76
77
78/*********************************************************************************************************************************
79* Global Variables *
80*********************************************************************************************************************************/
81
82
83
84/*********************************************************************************************************************************
85* Internal Functions *
86*********************************************************************************************************************************/
87
88/** @interface_method_impl{PDMDEVHLPR0,pfnIoPortSetUpContextEx} */
89static DECLCALLBACK(int) pdmR0DevHlp_IoPortSetUpContextEx(PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts,
90 PFNIOMIOPORTNEWOUT pfnOut, PFNIOMIOPORTNEWIN pfnIn,
91 PFNIOMIOPORTNEWOUTSTRING pfnOutStr, PFNIOMIOPORTNEWINSTRING pfnInStr,
92 void *pvUser)
93{
94 PDMDEV_ASSERT_DEVINS(pDevIns);
95 LogFlow(("pdmR0DevHlp_IoPortSetUpContextEx: caller='%s'/%d: hIoPorts=%#x pfnOut=%p pfnIn=%p pfnOutStr=%p pfnInStr=%p pvUser=%p\n",
96 pDevIns->pReg->szName, pDevIns->iInstance, hIoPorts, pfnOut, pfnIn, pfnOutStr, pfnInStr, pvUser));
97
98 int rc = VINF_SUCCESS;
99 PRTDEVDUTIOPORT pIoPort = (PRTDEVDUTIOPORT)hIoPorts;
100 if (RT_LIKELY(pIoPort))
101 {
102 pIoPort->pvUserR0 = pvUser;
103 pIoPort->pfnOutR0 = pfnOut;
104 pIoPort->pfnInR0 = pfnIn;
105 pIoPort->pfnOutStrR0 = pfnOutStr;
106 pIoPort->pfnInStrR0 = pfnInStr;
107 }
108 else
109 AssertReleaseFailed();
110
111 LogFlow(("pdmR0DevHlp_IoPortSetUpContextEx: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
112 return rc;
113}
114
115
116/** @interface_method_impl{PDMDEVHLPR0,pfnMmioSetUpContextEx} */
117static DECLCALLBACK(int) pdmR0DevHlp_MmioSetUpContextEx(PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion, PFNIOMMMIONEWWRITE pfnWrite,
118 PFNIOMMMIONEWREAD pfnRead, PFNIOMMMIONEWFILL pfnFill, void *pvUser)
119{
120 PDMDEV_ASSERT_DEVINS(pDevIns);
121 LogFlow(("pdmR0DevHlp_MmioSetUpContextEx: caller='%s'/%d: hRegion=%#x pfnWrite=%p pfnRead=%p pfnFill=%p pvUser=%p\n",
122 pDevIns->pReg->szName, pDevIns->iInstance, hRegion, pfnWrite, pfnRead, pfnFill, pvUser));
123
124 int rc = VINF_SUCCESS;
125 PRTDEVDUTMMIO pMmio = (PRTDEVDUTMMIO)hRegion;
126 if (RT_LIKELY(pMmio))
127 {
128 pMmio->pvUserR0 = pvUser;
129 pMmio->pfnWriteR0 = pfnWrite;
130 pMmio->pfnReadR0 = pfnRead;
131 pMmio->pfnFillR0 = pfnFill;
132 }
133 else
134 AssertReleaseFailed();
135
136 LogFlow(("pdmR0DevHlp_MmioSetUpContextEx: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
137 return rc;
138}
139
140
141/** @interface_method_impl{PDMDEVHLPR0,pfnMmio2SetUpContext} */
142static DECLCALLBACK(int) pdmR0DevHlp_Mmio2SetUpContext(PPDMDEVINS pDevIns, PGMMMIO2HANDLE hRegion,
143 size_t offSub, size_t cbSub, void **ppvMapping)
144{
145 PDMDEV_ASSERT_DEVINS(pDevIns);
146 LogFlow(("pdmR0DevHlp_Mmio2SetUpContext: caller='%s'/%d: hRegion=%#x offSub=%#zx cbSub=%#zx ppvMapping=%p\n",
147 pDevIns->pReg->szName, pDevIns->iInstance, hRegion, offSub, cbSub, ppvMapping));
148 *ppvMapping = NULL;
149
150 int rc = VERR_NOT_IMPLEMENTED;
151 AssertFailed();
152
153 LogFlow(("pdmR0DevHlp_Mmio2SetUpContext: caller='%s'/%d: returns %Rrc (%p)\n", pDevIns->pReg->szName, pDevIns->iInstance, rc, *ppvMapping));
154 return rc;
155}
156
157
158/** @interface_method_impl{PDMDEVHLPR0,pfnPCIPhysRead} */
159static DECLCALLBACK(int) pdmR0DevHlp_PCIPhysRead(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys,
160 void *pvBuf, size_t cbRead, uint32_t fFlags)
161{
162 PDMDEV_ASSERT_DEVINS(pDevIns);
163 if (!pPciDev) /* NULL is an alias for the default PCI device. */
164 pPciDev = pDevIns->apPciDevs[0];
165 AssertReturn(pPciDev, VERR_PDM_NOT_PCI_DEVICE);
166 PDMPCIDEV_ASSERT_VALID_AND_REGISTERED(pDevIns, pPciDev);
167
168#ifndef PDM_DO_NOT_RESPECT_PCI_BM_BIT
169 /*
170 * Just check the busmaster setting here and forward the request to the generic read helper.
171 */
172 if (PCIDevIsBusmaster(pPciDev))
173 { /* likely */ }
174 else
175 {
176 LogFunc(("caller=%p/%d: returns %Rrc - Not bus master! GCPhys=%RGp cbRead=%#zx\n", pDevIns, pDevIns->iInstance,
177 VERR_PDM_NOT_PCI_BUS_MASTER, GCPhys, cbRead));
178 memset(pvBuf, 0xff, cbRead);
179 return VERR_PDM_NOT_PCI_BUS_MASTER;
180 }
181#endif
182
183 return pDevIns->pHlpR0->pfnPhysRead(pDevIns, GCPhys, pvBuf, cbRead, fFlags);
184}
185
186
187/** @interface_method_impl{PDMDEVHLPR0,pfnPCIPhysWrite} */
188static DECLCALLBACK(int) pdmR0DevHlp_PCIPhysWrite(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys,
189 const void *pvBuf, size_t cbWrite, uint32_t fFlags)
190{
191 PDMDEV_ASSERT_DEVINS(pDevIns);
192 if (!pPciDev) /* NULL is an alias for the default PCI device. */
193 pPciDev = pDevIns->apPciDevs[0];
194 AssertReturn(pPciDev, VERR_PDM_NOT_PCI_DEVICE);
195 PDMPCIDEV_ASSERT_VALID_AND_REGISTERED(pDevIns, pPciDev);
196
197#ifndef PDM_DO_NOT_RESPECT_PCI_BM_BIT
198 /*
199 * Just check the busmaster setting here and forward the request to the generic read helper.
200 */
201 if (PCIDevIsBusmaster(pPciDev))
202 { /* likely */ }
203 else
204 {
205 LogFunc(("caller=%p/%d: returns %Rrc - Not bus master! GCPhys=%RGp cbWrite=%#zx\n", pDevIns, pDevIns->iInstance,
206 VERR_PDM_NOT_PCI_BUS_MASTER, GCPhys, cbWrite));
207 return VERR_PDM_NOT_PCI_BUS_MASTER;
208 }
209#endif
210
211 return pDevIns->pHlpR0->pfnPhysWrite(pDevIns, GCPhys, pvBuf, cbWrite, fFlags);
212}
213
214
215/** @interface_method_impl{PDMDEVHLPR0,pfnPCISetIrq} */
216static DECLCALLBACK(void) pdmR0DevHlp_PCISetIrq(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iIrq, int iLevel)
217{
218 PDMDEV_ASSERT_DEVINS(pDevIns);
219 if (!pPciDev) /* NULL is an alias for the default PCI device. */
220 pPciDev = pDevIns->apPciDevs[0];
221 AssertReturnVoid(pPciDev);
222 LogFlow(("pdmR0DevHlp_PCISetIrq: caller=%p/%d: pPciDev=%p:{%#x} iIrq=%d iLevel=%d\n",
223 pDevIns, pDevIns->iInstance, pPciDev, pPciDev->uDevFn, iIrq, iLevel));
224 PDMPCIDEV_ASSERT_VALID_AND_REGISTERED(pDevIns, pPciDev);
225
226 AssertFailed();
227
228 LogFlow(("pdmR0DevHlp_PCISetIrq: caller=%p/%d: returns void; uTagSrc=%#x\n", pDevIns, pDevIns->iInstance, 0 /*uTagSrc*/));
229}
230
231
232/** @interface_method_impl{PDMDEVHLPR0,pfnISASetIrq} */
233static DECLCALLBACK(void) pdmR0DevHlp_ISASetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel)
234{
235 PDMDEV_ASSERT_DEVINS(pDevIns);
236 LogFlow(("pdmR0DevHlp_ISASetIrq: caller=%p/%d: iIrq=%d iLevel=%d\n", pDevIns, pDevIns->iInstance, iIrq, iLevel));
237
238 AssertFailed();
239
240 LogFlow(("pdmR0DevHlp_ISASetIrq: caller=%p/%d: returns void; uTagSrc=%#x\n", pDevIns, pDevIns->iInstance, 0 /*uTagSrc*/));
241}
242
243
244/** @interface_method_impl{PDMDEVHLPR0,pfnPhysRead} */
245static DECLCALLBACK(int) pdmR0DevHlp_PhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, uint32_t fFlags)
246{
247 RT_NOREF(fFlags);
248
249 PDMDEV_ASSERT_DEVINS(pDevIns);
250 LogFlow(("pdmR0DevHlp_PhysRead: caller=%p/%d: GCPhys=%RGp pvBuf=%p cbRead=%#x\n",
251 pDevIns, pDevIns->iInstance, GCPhys, pvBuf, cbRead));
252
253 VBOXSTRICTRC rcStrict = VERR_NOT_IMPLEMENTED;
254 AssertFailed();
255
256 Log(("pdmR0DevHlp_PhysRead: caller=%p/%d: returns %Rrc\n", pDevIns, pDevIns->iInstance, VBOXSTRICTRC_VAL(rcStrict) ));
257 return VBOXSTRICTRC_VAL(rcStrict);
258}
259
260
261/** @interface_method_impl{PDMDEVHLPR0,pfnPhysWrite} */
262static DECLCALLBACK(int) pdmR0DevHlp_PhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, uint32_t fFlags)
263{
264 RT_NOREF(fFlags);
265
266 PDMDEV_ASSERT_DEVINS(pDevIns);
267 LogFlow(("pdmR0DevHlp_PhysWrite: caller=%p/%d: GCPhys=%RGp pvBuf=%p cbWrite=%#x\n",
268 pDevIns, pDevIns->iInstance, GCPhys, pvBuf, cbWrite));
269
270 VBOXSTRICTRC rcStrict = VERR_NOT_IMPLEMENTED;
271 AssertFailed();
272
273 Log(("pdmR0DevHlp_PhysWrite: caller=%p/%d: returns %Rrc\n", pDevIns, pDevIns->iInstance, VBOXSTRICTRC_VAL(rcStrict) ));
274 return VBOXSTRICTRC_VAL(rcStrict);
275}
276
277
278/** @interface_method_impl{PDMDEVHLPR0,pfnA20IsEnabled} */
279static DECLCALLBACK(bool) pdmR0DevHlp_A20IsEnabled(PPDMDEVINS pDevIns)
280{
281 PDMDEV_ASSERT_DEVINS(pDevIns);
282 LogFlow(("pdmR0DevHlp_A20IsEnabled: caller=%p/%d:\n", pDevIns, pDevIns->iInstance));
283
284 bool fEnabled = false;
285 AssertFailed();
286
287 Log(("pdmR0DevHlp_A20IsEnabled: caller=%p/%d: returns %RTbool\n", pDevIns, pDevIns->iInstance, fEnabled));
288 return fEnabled;
289}
290
291
292/** @interface_method_impl{PDMDEVHLPR0,pfnVMState} */
293static DECLCALLBACK(VMSTATE) pdmR0DevHlp_VMState(PPDMDEVINS pDevIns)
294{
295 PDMDEV_ASSERT_DEVINS(pDevIns);
296
297 VMSTATE enmVMState = VMSTATE_CREATING;// pDevIns->Internal.s.pGVM->enmVMState;
298
299 LogFlow(("pdmR0DevHlp_VMState: caller=%p/%d: returns %d\n", pDevIns, pDevIns->iInstance, enmVMState));
300 return enmVMState;
301}
302
303
304/** @interface_method_impl{PDMDEVHLPR0,pfnGetVM} */
305static DECLCALLBACK(PVMCC) pdmR0DevHlp_GetVM(PPDMDEVINS pDevIns)
306{
307 PDMDEV_ASSERT_DEVINS(pDevIns);
308 LogFlow(("pdmR0DevHlp_GetVM: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));
309 AssertFailed();
310 return NULL; //pDevIns->Internal.s.pGVM;
311}
312
313
314/** @interface_method_impl{PDMDEVHLPR0,pfnGetVMCPU} */
315static DECLCALLBACK(PVMCPUCC) pdmR0DevHlp_GetVMCPU(PPDMDEVINS pDevIns)
316{
317 PDMDEV_ASSERT_DEVINS(pDevIns);
318 LogFlow(("pdmR0DevHlp_GetVMCPU: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));
319 AssertFailed();
320 return NULL; //VMMGetCpu(pDevIns->Internal.s.pGVM);
321}
322
323
324/** @interface_method_impl{PDMDEVHLPRC,pfnGetCurrentCpuId} */
325static DECLCALLBACK(VMCPUID) pdmR0DevHlp_GetCurrentCpuId(PPDMDEVINS pDevIns)
326{
327 PDMDEV_ASSERT_DEVINS(pDevIns);
328 LogFlow(("pdmR0DevHlp_GetCurrentCpuId: caller='%p'/%d for CPU %u\n", pDevIns, pDevIns->iInstance, 0 /*idCpu*/));
329 AssertFailed();
330 return 0; //idCpu;
331}
332
333
334/** @interface_method_impl{PDMDEVHLPR0,pfnTimerFromMicro} */
335static DECLCALLBACK(uint64_t) pdmR0DevHlp_TimerFromMicro(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cMicroSecs)
336{
337 PDMDEV_ASSERT_DEVINS(pDevIns);
338 AssertFailed();
339 return 0; //TMTimerFromMicro(pDevIns->Internal.s.pGVM, hTimer, cMicroSecs);
340}
341
342
343/** @interface_method_impl{PDMDEVHLPR0,pfnTimerFromMilli} */
344static DECLCALLBACK(uint64_t) pdmR0DevHlp_TimerFromMilli(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cMilliSecs)
345{
346 PDMDEV_ASSERT_DEVINS(pDevIns);
347 AssertFailed();
348 return 0;
349}
350
351
352/** @interface_method_impl{PDMDEVHLPR0,pfnTimerFromNano} */
353static DECLCALLBACK(uint64_t) pdmR0DevHlp_TimerFromNano(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cNanoSecs)
354{
355 PDMDEV_ASSERT_DEVINS(pDevIns);
356 AssertFailed();
357 return 0;
358}
359
360/** @interface_method_impl{PDMDEVHLPR0,pfnTimerGet} */
361static DECLCALLBACK(uint64_t) pdmR0DevHlp_TimerGet(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
362{
363 PDMDEV_ASSERT_DEVINS(pDevIns);
364 AssertFailed();
365 return 0;
366}
367
368
369/** @interface_method_impl{PDMDEVHLPR0,pfnTimerGetFreq} */
370static DECLCALLBACK(uint64_t) pdmR0DevHlp_TimerGetFreq(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
371{
372 PDMDEV_ASSERT_DEVINS(pDevIns);
373 AssertFailed();
374 return 0;
375}
376
377
378/** @interface_method_impl{PDMDEVHLPR0,pfnTimerGetNano} */
379static DECLCALLBACK(uint64_t) pdmR0DevHlp_TimerGetNano(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
380{
381 PDMDEV_ASSERT_DEVINS(pDevIns);
382 AssertFailed();
383 return 0;
384}
385
386
387/** @interface_method_impl{PDMDEVHLPR0,pfnTimerIsActive} */
388static DECLCALLBACK(bool) pdmR0DevHlp_TimerIsActive(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
389{
390 PDMDEV_ASSERT_DEVINS(pDevIns);
391 AssertFailed();
392 return false;
393}
394
395
396/** @interface_method_impl{PDMDEVHLPR0,pfnTimerIsLockOwner} */
397static DECLCALLBACK(bool) pdmR0DevHlp_TimerIsLockOwner(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
398{
399 PDMDEV_ASSERT_DEVINS(pDevIns);
400 AssertFailed();
401 return false;
402}
403
404
405/** @interface_method_impl{PDMDEVHLPR0,pfnTimerLockClock} */
406static DECLCALLBACK(VBOXSTRICTRC) pdmR0DevHlp_TimerLockClock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, int rcBusy)
407{
408 PDMDEV_ASSERT_DEVINS(pDevIns);
409 AssertFailed();
410 return VERR_NOT_IMPLEMENTED;
411}
412
413
414/** @interface_method_impl{PDMDEVHLPR0,pfnTimerLockClock2} */
415static DECLCALLBACK(VBOXSTRICTRC) pdmR0DevHlp_TimerLockClock2(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer,
416 PPDMCRITSECT pCritSect, int rcBusy)
417{
418 PDMDEV_ASSERT_DEVINS(pDevIns);
419 AssertFailed();
420 return VERR_NOT_IMPLEMENTED;
421}
422
423
424/** @interface_method_impl{PDMDEVHLPR0,pfnTimerSet} */
425static DECLCALLBACK(int) pdmR0DevHlp_TimerSet(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t uExpire)
426{
427 PDMDEV_ASSERT_DEVINS(pDevIns);
428 AssertFailed();
429 return VERR_NOT_IMPLEMENTED;
430}
431
432
433/** @interface_method_impl{PDMDEVHLPR0,pfnTimerSetFrequencyHint} */
434static DECLCALLBACK(int) pdmR0DevHlp_TimerSetFrequencyHint(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint32_t uHz)
435{
436 PDMDEV_ASSERT_DEVINS(pDevIns);
437 AssertFailed();
438 return VERR_NOT_IMPLEMENTED;
439}
440
441
442/** @interface_method_impl{PDMDEVHLPR0,pfnTimerSetMicro} */
443static DECLCALLBACK(int) pdmR0DevHlp_TimerSetMicro(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cMicrosToNext)
444{
445 PDMDEV_ASSERT_DEVINS(pDevIns);
446 AssertFailed();
447 return VERR_NOT_IMPLEMENTED;
448}
449
450
451/** @interface_method_impl{PDMDEVHLPR0,pfnTimerSetMillies} */
452static DECLCALLBACK(int) pdmR0DevHlp_TimerSetMillies(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cMilliesToNext)
453{
454 PDMDEV_ASSERT_DEVINS(pDevIns);
455 AssertFailed();
456 return VERR_NOT_IMPLEMENTED;
457}
458
459
460/** @interface_method_impl{PDMDEVHLPR0,pfnTimerSetNano} */
461static DECLCALLBACK(int) pdmR0DevHlp_TimerSetNano(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cNanosToNext)
462{
463 PDMDEV_ASSERT_DEVINS(pDevIns);
464 AssertFailed();
465 return VERR_NOT_IMPLEMENTED;
466}
467
468
469/** @interface_method_impl{PDMDEVHLPR0,pfnTimerSetRelative} */
470static DECLCALLBACK(int) pdmR0DevHlp_TimerSetRelative(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cTicksToNext, uint64_t *pu64Now)
471{
472 PDMDEV_ASSERT_DEVINS(pDevIns);
473 AssertFailed();
474 return VERR_NOT_IMPLEMENTED;
475}
476
477
478/** @interface_method_impl{PDMDEVHLPR0,pfnTimerStop} */
479static DECLCALLBACK(int) pdmR0DevHlp_TimerStop(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
480{
481 PDMDEV_ASSERT_DEVINS(pDevIns);
482 AssertFailed();
483 return VERR_NOT_IMPLEMENTED;
484}
485
486
487/** @interface_method_impl{PDMDEVHLPR0,pfnTimerUnlockClock} */
488static DECLCALLBACK(void) pdmR0DevHlp_TimerUnlockClock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
489{
490 PDMDEV_ASSERT_DEVINS(pDevIns);
491 AssertFailed();
492}
493
494
495/** @interface_method_impl{PDMDEVHLPR0,pfnTimerUnlockClock2} */
496static DECLCALLBACK(void) pdmR0DevHlp_TimerUnlockClock2(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect)
497{
498 PDMDEV_ASSERT_DEVINS(pDevIns);
499 AssertFailed();
500}
501
502
503/** @interface_method_impl{PDMDEVHLPR0,pfnTMTimeVirtGet} */
504static DECLCALLBACK(uint64_t) pdmR0DevHlp_TMTimeVirtGet(PPDMDEVINS pDevIns)
505{
506 PDMDEV_ASSERT_DEVINS(pDevIns);
507 LogFlow(("pdmR0DevHlp_TMTimeVirtGet: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));
508 AssertFailed();
509 return 0;
510}
511
512
513/** @interface_method_impl{PDMDEVHLPR0,pfnTMTimeVirtGetFreq} */
514static DECLCALLBACK(uint64_t) pdmR0DevHlp_TMTimeVirtGetFreq(PPDMDEVINS pDevIns)
515{
516 PDMDEV_ASSERT_DEVINS(pDevIns);
517 LogFlow(("pdmR0DevHlp_TMTimeVirtGetFreq: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));
518 AssertFailed();
519 return 0;
520}
521
522
523/** @interface_method_impl{PDMDEVHLPR0,pfnTMTimeVirtGetNano} */
524static DECLCALLBACK(uint64_t) pdmR0DevHlp_TMTimeVirtGetNano(PPDMDEVINS pDevIns)
525{
526 PDMDEV_ASSERT_DEVINS(pDevIns);
527 LogFlow(("pdmR0DevHlp_TMTimeVirtGetNano: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));
528 AssertFailed();
529 return 0;
530}
531
532
533/** Converts a queue handle to a ring-0 queue pointer. */
534DECLINLINE(PPDMQUEUE) pdmR0DevHlp_QueueToPtr(PPDMDEVINS pDevIns, PDMQUEUEHANDLE hQueue)
535{
536 PDMDEV_ASSERT_DEVINS(pDevIns);
537 AssertFailed();
538 return NULL;
539}
540
541
542/** @interface_method_impl{PDMDEVHLPR0,pfnQueueAlloc} */
543static DECLCALLBACK(PPDMQUEUEITEMCORE) pdmR0DevHlp_QueueAlloc(PPDMDEVINS pDevIns, PDMQUEUEHANDLE hQueue)
544{
545 AssertFailed();
546 return NULL; //PDMQueueAlloc(pdmR0DevHlp_QueueToPtr(pDevIns, hQueue));
547}
548
549
550/** @interface_method_impl{PDMDEVHLPR0,pfnQueueInsert} */
551static DECLCALLBACK(void) pdmR0DevHlp_QueueInsert(PPDMDEVINS pDevIns, PDMQUEUEHANDLE hQueue, PPDMQUEUEITEMCORE pItem)
552{
553 AssertFailed();
554 //return PDMQueueInsert(pdmR0DevHlp_QueueToPtr(pDevIns, hQueue), pItem);
555}
556
557
558/** @interface_method_impl{PDMDEVHLPR0,pfnQueueFlushIfNecessary} */
559static DECLCALLBACK(bool) pdmR0DevHlp_QueueFlushIfNecessary(PPDMDEVINS pDevIns, PDMQUEUEHANDLE hQueue)
560{
561 AssertFailed();
562 return false; //PDMQueueFlushIfNecessary(pdmR0DevHlp_QueueToPtr(pDevIns, hQueue));
563}
564
565
566/** @interface_method_impl{PDMDEVHLPR0,pfnTaskTrigger} */
567static DECLCALLBACK(int) pdmR0DevHlp_TaskTrigger(PPDMDEVINS pDevIns, PDMTASKHANDLE hTask)
568{
569 PDMDEV_ASSERT_DEVINS(pDevIns);
570 LogFlow(("pdmR0DevHlp_TaskTrigger: caller='%s'/%d: hTask=%RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, hTask));
571
572 AssertFailed();
573 int rc = VERR_NOT_IMPLEMENTED; //PDMTaskTrigger(pDevIns->Internal.s.pGVM, PDMTASKTYPE_DEV, pDevIns->pDevInsForR3, hTask);
574
575 LogFlow(("pdmR0DevHlp_TaskTrigger: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
576 return rc;
577}
578
579
580/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventSignal} */
581static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventSignal(PPDMDEVINS pDevIns, SUPSEMEVENT hEvent)
582{
583 PDMDEV_ASSERT_DEVINS(pDevIns);
584 LogFlow(("pdmR0DevHlp_SUPSemEventSignal: caller='%s'/%d: hEvent=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, hEvent));
585
586 AssertFailed();
587 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventSignal(pDevIns->Internal.s.pGVM->pSession, hEvent);
588
589 LogFlow(("pdmR0DevHlp_SUPSemEventSignal: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
590 return rc;
591}
592
593
594/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventWaitNoResume} */
595static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventWaitNoResume(PPDMDEVINS pDevIns, SUPSEMEVENT hEvent, uint32_t cMillies)
596{
597 PDMDEV_ASSERT_DEVINS(pDevIns);
598 LogFlow(("pdmR0DevHlp_SUPSemEventWaitNoResume: caller='%s'/%d: hEvent=%p cNsTimeout=%RU32\n",
599 pDevIns->pReg->szName, pDevIns->iInstance, hEvent, cMillies));
600
601 AssertFailed();
602 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventWaitNoResume(pDevIns->Internal.s.pGVM->pSession, hEvent, cMillies);
603
604 LogFlow(("pdmR0DevHlp_SUPSemEventWaitNoResume: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
605 return rc;
606}
607
608
609/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventWaitNsAbsIntr} */
610static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventWaitNsAbsIntr(PPDMDEVINS pDevIns, SUPSEMEVENT hEvent, uint64_t uNsTimeout)
611{
612 PDMDEV_ASSERT_DEVINS(pDevIns);
613 LogFlow(("pdmR0DevHlp_SUPSemEventWaitNsAbsIntr: caller='%s'/%d: hEvent=%p uNsTimeout=%RU64\n",
614 pDevIns->pReg->szName, pDevIns->iInstance, hEvent, uNsTimeout));
615
616 AssertFailed();
617 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventWaitNsAbsIntr(pDevIns->Internal.s.pGVM->pSession, hEvent, uNsTimeout);
618
619 LogFlow(("pdmR0DevHlp_SUPSemEventWaitNsAbsIntr: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
620 return rc;
621}
622
623
624/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventWaitNsRelIntr} */
625static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventWaitNsRelIntr(PPDMDEVINS pDevIns, SUPSEMEVENT hEvent, uint64_t cNsTimeout)
626{
627 PDMDEV_ASSERT_DEVINS(pDevIns);
628 LogFlow(("pdmR0DevHlp_SUPSemEventWaitNsRelIntr: caller='%s'/%d: hEvent=%p cNsTimeout=%RU64\n",
629 pDevIns->pReg->szName, pDevIns->iInstance, hEvent, cNsTimeout));
630
631 AssertFailed();
632 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventWaitNsRelIntr(pDevIns->Internal.s.pGVM->pSession, hEvent, cNsTimeout);
633
634 LogFlow(("pdmR0DevHlp_SUPSemEventWaitNsRelIntr: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
635 return rc;
636}
637
638
639/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventGetResolution} */
640static DECLCALLBACK(uint32_t) pdmR0DevHlp_SUPSemEventGetResolution(PPDMDEVINS pDevIns)
641{
642 PDMDEV_ASSERT_DEVINS(pDevIns);
643 LogFlow(("pdmR0DevHlp_SUPSemEventGetResolution: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
644
645 AssertFailed();
646 uint32_t cNsResolution = 0; //SUPSemEventGetResolution(pDevIns->Internal.s.pGVM->pSession);
647
648 LogFlow(("pdmR0DevHlp_SUPSemEventGetResolution: caller='%s'/%d: returns %u\n", pDevIns->pReg->szName, pDevIns->iInstance, cNsResolution));
649 return cNsResolution;
650}
651
652
653/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventMultiSignal} */
654static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventMultiSignal(PPDMDEVINS pDevIns, SUPSEMEVENTMULTI hEventMulti)
655{
656 PDMDEV_ASSERT_DEVINS(pDevIns);
657 LogFlow(("pdmR0DevHlp_SUPSemEventMultiSignal: caller='%s'/%d: hEventMulti=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, hEventMulti));
658
659 AssertFailed();
660 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventMultiSignal(pDevIns->Internal.s.pGVM->pSession, hEventMulti);
661
662 LogFlow(("pdmR0DevHlp_SUPSemEventMultiSignal: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
663 return rc;
664}
665
666
667/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventMultiReset} */
668static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventMultiReset(PPDMDEVINS pDevIns, SUPSEMEVENTMULTI hEventMulti)
669{
670 PDMDEV_ASSERT_DEVINS(pDevIns);
671 LogFlow(("pdmR0DevHlp_SUPSemEventMultiReset: caller='%s'/%d: hEventMulti=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, hEventMulti));
672
673 AssertFailed();
674 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventMultiReset(pDevIns->Internal.s.pGVM->pSession, hEventMulti);
675
676 LogFlow(("pdmR0DevHlp_SUPSemEventMultiReset: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
677 return rc;
678}
679
680
681/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventMultiWaitNoResume} */
682static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventMultiWaitNoResume(PPDMDEVINS pDevIns, SUPSEMEVENTMULTI hEventMulti,
683 uint32_t cMillies)
684{
685 PDMDEV_ASSERT_DEVINS(pDevIns);
686 LogFlow(("pdmR0DevHlp_SUPSemEventMultiWaitNoResume: caller='%s'/%d: hEventMulti=%p cMillies=%RU32\n",
687 pDevIns->pReg->szName, pDevIns->iInstance, hEventMulti, cMillies));
688
689 AssertFailed();
690 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventMultiWaitNoResume(pDevIns->Internal.s.pGVM->pSession, hEventMulti, cMillies);
691
692 LogFlow(("pdmR0DevHlp_SUPSemEventMultiWaitNoResume: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
693 return rc;
694}
695
696
697/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventMultiWaitNsAbsIntr} */
698static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventMultiWaitNsAbsIntr(PPDMDEVINS pDevIns, SUPSEMEVENTMULTI hEventMulti,
699 uint64_t uNsTimeout)
700{
701 PDMDEV_ASSERT_DEVINS(pDevIns);
702 LogFlow(("pdmR0DevHlp_SUPSemEventMultiWaitNsAbsIntr: caller='%s'/%d: hEventMulti=%p uNsTimeout=%RU64\n",
703 pDevIns->pReg->szName, pDevIns->iInstance, hEventMulti, uNsTimeout));
704
705 AssertFailed();
706 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventMultiWaitNsAbsIntr(pDevIns->Internal.s.pGVM->pSession, hEventMulti, uNsTimeout);
707
708 LogFlow(("pdmR0DevHlp_SUPSemEventMultiWaitNsAbsIntr: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
709 return rc;
710}
711
712
713/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventMultiWaitNsRelIntr} */
714static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventMultiWaitNsRelIntr(PPDMDEVINS pDevIns, SUPSEMEVENTMULTI hEventMulti,
715 uint64_t cNsTimeout)
716{
717 PDMDEV_ASSERT_DEVINS(pDevIns);
718 LogFlow(("pdmR0DevHlp_SUPSemEventMultiWaitNsRelIntr: caller='%s'/%d: hEventMulti=%p cNsTimeout=%RU64\n",
719 pDevIns->pReg->szName, pDevIns->iInstance, hEventMulti, cNsTimeout));
720
721 AssertFailed();
722 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventMultiWaitNsRelIntr(pDevIns->Internal.s.pGVM->pSession, hEventMulti, cNsTimeout);
723
724 LogFlow(("pdmR0DevHlp_SUPSemEventMultiWaitNsRelIntr: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
725 return rc;
726}
727
728
729/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventMultiGetResolution} */
730static DECLCALLBACK(uint32_t) pdmR0DevHlp_SUPSemEventMultiGetResolution(PPDMDEVINS pDevIns)
731{
732 PDMDEV_ASSERT_DEVINS(pDevIns);
733 LogFlow(("pdmR0DevHlp_SUPSemEventMultiGetResolution: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
734
735 AssertFailed();
736 uint32_t cNsResolution = 0; //SUPSemEventMultiGetResolution(pDevIns->Internal.s.pGVM->pSession);
737
738 LogFlow(("pdmR0DevHlp_SUPSemEventMultiGetResolution: caller='%s'/%d: returns %u\n", pDevIns->pReg->szName, pDevIns->iInstance, cNsResolution));
739 return cNsResolution;
740}
741
742
743/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectGetNop} */
744static DECLCALLBACK(PPDMCRITSECT) pdmR0DevHlp_CritSectGetNop(PPDMDEVINS pDevIns)
745{
746 PDMDEV_ASSERT_DEVINS(pDevIns);
747
748 PPDMCRITSECT pCritSect = &pDevIns->Internal.s.pDut->CritSectNop;
749 LogFlow(("pdmR0DevHlp_CritSectGetNop: caller='%s'/%d: return %p\n", pDevIns->pReg->szName, pDevIns->iInstance, pCritSect));
750 return pCritSect;
751}
752
753
754/** @interface_method_impl{PDMDEVHLPR0,pfnSetDeviceCritSect} */
755static DECLCALLBACK(int) pdmR0DevHlp_SetDeviceCritSect(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect)
756{
757 /*
758 * Validate input.
759 *
760 * Note! We only allow the automatically created default critical section
761 * to be replaced by this API.
762 */
763 PDMDEV_ASSERT_DEVINS(pDevIns);
764 AssertPtrReturn(pCritSect, VERR_INVALID_POINTER);
765 LogFlow(("pdmR0DevHlp_SetDeviceCritSect: caller='%s'/%d: pCritSect=%p\n",
766 pDevIns->pReg->szName, pDevIns->iInstance, pCritSect));
767 AssertReturn(RTCritSectIsInitialized(&pCritSect->s.CritSect), VERR_INVALID_PARAMETER);
768
769 pDevIns->pCritSectRoR0 = pCritSect;
770
771 LogFlow(("pdmR0DevHlp_SetDeviceCritSect: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
772 return VINF_SUCCESS;
773}
774
775
776/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectEnter} */
777static DECLCALLBACK(int) pdmR0DevHlp_CritSectEnter(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, int rcBusy)
778{
779 PDMDEV_ASSERT_DEVINS(pDevIns);
780 AssertFailed();
781 return VERR_NOT_IMPLEMENTED; //PDMCritSectEnter(pDevIns->Internal.s.pGVM, pCritSect, rcBusy);
782}
783
784
785/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectEnterDebug} */
786static DECLCALLBACK(int) pdmR0DevHlp_CritSectEnterDebug(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL)
787{
788 PDMDEV_ASSERT_DEVINS(pDevIns);
789 AssertFailed();
790 return VERR_NOT_IMPLEMENTED; //PDMCritSectEnterDebug(pDevIns->Internal.s.pGVM, pCritSect, rcBusy, uId, RT_SRC_POS_ARGS);
791}
792
793
794/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectTryEnter} */
795static DECLCALLBACK(int) pdmR0DevHlp_CritSectTryEnter(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect)
796{
797 PDMDEV_ASSERT_DEVINS(pDevIns);
798 AssertFailed();
799 return VERR_NOT_IMPLEMENTED; //PDMCritSectTryEnter(pDevIns->Internal.s.pGVM, pCritSect);
800}
801
802
803/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectTryEnterDebug} */
804static DECLCALLBACK(int) pdmR0DevHlp_CritSectTryEnterDebug(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL)
805{
806 PDMDEV_ASSERT_DEVINS(pDevIns);
807 AssertFailed();
808 return VERR_NOT_IMPLEMENTED; //PDMCritSectTryEnterDebug(pDevIns->Internal.s.pGVM, pCritSect, uId, RT_SRC_POS_ARGS);
809}
810
811
812/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectLeave} */
813static DECLCALLBACK(int) pdmR0DevHlp_CritSectLeave(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect)
814{
815 PDMDEV_ASSERT_DEVINS(pDevIns);
816 AssertFailed();
817 return VERR_NOT_IMPLEMENTED; //PDMCritSectLeave(pDevIns->Internal.s.pGVM, pCritSect);
818}
819
820
821/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectIsOwner} */
822static DECLCALLBACK(bool) pdmR0DevHlp_CritSectIsOwner(PPDMDEVINS pDevIns, PCPDMCRITSECT pCritSect)
823{
824 PDMDEV_ASSERT_DEVINS(pDevIns);
825 AssertFailed();
826 return VERR_NOT_IMPLEMENTED; //PDMCritSectIsOwner(pDevIns->Internal.s.pGVM, pCritSect);
827}
828
829
830/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectIsInitialized} */
831static DECLCALLBACK(bool) pdmR0DevHlp_CritSectIsInitialized(PPDMDEVINS pDevIns, PCPDMCRITSECT pCritSect)
832{
833 PDMDEV_ASSERT_DEVINS(pDevIns);
834 RT_NOREF(pDevIns);
835 AssertFailed();
836 return VERR_NOT_IMPLEMENTED; //PDMCritSectIsInitialized(pCritSect);
837}
838
839
840/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectHasWaiters} */
841static DECLCALLBACK(bool) pdmR0DevHlp_CritSectHasWaiters(PPDMDEVINS pDevIns, PCPDMCRITSECT pCritSect)
842{
843 PDMDEV_ASSERT_DEVINS(pDevIns);
844 AssertFailed();
845 return VERR_NOT_IMPLEMENTED; //PDMCritSectHasWaiters(pDevIns->Internal.s.pGVM, pCritSect);
846}
847
848
849/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectGetRecursion} */
850static DECLCALLBACK(uint32_t) pdmR0DevHlp_CritSectGetRecursion(PPDMDEVINS pDevIns, PCPDMCRITSECT pCritSect)
851{
852 PDMDEV_ASSERT_DEVINS(pDevIns);
853 RT_NOREF(pDevIns);
854 AssertFailed();
855 return VERR_NOT_IMPLEMENTED; //PDMCritSectGetRecursion(pCritSect);
856}
857
858
859/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectScheduleExitEvent} */
860static DECLCALLBACK(int) pdmR0DevHlp_CritSectScheduleExitEvent(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect,
861 SUPSEMEVENT hEventToSignal)
862{
863 PDMDEV_ASSERT_DEVINS(pDevIns);
864 RT_NOREF(pDevIns);
865 AssertFailed();
866 return VERR_NOT_IMPLEMENTED; //PDMHCCritSectScheduleExitEvent(pCritSect, hEventToSignal);
867}
868
869
870/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwEnterShared} */
871static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwEnterShared(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect, int rcBusy)
872{
873 PDMDEV_ASSERT_DEVINS(pDevIns);
874 AssertFailed();
875 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwEnterShared(pDevIns->Internal.s.pGVM, pCritSect, rcBusy);
876}
877
878
879/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwEnterSharedDebug} */
880static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwEnterSharedDebug(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect, int rcBusy,
881 RTHCUINTPTR uId, RT_SRC_POS_DECL)
882{
883 PDMDEV_ASSERT_DEVINS(pDevIns);
884 AssertFailed();
885 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwEnterSharedDebug(pDevIns->Internal.s.pGVM, pCritSect, rcBusy, uId, RT_SRC_POS_ARGS);
886}
887
888
889
890/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwTryEnterShared} */
891static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwTryEnterShared(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
892{
893 PDMDEV_ASSERT_DEVINS(pDevIns);
894 AssertFailed();
895 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwTryEnterShared(pDevIns->Internal.s.pGVM, pCritSect);
896}
897
898
899/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwTryEnterSharedDebug} */
900static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwTryEnterSharedDebug(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect,
901 RTHCUINTPTR uId, RT_SRC_POS_DECL)
902{
903 PDMDEV_ASSERT_DEVINS(pDevIns);
904 AssertFailed();
905 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwTryEnterSharedDebug(pDevIns->Internal.s.pGVM, pCritSect, uId, RT_SRC_POS_ARGS);
906}
907
908
909/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwLeaveShared} */
910static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwLeaveShared(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
911{
912 PDMDEV_ASSERT_DEVINS(pDevIns);
913 AssertFailed();
914 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwLeaveShared(pDevIns->Internal.s.pGVM, pCritSect);
915}
916
917
918/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwEnterExcl} */
919static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwEnterExcl(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect, int rcBusy)
920{
921 PDMDEV_ASSERT_DEVINS(pDevIns);
922 AssertFailed();
923 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwEnterExcl(pDevIns->Internal.s.pGVM, pCritSect, rcBusy);
924}
925
926
927/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwEnterExclDebug} */
928static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwEnterExclDebug(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect, int rcBusy,
929 RTHCUINTPTR uId, RT_SRC_POS_DECL)
930{
931 PDMDEV_ASSERT_DEVINS(pDevIns);
932 AssertFailed();
933 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwEnterExclDebug(pDevIns->Internal.s.pGVM, pCritSect, rcBusy, uId, RT_SRC_POS_ARGS);
934}
935
936
937/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwTryEnterExcl} */
938static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwTryEnterExcl(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
939{
940 PDMDEV_ASSERT_DEVINS(pDevIns);
941 AssertFailed();
942 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwTryEnterExcl(pDevIns->Internal.s.pGVM, pCritSect);
943}
944
945
946/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwTryEnterExclDebug} */
947static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwTryEnterExclDebug(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect,
948 RTHCUINTPTR uId, RT_SRC_POS_DECL)
949{
950 PDMDEV_ASSERT_DEVINS(pDevIns);
951 AssertFailed();
952 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwTryEnterExclDebug(pDevIns->Internal.s.pGVM, pCritSect, uId, RT_SRC_POS_ARGS);
953}
954
955
956/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwLeaveExcl} */
957static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwLeaveExcl(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
958{
959 PDMDEV_ASSERT_DEVINS(pDevIns);
960 AssertFailed();
961 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwLeaveExcl(pDevIns->Internal.s.pGVM, pCritSect);
962}
963
964
965/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwIsWriteOwner} */
966static DECLCALLBACK(bool) pdmR0DevHlp_CritSectRwIsWriteOwner(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
967{
968 PDMDEV_ASSERT_DEVINS(pDevIns);
969 AssertFailed();
970 return false; //PDMCritSectRwIsWriteOwner(pDevIns->Internal.s.pGVM, pCritSect);
971}
972
973
974/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwIsReadOwner} */
975static DECLCALLBACK(bool) pdmR0DevHlp_CritSectRwIsReadOwner(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect, bool fWannaHear)
976{
977 PDMDEV_ASSERT_DEVINS(pDevIns);
978 AssertFailed();
979 return false; //PDMCritSectRwIsReadOwner(pDevIns->Internal.s.pGVM, pCritSect, fWannaHear);
980}
981
982
983/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwGetWriteRecursion} */
984static DECLCALLBACK(uint32_t) pdmR0DevHlp_CritSectRwGetWriteRecursion(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
985{
986 PDMDEV_ASSERT_DEVINS(pDevIns);
987 RT_NOREF(pDevIns);
988 AssertFailed();
989 return 0; //PDMCritSectRwGetWriteRecursion(pCritSect);
990}
991
992
993/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwGetWriterReadRecursion} */
994static DECLCALLBACK(uint32_t) pdmR0DevHlp_CritSectRwGetWriterReadRecursion(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
995{
996 PDMDEV_ASSERT_DEVINS(pDevIns);
997 RT_NOREF(pDevIns);
998 AssertFailed();
999 return 0; //PDMCritSectRwGetWriterReadRecursion(pCritSect);
1000}
1001
1002
1003/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwGetReadCount} */
1004static DECLCALLBACK(uint32_t) pdmR0DevHlp_CritSectRwGetReadCount(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
1005{
1006 PDMDEV_ASSERT_DEVINS(pDevIns);
1007 RT_NOREF(pDevIns);
1008 AssertFailed();
1009 return 0; //PDMCritSectRwGetReadCount(pCritSect);
1010}
1011
1012
1013/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwIsInitialized} */
1014static DECLCALLBACK(bool) pdmR0DevHlp_CritSectRwIsInitialized(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
1015{
1016 PDMDEV_ASSERT_DEVINS(pDevIns);
1017 RT_NOREF(pDevIns);
1018 AssertFailed();
1019 return false; //PDMCritSectRwIsInitialized(pCritSect);
1020}
1021
1022
1023/** @interface_method_impl{PDMDEVHLPR0,pfnDBGFTraceBuf} */
1024static DECLCALLBACK(RTTRACEBUF) pdmR0DevHlp_DBGFTraceBuf(PPDMDEVINS pDevIns)
1025{
1026 PDMDEV_ASSERT_DEVINS(pDevIns);
1027 AssertFailed();
1028 RTTRACEBUF hTraceBuf = NULL; //pDevIns->Internal.s.pGVM->hTraceBufR0;
1029 LogFlow(("pdmR0DevHlp_DBGFTraceBuf: caller='%p'/%d: returns %p\n", pDevIns, pDevIns->iInstance, hTraceBuf));
1030 return hTraceBuf;
1031}
1032
1033
1034/** @interface_method_impl{PDMDEVHLPR0,pfnPCIBusSetUpContext} */
1035static DECLCALLBACK(int) pdmR0DevHlp_PCIBusSetUpContext(PPDMDEVINS pDevIns, PPDMPCIBUSREGR0 pPciBusReg, PCPDMPCIHLPR0 *ppPciHlp)
1036{
1037 PDMDEV_ASSERT_DEVINS(pDevIns);
1038 LogFlow(("pdmR0DevHlp_PCIBusSetUpContext: caller='%p'/%d: pPciBusReg=%p{.u32Version=%#x, .iBus=%#u, .pfnSetIrq=%p, u32EnvVersion=%#x} ppPciHlp=%p\n",
1039 pDevIns, pDevIns->iInstance, pPciBusReg, pPciBusReg->u32Version, pPciBusReg->iBus, pPciBusReg->pfnSetIrq,
1040 pPciBusReg->u32EndVersion, ppPciHlp));
1041#if 0
1042 PGVM pGVM = pDevIns->Internal.s.pGVM;
1043
1044 /*
1045 * Validate input.
1046 */
1047 AssertPtrReturn(pPciBusReg, VERR_INVALID_POINTER);
1048 AssertLogRelMsgReturn(pPciBusReg->u32Version == PDM_PCIBUSREGCC_VERSION,
1049 ("%#x vs %#x\n", pPciBusReg->u32Version, PDM_PCIBUSREGCC_VERSION), VERR_VERSION_MISMATCH);
1050 AssertPtrReturn(pPciBusReg->pfnSetIrq, VERR_INVALID_POINTER);
1051 AssertLogRelMsgReturn(pPciBusReg->u32EndVersion == PDM_PCIBUSREGCC_VERSION,
1052 ("%#x vs %#x\n", pPciBusReg->u32EndVersion, PDM_PCIBUSREGCC_VERSION), VERR_VERSION_MISMATCH);
1053
1054 AssertPtrReturn(ppPciHlp, VERR_INVALID_POINTER);
1055
1056 VM_ASSERT_STATE_RETURN(pGVM, VMSTATE_CREATING, VERR_WRONG_ORDER);
1057 VM_ASSERT_EMT0_RETURN(pGVM, VERR_VM_THREAD_NOT_EMT);
1058
1059 /* Check the shared bus data (registered earlier from ring-3): */
1060 uint32_t iBus = pPciBusReg->iBus;
1061 ASMCompilerBarrier();
1062 AssertLogRelMsgReturn(iBus < RT_ELEMENTS(pGVM->pdm.s.aPciBuses), ("iBus=%#x\n", iBus), VERR_OUT_OF_RANGE);
1063 PPDMPCIBUS pPciBusShared = &pGVM->pdm.s.aPciBuses[iBus];
1064 AssertLogRelMsgReturn(pPciBusShared->iBus == iBus, ("%u vs %u\n", pPciBusShared->iBus, iBus), VERR_INVALID_PARAMETER);
1065 AssertLogRelMsgReturn(pPciBusShared->pDevInsR3 == pDevIns->pDevInsForR3,
1066 ("%p vs %p (iBus=%u)\n", pPciBusShared->pDevInsR3, pDevIns->pDevInsForR3, iBus), VERR_NOT_OWNER);
1067
1068 /* Check that the bus isn't already registered in ring-0: */
1069 AssertCompile(RT_ELEMENTS(pGVM->pdm.s.aPciBuses) == RT_ELEMENTS(pGVM->pdmr0.s.aPciBuses));
1070 PPDMPCIBUSR0 pPciBusR0 = &pGVM->pdmr0.s.aPciBuses[iBus];
1071 AssertLogRelMsgReturn(pPciBusR0->pDevInsR0 == NULL,
1072 ("%p (caller pDevIns=%p, iBus=%u)\n", pPciBusR0->pDevInsR0, pDevIns, iBus),
1073 VERR_ALREADY_EXISTS);
1074
1075 /*
1076 * Do the registering.
1077 */
1078 pPciBusR0->iBus = iBus;
1079 pPciBusR0->uPadding0 = 0xbeefbeef;
1080 pPciBusR0->pfnSetIrqR0 = pPciBusReg->pfnSetIrq;
1081 pPciBusR0->pDevInsR0 = pDevIns;
1082#endif
1083
1084 AssertFailed();
1085 *ppPciHlp = NULL; //&g_pdmR0PciHlp;
1086
1087 LogFlow(("pdmR0DevHlp_PCIBusSetUpContext: caller='%p'/%d: returns VINF_SUCCESS\n", pDevIns, pDevIns->iInstance));
1088 return VINF_SUCCESS;
1089}
1090
1091
1092/** @interface_method_impl{PDMDEVHLPR0,pfnIommuSetUpContext} */
1093static DECLCALLBACK(int) pdmR0DevHlp_IommuSetUpContext(PPDMDEVINS pDevIns, PPDMIOMMUREGR0 pIommuReg, PCPDMIOMMUHLPR0 *ppIommuHlp)
1094{
1095 PDMDEV_ASSERT_DEVINS(pDevIns);
1096 LogFlow(("pdmR0DevHlp_IommuSetUpContext: caller='%p'/%d: pIommuReg=%p{.u32Version=%#x, u32TheEnd=%#x} ppIommuHlp=%p\n",
1097 pDevIns, pDevIns->iInstance, pIommuReg, pIommuReg->u32Version, pIommuReg->u32TheEnd, ppIommuHlp));
1098#if 0
1099 PGVM pGVM = pDevIns->Internal.s.pGVM;
1100
1101 /*
1102 * Validate input.
1103 */
1104 AssertPtrReturn(pIommuReg, VERR_INVALID_POINTER);
1105 AssertLogRelMsgReturn(pIommuReg->u32Version == PDM_IOMMUREGCC_VERSION,
1106 ("%#x vs %#x\n", pIommuReg->u32Version, PDM_IOMMUREGCC_VERSION), VERR_VERSION_MISMATCH);
1107 AssertPtrReturn(pIommuReg->pfnMemAccess, VERR_INVALID_POINTER);
1108 AssertPtrReturn(pIommuReg->pfnMemBulkAccess, VERR_INVALID_POINTER);
1109 AssertPtrReturn(pIommuReg->pfnMsiRemap, VERR_INVALID_POINTER);
1110 AssertLogRelMsgReturn(pIommuReg->u32TheEnd == PDM_IOMMUREGCC_VERSION,
1111 ("%#x vs %#x\n", pIommuReg->u32TheEnd, PDM_IOMMUREGCC_VERSION), VERR_VERSION_MISMATCH);
1112
1113 AssertPtrReturn(ppIommuHlp, VERR_INVALID_POINTER);
1114
1115 VM_ASSERT_STATE_RETURN(pGVM, VMSTATE_CREATING, VERR_WRONG_ORDER);
1116 VM_ASSERT_EMT0_RETURN(pGVM, VERR_VM_THREAD_NOT_EMT);
1117
1118 /* Check the IOMMU shared data (registered earlier from ring-3). */
1119 uint32_t const idxIommu = pIommuReg->idxIommu;
1120 ASMCompilerBarrier();
1121 AssertLogRelMsgReturn(idxIommu < RT_ELEMENTS(pGVM->pdm.s.aIommus), ("idxIommu=%#x\n", idxIommu), VERR_OUT_OF_RANGE);
1122 PPDMIOMMUR3 pIommuShared = &pGVM->pdm.s.aIommus[idxIommu];
1123 AssertLogRelMsgReturn(pIommuShared->idxIommu == idxIommu, ("%u vs %u\n", pIommuShared->idxIommu, idxIommu), VERR_INVALID_PARAMETER);
1124 AssertLogRelMsgReturn(pIommuShared->pDevInsR3 == pDevIns->pDevInsForR3,
1125 ("%p vs %p (idxIommu=%u)\n", pIommuShared->pDevInsR3, pDevIns->pDevInsForR3, idxIommu), VERR_NOT_OWNER);
1126
1127 /* Check that the IOMMU isn't already registered in ring-0. */
1128 AssertCompile(RT_ELEMENTS(pGVM->pdm.s.aIommus) == RT_ELEMENTS(pGVM->pdmr0.s.aIommus));
1129 PPDMIOMMUR0 pIommuR0 = &pGVM->pdmr0.s.aIommus[idxIommu];
1130 AssertLogRelMsgReturn(pIommuR0->pDevInsR0 == NULL,
1131 ("%p (caller pDevIns=%p, idxIommu=%u)\n", pIommuR0->pDevInsR0, pDevIns, idxIommu),
1132 VERR_ALREADY_EXISTS);
1133
1134 /*
1135 * Register.
1136 */
1137 pIommuR0->idxIommu = idxIommu;
1138 pIommuR0->uPadding0 = 0xdeaddead;
1139 pIommuR0->pDevInsR0 = pDevIns;
1140 pIommuR0->pfnMemAccess = pIommuReg->pfnMemAccess;
1141 pIommuR0->pfnMemBulkAccess = pIommuReg->pfnMemBulkAccess;
1142 pIommuR0->pfnMsiRemap = pIommuReg->pfnMsiRemap;
1143#endif
1144
1145 AssertFailed();
1146 *ppIommuHlp = NULL; //&g_pdmR0IommuHlp;
1147
1148 LogFlow(("pdmR0DevHlp_IommuSetUpContext: caller='%p'/%d: returns VINF_SUCCESS\n", pDevIns, pDevIns->iInstance));
1149 return VINF_SUCCESS;
1150}
1151
1152
1153/** @interface_method_impl{PDMDEVHLPR0,pfnPICSetUpContext} */
1154static DECLCALLBACK(int) pdmR0DevHlp_PICSetUpContext(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLP *ppPicHlp)
1155{
1156 PDMDEV_ASSERT_DEVINS(pDevIns);
1157 LogFlow(("pdmR0DevHlp_PICSetUpContext: caller='%s'/%d: pPicReg=%p:{.u32Version=%#x, .pfnSetIrq=%p, .pfnGetInterrupt=%p, .u32TheEnd=%#x } ppPicHlp=%p\n",
1158 pDevIns->pReg->szName, pDevIns->iInstance, pPicReg, pPicReg->u32Version, pPicReg->pfnSetIrq, pPicReg->pfnGetInterrupt, pPicReg->u32TheEnd, ppPicHlp));
1159#if 0
1160 PGVM pGVM = pDevIns->Internal.s.pGVM;
1161
1162 /*
1163 * Validate input.
1164 */
1165 AssertMsgReturn(pPicReg->u32Version == PDM_PICREG_VERSION,
1166 ("%s/%d: u32Version=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pPicReg->u32Version, PDM_PICREG_VERSION),
1167 VERR_VERSION_MISMATCH);
1168 AssertPtrReturn(pPicReg->pfnSetIrq, VERR_INVALID_POINTER);
1169 AssertPtrReturn(pPicReg->pfnGetInterrupt, VERR_INVALID_POINTER);
1170 AssertMsgReturn(pPicReg->u32TheEnd == PDM_PICREG_VERSION,
1171 ("%s/%d: u32TheEnd=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pPicReg->u32TheEnd, PDM_PICREG_VERSION),
1172 VERR_VERSION_MISMATCH);
1173 AssertPtrReturn(ppPicHlp, VERR_INVALID_POINTER);
1174
1175 VM_ASSERT_STATE_RETURN(pGVM, VMSTATE_CREATING, VERR_WRONG_ORDER);
1176 VM_ASSERT_EMT0_RETURN(pGVM, VERR_VM_THREAD_NOT_EMT);
1177
1178 /* Check that it's the same device as made the ring-3 registrations: */
1179 AssertLogRelMsgReturn(pGVM->pdm.s.Pic.pDevInsR3 == pDevIns->pDevInsForR3,
1180 ("%p vs %p\n", pGVM->pdm.s.Pic.pDevInsR3, pDevIns->pDevInsForR3), VERR_NOT_OWNER);
1181
1182 /* Check that it isn't already registered in ring-0: */
1183 AssertLogRelMsgReturn(pGVM->pdm.s.Pic.pDevInsR0 == NULL, ("%p (caller pDevIns=%p)\n", pGVM->pdm.s.Pic.pDevInsR0, pDevIns),
1184 VERR_ALREADY_EXISTS);
1185
1186 /*
1187 * Take down the callbacks and instance.
1188 */
1189 pGVM->pdm.s.Pic.pDevInsR0 = pDevIns;
1190 pGVM->pdm.s.Pic.pfnSetIrqR0 = pPicReg->pfnSetIrq;
1191 pGVM->pdm.s.Pic.pfnGetInterruptR0 = pPicReg->pfnGetInterrupt;
1192#endif
1193 Log(("PDM: Registered PIC device '%s'/%d pDevIns=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns));
1194
1195 /* set the helper pointer and return. */
1196 AssertFailed();
1197 *ppPicHlp = NULL; //&g_pdmR0PicHlp;
1198 LogFlow(("pdmR0DevHlp_PICSetUpContext: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
1199 return VINF_SUCCESS;
1200}
1201
1202
1203/** @interface_method_impl{PDMDEVHLPR0,pfnApicSetUpContext} */
1204static DECLCALLBACK(int) pdmR0DevHlp_ApicSetUpContext(PPDMDEVINS pDevIns)
1205{
1206 PDMDEV_ASSERT_DEVINS(pDevIns);
1207 LogFlow(("pdmR0DevHlp_ApicSetUpContext: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
1208#if 0
1209 PGVM pGVM = pDevIns->Internal.s.pGVM;
1210
1211 /*
1212 * Validate input.
1213 */
1214 VM_ASSERT_STATE_RETURN(pGVM, VMSTATE_CREATING, VERR_WRONG_ORDER);
1215 VM_ASSERT_EMT0_RETURN(pGVM, VERR_VM_THREAD_NOT_EMT);
1216
1217 /* Check that it's the same device as made the ring-3 registrations: */
1218 AssertLogRelMsgReturn(pGVM->pdm.s.Apic.pDevInsR3 == pDevIns->pDevInsForR3,
1219 ("%p vs %p\n", pGVM->pdm.s.Apic.pDevInsR3, pDevIns->pDevInsForR3), VERR_NOT_OWNER);
1220
1221 /* Check that it isn't already registered in ring-0: */
1222 AssertLogRelMsgReturn(pGVM->pdm.s.Apic.pDevInsR0 == NULL, ("%p (caller pDevIns=%p)\n", pGVM->pdm.s.Apic.pDevInsR0, pDevIns),
1223 VERR_ALREADY_EXISTS);
1224
1225 /*
1226 * Take down the instance.
1227 */
1228 pGVM->pdm.s.Apic.pDevInsR0 = pDevIns;
1229#endif
1230 Log(("PDM: Registered APIC device '%s'/%d pDevIns=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns));
1231
1232 /* set the helper pointer and return. */
1233 LogFlow(("pdmR0DevHlp_ApicSetUpContext: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
1234 return VINF_SUCCESS;
1235}
1236
1237
1238/** @interface_method_impl{PDMDEVHLPR0,pfnIoApicSetUpContext} */
1239static DECLCALLBACK(int) pdmR0DevHlp_IoApicSetUpContext(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLP *ppIoApicHlp)
1240{
1241 PDMDEV_ASSERT_DEVINS(pDevIns);
1242 LogFlow(("pdmR0DevHlp_IoApicSetUpContext: caller='%s'/%d: pIoApicReg=%p:{.u32Version=%#x, .pfnSetIrq=%p, .pfnSendMsi=%p, .pfnSetEoi=%p, .u32TheEnd=%#x } ppIoApicHlp=%p\n",
1243 pDevIns->pReg->szName, pDevIns->iInstance, pIoApicReg, pIoApicReg->u32Version, pIoApicReg->pfnSetIrq, pIoApicReg->pfnSendMsi, pIoApicReg->pfnSetEoi, pIoApicReg->u32TheEnd, ppIoApicHlp));
1244#if 0
1245 PGVM pGVM = pDevIns->Internal.s.pGVM;
1246
1247 /*
1248 * Validate input.
1249 */
1250 AssertMsgReturn(pIoApicReg->u32Version == PDM_IOAPICREG_VERSION,
1251 ("%s/%d: u32Version=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pIoApicReg->u32Version, PDM_IOAPICREG_VERSION),
1252 VERR_VERSION_MISMATCH);
1253 AssertPtrReturn(pIoApicReg->pfnSetIrq, VERR_INVALID_POINTER);
1254 AssertPtrReturn(pIoApicReg->pfnSendMsi, VERR_INVALID_POINTER);
1255 AssertPtrReturn(pIoApicReg->pfnSetEoi, VERR_INVALID_POINTER);
1256 AssertMsgReturn(pIoApicReg->u32TheEnd == PDM_IOAPICREG_VERSION,
1257 ("%s/%d: u32TheEnd=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pIoApicReg->u32TheEnd, PDM_IOAPICREG_VERSION),
1258 VERR_VERSION_MISMATCH);
1259 AssertPtrReturn(ppIoApicHlp, VERR_INVALID_POINTER);
1260
1261 VM_ASSERT_STATE_RETURN(pGVM, VMSTATE_CREATING, VERR_WRONG_ORDER);
1262 VM_ASSERT_EMT0_RETURN(pGVM, VERR_VM_THREAD_NOT_EMT);
1263
1264 /* Check that it's the same device as made the ring-3 registrations: */
1265 AssertLogRelMsgReturn(pGVM->pdm.s.IoApic.pDevInsR3 == pDevIns->pDevInsForR3,
1266 ("%p vs %p\n", pGVM->pdm.s.IoApic.pDevInsR3, pDevIns->pDevInsForR3), VERR_NOT_OWNER);
1267
1268 /* Check that it isn't already registered in ring-0: */
1269 AssertLogRelMsgReturn(pGVM->pdm.s.IoApic.pDevInsR0 == NULL, ("%p (caller pDevIns=%p)\n", pGVM->pdm.s.IoApic.pDevInsR0, pDevIns),
1270 VERR_ALREADY_EXISTS);
1271
1272 /*
1273 * Take down the callbacks and instance.
1274 */
1275 pGVM->pdm.s.IoApic.pDevInsR0 = pDevIns;
1276 pGVM->pdm.s.IoApic.pfnSetIrqR0 = pIoApicReg->pfnSetIrq;
1277 pGVM->pdm.s.IoApic.pfnSendMsiR0 = pIoApicReg->pfnSendMsi;
1278 pGVM->pdm.s.IoApic.pfnSetEoiR0 = pIoApicReg->pfnSetEoi;
1279#endif
1280 Log(("PDM: Registered IOAPIC device '%s'/%d pDevIns=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns));
1281
1282 /* set the helper pointer and return. */
1283 AssertFailed();
1284 *ppIoApicHlp = NULL; //&g_pdmR0IoApicHlp;
1285 LogFlow(("pdmR0DevHlp_IoApicSetUpContext: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
1286 return VINF_SUCCESS;
1287}
1288
1289
1290/** @interface_method_impl{PDMDEVHLPR0,pfnHpetSetUpContext} */
1291static DECLCALLBACK(int) pdmR0DevHlp_HpetSetUpContext(PPDMDEVINS pDevIns, PPDMHPETREG pHpetReg, PCPDMHPETHLPR0 *ppHpetHlp)
1292{
1293 PDMDEV_ASSERT_DEVINS(pDevIns);
1294 LogFlow(("pdmR0DevHlp_HpetSetUpContext: caller='%s'/%d: pHpetReg=%p:{.u32Version=%#x, } ppHpetHlp=%p\n",
1295 pDevIns->pReg->szName, pDevIns->iInstance, pHpetReg, pHpetReg->u32Version, ppHpetHlp));
1296#if 0
1297 PGVM pGVM = pDevIns->Internal.s.pGVM;
1298
1299 /*
1300 * Validate input.
1301 */
1302 AssertMsgReturn(pHpetReg->u32Version == PDM_HPETREG_VERSION,
1303 ("%s/%d: u32Version=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pHpetReg->u32Version, PDM_HPETREG_VERSION),
1304 VERR_VERSION_MISMATCH);
1305 AssertPtrReturn(ppHpetHlp, VERR_INVALID_POINTER);
1306
1307 VM_ASSERT_STATE_RETURN(pGVM, VMSTATE_CREATING, VERR_WRONG_ORDER);
1308 VM_ASSERT_EMT0_RETURN(pGVM, VERR_VM_THREAD_NOT_EMT);
1309
1310 /* Check that it's the same device as made the ring-3 registrations: */
1311 AssertLogRelMsgReturn(pGVM->pdm.s.pHpet == pDevIns->pDevInsForR3, ("%p vs %p\n", pGVM->pdm.s.pHpet, pDevIns->pDevInsForR3),
1312 VERR_NOT_OWNER);
1313
1314 ///* Check that it isn't already registered in ring-0: */
1315 //AssertLogRelMsgReturn(pGVM->pdm.s.Hpet.pDevInsR0 == NULL, ("%p (caller pDevIns=%p)\n", pGVM->pdm.s.Hpet.pDevInsR0, pDevIns),
1316 // VERR_ALREADY_EXISTS);
1317#endif
1318 /*
1319 * Nothing to take down here at present.
1320 */
1321 Log(("PDM: Registered HPET device '%s'/%d pDevIns=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns));
1322
1323 /* set the helper pointer and return. */
1324 AssertFailed();
1325 *ppHpetHlp = NULL; //&g_pdmR0HpetHlp;
1326 LogFlow(("pdmR0DevHlp_HpetSetUpContext: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
1327 return VINF_SUCCESS;
1328}
1329
1330
1331/** @interface_method_impl{PDMDEVHLPR0,pfnPGMHandlerPhysicalPageTempOff} */
1332static DECLCALLBACK(int) pdmR0DevHlp_PGMHandlerPhysicalPageTempOff(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage)
1333{
1334 PDMDEV_ASSERT_DEVINS(pDevIns);
1335 LogFlow(("pdmR0DevHlp_PGMHandlerPhysicalPageTempOff: caller='%s'/%d: GCPhys=%RGp\n", pDevIns->pReg->szName, pDevIns->iInstance, GCPhys));
1336
1337 AssertFailed();
1338 int rc = VERR_NOT_IMPLEMENTED; //PGMHandlerPhysicalPageTempOff(pDevIns->Internal.s.pGVM, GCPhys, GCPhysPage);
1339
1340 Log(("pdmR0DevHlp_PGMHandlerPhysicalPageTempOff: caller='%s'/%d: returns %Rrc\n",
1341 pDevIns->pReg->szName, pDevIns->iInstance, rc));
1342 return rc;
1343}
1344
1345
1346/** @interface_method_impl{PDMDEVHLPR0,pfnMmioMapMmio2Page} */
1347static DECLCALLBACK(int) pdmR0DevHlp_MmioMapMmio2Page(PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion, RTGCPHYS offRegion,
1348 uint64_t hMmio2, RTGCPHYS offMmio2, uint64_t fPageFlags)
1349{
1350 PDMDEV_ASSERT_DEVINS(pDevIns);
1351 LogFlow(("pdmR0DevHlp_MmioMapMmio2Page: caller='%s'/%d: hRegion=%RX64 offRegion=%RGp hMmio2=%RX64 offMmio2=%RGp fPageFlags=%RX64\n",
1352 pDevIns->pReg->szName, pDevIns->iInstance, hRegion, offRegion, hMmio2, offMmio2, fPageFlags));
1353
1354 AssertFailed();
1355 int rc = VERR_NOT_IMPLEMENTED; //IOMMmioMapMmio2Page(pDevIns->Internal.s.pGVM, pDevIns, hRegion, offRegion, hMmio2, offMmio2, fPageFlags);
1356
1357 Log(("pdmR0DevHlp_MmioMapMmio2Page: caller='%s'/%d: returns %Rrc\n",
1358 pDevIns->pReg->szName, pDevIns->iInstance, rc));
1359 return rc;
1360}
1361
1362
1363/** @interface_method_impl{PDMDEVHLPR0,pfnMmioResetRegion} */
1364static DECLCALLBACK(int) pdmR0DevHlp_MmioResetRegion(PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion)
1365{
1366 PDMDEV_ASSERT_DEVINS(pDevIns);
1367 LogFlow(("pdmR0DevHlp_MmioResetRegion: caller='%s'/%d: hRegion=%RX64\n",
1368 pDevIns->pReg->szName, pDevIns->iInstance, hRegion));
1369
1370 AssertFailed();
1371 int rc = VERR_NOT_IMPLEMENTED; //IOMMmioResetRegion(pDevIns->Internal.s.pGVM, pDevIns, hRegion);
1372
1373 Log(("pdmR0DevHlp_MmioResetRegion: caller='%s'/%d: returns %Rrc\n",
1374 pDevIns->pReg->szName, pDevIns->iInstance, rc));
1375 return rc;
1376}
1377
1378
1379/** @interface_method_impl{PDMDEVHLPR0,pfnGIMGetMmio2Regions} */
1380static DECLCALLBACK(PGIMMMIO2REGION) pdmR0DevHlp_GIMGetMmio2Regions(PPDMDEVINS pDevIns, uint32_t *pcRegions)
1381{
1382 PDMDEV_ASSERT_DEVINS(pDevIns);
1383
1384 LogFlow(("pdmR0DevHlp_GIMGetMmio2Regions: caller='%s'/%d: pcRegions=%p\n",
1385 pDevIns->pReg->szName, pDevIns->iInstance, pcRegions));
1386
1387 AssertFailed();
1388 PGIMMMIO2REGION pRegion = NULL; //GIMGetMmio2Regions(pDevIns->Internal.s.pGVM, pcRegions);
1389
1390 LogFlow(("pdmR0DevHlp_GIMGetMmio2Regions: caller='%s'/%d: returns %p\n", pDevIns->pReg->szName, pDevIns->iInstance, pRegion));
1391 return pRegion;
1392}
1393
1394
1395/**
1396 * The Ring-0 Device Helper Callbacks.
1397 */
1398const PDMDEVHLPR0 g_tstDevPdmDevHlpR0 =
1399{
1400 PDM_DEVHLPR0_VERSION,
1401 pdmR0DevHlp_IoPortSetUpContextEx,
1402 pdmR0DevHlp_MmioSetUpContextEx,
1403 pdmR0DevHlp_Mmio2SetUpContext,
1404 pdmR0DevHlp_PCIPhysRead,
1405 pdmR0DevHlp_PCIPhysWrite,
1406 pdmR0DevHlp_PCISetIrq,
1407 pdmR0DevHlp_ISASetIrq,
1408 pdmR0DevHlp_PhysRead,
1409 pdmR0DevHlp_PhysWrite,
1410 pdmR0DevHlp_A20IsEnabled,
1411 pdmR0DevHlp_VMState,
1412 pdmR0DevHlp_GetVM,
1413 pdmR0DevHlp_GetVMCPU,
1414 pdmR0DevHlp_GetCurrentCpuId,
1415 pdmR0DevHlp_TimerFromMicro,
1416 pdmR0DevHlp_TimerFromMilli,
1417 pdmR0DevHlp_TimerFromNano,
1418 pdmR0DevHlp_TimerGet,
1419 pdmR0DevHlp_TimerGetFreq,
1420 pdmR0DevHlp_TimerGetNano,
1421 pdmR0DevHlp_TimerIsActive,
1422 pdmR0DevHlp_TimerIsLockOwner,
1423 pdmR0DevHlp_TimerLockClock,
1424 pdmR0DevHlp_TimerLockClock2,
1425 pdmR0DevHlp_TimerSet,
1426 pdmR0DevHlp_TimerSetFrequencyHint,
1427 pdmR0DevHlp_TimerSetMicro,
1428 pdmR0DevHlp_TimerSetMillies,
1429 pdmR0DevHlp_TimerSetNano,
1430 pdmR0DevHlp_TimerSetRelative,
1431 pdmR0DevHlp_TimerStop,
1432 pdmR0DevHlp_TimerUnlockClock,
1433 pdmR0DevHlp_TimerUnlockClock2,
1434 pdmR0DevHlp_TMTimeVirtGet,
1435 pdmR0DevHlp_TMTimeVirtGetFreq,
1436 pdmR0DevHlp_TMTimeVirtGetNano,
1437 pdmR0DevHlp_QueueAlloc,
1438 pdmR0DevHlp_QueueInsert,
1439 pdmR0DevHlp_QueueFlushIfNecessary,
1440 pdmR0DevHlp_TaskTrigger,
1441 pdmR0DevHlp_SUPSemEventSignal,
1442 pdmR0DevHlp_SUPSemEventWaitNoResume,
1443 pdmR0DevHlp_SUPSemEventWaitNsAbsIntr,
1444 pdmR0DevHlp_SUPSemEventWaitNsRelIntr,
1445 pdmR0DevHlp_SUPSemEventGetResolution,
1446 pdmR0DevHlp_SUPSemEventMultiSignal,
1447 pdmR0DevHlp_SUPSemEventMultiReset,
1448 pdmR0DevHlp_SUPSemEventMultiWaitNoResume,
1449 pdmR0DevHlp_SUPSemEventMultiWaitNsAbsIntr,
1450 pdmR0DevHlp_SUPSemEventMultiWaitNsRelIntr,
1451 pdmR0DevHlp_SUPSemEventMultiGetResolution,
1452 pdmR0DevHlp_CritSectGetNop,
1453 pdmR0DevHlp_SetDeviceCritSect,
1454 pdmR0DevHlp_CritSectEnter,
1455 pdmR0DevHlp_CritSectEnterDebug,
1456 pdmR0DevHlp_CritSectTryEnter,
1457 pdmR0DevHlp_CritSectTryEnterDebug,
1458 pdmR0DevHlp_CritSectLeave,
1459 pdmR0DevHlp_CritSectIsOwner,
1460 pdmR0DevHlp_CritSectIsInitialized,
1461 pdmR0DevHlp_CritSectHasWaiters,
1462 pdmR0DevHlp_CritSectGetRecursion,
1463 pdmR0DevHlp_CritSectScheduleExitEvent,
1464 pdmR0DevHlp_CritSectRwEnterShared,
1465 pdmR0DevHlp_CritSectRwEnterSharedDebug,
1466 pdmR0DevHlp_CritSectRwTryEnterShared,
1467 pdmR0DevHlp_CritSectRwTryEnterSharedDebug,
1468 pdmR0DevHlp_CritSectRwLeaveShared,
1469 pdmR0DevHlp_CritSectRwEnterExcl,
1470 pdmR0DevHlp_CritSectRwEnterExclDebug,
1471 pdmR0DevHlp_CritSectRwTryEnterExcl,
1472 pdmR0DevHlp_CritSectRwTryEnterExclDebug,
1473 pdmR0DevHlp_CritSectRwLeaveExcl,
1474 pdmR0DevHlp_CritSectRwIsWriteOwner,
1475 pdmR0DevHlp_CritSectRwIsReadOwner,
1476 pdmR0DevHlp_CritSectRwGetWriteRecursion,
1477 pdmR0DevHlp_CritSectRwGetWriterReadRecursion,
1478 pdmR0DevHlp_CritSectRwGetReadCount,
1479 pdmR0DevHlp_CritSectRwIsInitialized,
1480 pdmR0DevHlp_DBGFTraceBuf,
1481 pdmR0DevHlp_PCIBusSetUpContext,
1482 pdmR0DevHlp_IommuSetUpContext,
1483 pdmR0DevHlp_PICSetUpContext,
1484 pdmR0DevHlp_ApicSetUpContext,
1485 pdmR0DevHlp_IoApicSetUpContext,
1486 pdmR0DevHlp_HpetSetUpContext,
1487 pdmR0DevHlp_PGMHandlerPhysicalPageTempOff,
1488 pdmR0DevHlp_MmioMapMmio2Page,
1489 pdmR0DevHlp_MmioResetRegion,
1490 pdmR0DevHlp_GIMGetMmio2Regions,
1491 NULL /*pfnReserved1*/,
1492 NULL /*pfnReserved2*/,
1493 NULL /*pfnReserved3*/,
1494 NULL /*pfnReserved4*/,
1495 NULL /*pfnReserved5*/,
1496 NULL /*pfnReserved6*/,
1497 NULL /*pfnReserved7*/,
1498 NULL /*pfnReserved8*/,
1499 NULL /*pfnReserved9*/,
1500 NULL /*pfnReserved10*/,
1501 PDM_DEVHLPR0_VERSION
1502};
Note: See TracBrowser for help on using the repository browser.

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