VirtualBox

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

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

Devices/tstDevice: Make it compile again after the latest callback table changes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 59.6 KB
Line 
1/* $Id: tstDevicePdmDevHlpR0.cpp 93110 2021-12-31 15:58:47Z 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,pfnGetMainExecutionEngine} */
335static DECLCALLBACK(uint8_t) pdmR0DevHlp_GetMainExecutionEngine(PPDMDEVINS pDevIns)
336{
337 PDMDEV_ASSERT_DEVINS(pDevIns);
338 LogFlow(("pdmR0DevHlp_GetMainExecutionEngine: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
339 return VM_EXEC_ENGINE_NOT_SET;
340}
341
342
343/** @interface_method_impl{PDMDEVHLPR0,pfnTimerFromMicro} */
344static DECLCALLBACK(uint64_t) pdmR0DevHlp_TimerFromMicro(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cMicroSecs)
345{
346 PDMDEV_ASSERT_DEVINS(pDevIns);
347 AssertFailed();
348 return 0; //TMTimerFromMicro(pDevIns->Internal.s.pGVM, hTimer, cMicroSecs);
349}
350
351
352/** @interface_method_impl{PDMDEVHLPR0,pfnTimerFromMilli} */
353static DECLCALLBACK(uint64_t) pdmR0DevHlp_TimerFromMilli(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cMilliSecs)
354{
355 PDMDEV_ASSERT_DEVINS(pDevIns);
356 AssertFailed();
357 return 0;
358}
359
360
361/** @interface_method_impl{PDMDEVHLPR0,pfnTimerFromNano} */
362static DECLCALLBACK(uint64_t) pdmR0DevHlp_TimerFromNano(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cNanoSecs)
363{
364 PDMDEV_ASSERT_DEVINS(pDevIns);
365 AssertFailed();
366 return 0;
367}
368
369/** @interface_method_impl{PDMDEVHLPR0,pfnTimerGet} */
370static DECLCALLBACK(uint64_t) pdmR0DevHlp_TimerGet(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
371{
372 PDMDEV_ASSERT_DEVINS(pDevIns);
373 AssertFailed();
374 return 0;
375}
376
377
378/** @interface_method_impl{PDMDEVHLPR0,pfnTimerGetFreq} */
379static DECLCALLBACK(uint64_t) pdmR0DevHlp_TimerGetFreq(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
380{
381 PDMDEV_ASSERT_DEVINS(pDevIns);
382 AssertFailed();
383 return 0;
384}
385
386
387/** @interface_method_impl{PDMDEVHLPR0,pfnTimerGetNano} */
388static DECLCALLBACK(uint64_t) pdmR0DevHlp_TimerGetNano(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
389{
390 PDMDEV_ASSERT_DEVINS(pDevIns);
391 AssertFailed();
392 return 0;
393}
394
395
396/** @interface_method_impl{PDMDEVHLPR0,pfnTimerIsActive} */
397static DECLCALLBACK(bool) pdmR0DevHlp_TimerIsActive(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
398{
399 PDMDEV_ASSERT_DEVINS(pDevIns);
400 AssertFailed();
401 return false;
402}
403
404
405/** @interface_method_impl{PDMDEVHLPR0,pfnTimerIsLockOwner} */
406static DECLCALLBACK(bool) pdmR0DevHlp_TimerIsLockOwner(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
407{
408 PDMDEV_ASSERT_DEVINS(pDevIns);
409 AssertFailed();
410 return false;
411}
412
413
414/** @interface_method_impl{PDMDEVHLPR0,pfnTimerLockClock} */
415static DECLCALLBACK(VBOXSTRICTRC) pdmR0DevHlp_TimerLockClock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, int rcBusy)
416{
417 PDMDEV_ASSERT_DEVINS(pDevIns);
418 AssertFailed();
419 return VERR_NOT_IMPLEMENTED;
420}
421
422
423/** @interface_method_impl{PDMDEVHLPR0,pfnTimerLockClock2} */
424static DECLCALLBACK(VBOXSTRICTRC) pdmR0DevHlp_TimerLockClock2(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer,
425 PPDMCRITSECT pCritSect, int rcBusy)
426{
427 PDMDEV_ASSERT_DEVINS(pDevIns);
428 AssertFailed();
429 return VERR_NOT_IMPLEMENTED;
430}
431
432
433/** @interface_method_impl{PDMDEVHLPR0,pfnTimerSet} */
434static DECLCALLBACK(int) pdmR0DevHlp_TimerSet(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t uExpire)
435{
436 PDMDEV_ASSERT_DEVINS(pDevIns);
437 AssertFailed();
438 return VERR_NOT_IMPLEMENTED;
439}
440
441
442/** @interface_method_impl{PDMDEVHLPR0,pfnTimerSetFrequencyHint} */
443static DECLCALLBACK(int) pdmR0DevHlp_TimerSetFrequencyHint(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint32_t uHz)
444{
445 PDMDEV_ASSERT_DEVINS(pDevIns);
446 AssertFailed();
447 return VERR_NOT_IMPLEMENTED;
448}
449
450
451/** @interface_method_impl{PDMDEVHLPR0,pfnTimerSetMicro} */
452static DECLCALLBACK(int) pdmR0DevHlp_TimerSetMicro(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cMicrosToNext)
453{
454 PDMDEV_ASSERT_DEVINS(pDevIns);
455 AssertFailed();
456 return VERR_NOT_IMPLEMENTED;
457}
458
459
460/** @interface_method_impl{PDMDEVHLPR0,pfnTimerSetMillies} */
461static DECLCALLBACK(int) pdmR0DevHlp_TimerSetMillies(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cMilliesToNext)
462{
463 PDMDEV_ASSERT_DEVINS(pDevIns);
464 AssertFailed();
465 return VERR_NOT_IMPLEMENTED;
466}
467
468
469/** @interface_method_impl{PDMDEVHLPR0,pfnTimerSetNano} */
470static DECLCALLBACK(int) pdmR0DevHlp_TimerSetNano(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cNanosToNext)
471{
472 PDMDEV_ASSERT_DEVINS(pDevIns);
473 AssertFailed();
474 return VERR_NOT_IMPLEMENTED;
475}
476
477
478/** @interface_method_impl{PDMDEVHLPR0,pfnTimerSetRelative} */
479static DECLCALLBACK(int) pdmR0DevHlp_TimerSetRelative(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cTicksToNext, uint64_t *pu64Now)
480{
481 PDMDEV_ASSERT_DEVINS(pDevIns);
482 AssertFailed();
483 return VERR_NOT_IMPLEMENTED;
484}
485
486
487/** @interface_method_impl{PDMDEVHLPR0,pfnTimerStop} */
488static DECLCALLBACK(int) pdmR0DevHlp_TimerStop(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
489{
490 PDMDEV_ASSERT_DEVINS(pDevIns);
491 AssertFailed();
492 return VERR_NOT_IMPLEMENTED;
493}
494
495
496/** @interface_method_impl{PDMDEVHLPR0,pfnTimerUnlockClock} */
497static DECLCALLBACK(void) pdmR0DevHlp_TimerUnlockClock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
498{
499 PDMDEV_ASSERT_DEVINS(pDevIns);
500 AssertFailed();
501}
502
503
504/** @interface_method_impl{PDMDEVHLPR0,pfnTimerUnlockClock2} */
505static DECLCALLBACK(void) pdmR0DevHlp_TimerUnlockClock2(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect)
506{
507 PDMDEV_ASSERT_DEVINS(pDevIns);
508 AssertFailed();
509}
510
511
512/** @interface_method_impl{PDMDEVHLPR0,pfnTMTimeVirtGet} */
513static DECLCALLBACK(uint64_t) pdmR0DevHlp_TMTimeVirtGet(PPDMDEVINS pDevIns)
514{
515 PDMDEV_ASSERT_DEVINS(pDevIns);
516 LogFlow(("pdmR0DevHlp_TMTimeVirtGet: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));
517 AssertFailed();
518 return 0;
519}
520
521
522/** @interface_method_impl{PDMDEVHLPR0,pfnTMTimeVirtGetFreq} */
523static DECLCALLBACK(uint64_t) pdmR0DevHlp_TMTimeVirtGetFreq(PPDMDEVINS pDevIns)
524{
525 PDMDEV_ASSERT_DEVINS(pDevIns);
526 LogFlow(("pdmR0DevHlp_TMTimeVirtGetFreq: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));
527 AssertFailed();
528 return 0;
529}
530
531
532/** @interface_method_impl{PDMDEVHLPR0,pfnTMTimeVirtGetNano} */
533static DECLCALLBACK(uint64_t) pdmR0DevHlp_TMTimeVirtGetNano(PPDMDEVINS pDevIns)
534{
535 PDMDEV_ASSERT_DEVINS(pDevIns);
536 LogFlow(("pdmR0DevHlp_TMTimeVirtGetNano: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));
537 AssertFailed();
538 return 0;
539}
540
541
542/** Converts a queue handle to a ring-0 queue pointer. */
543DECLINLINE(PPDMQUEUE) pdmR0DevHlp_QueueToPtr(PPDMDEVINS pDevIns, PDMQUEUEHANDLE hQueue)
544{
545 PDMDEV_ASSERT_DEVINS(pDevIns);
546 AssertFailed();
547 return NULL;
548}
549
550
551/** @interface_method_impl{PDMDEVHLPR0,pfnQueueAlloc} */
552static DECLCALLBACK(PPDMQUEUEITEMCORE) pdmR0DevHlp_QueueAlloc(PPDMDEVINS pDevIns, PDMQUEUEHANDLE hQueue)
553{
554 AssertFailed();
555 return NULL; //PDMQueueAlloc(pdmR0DevHlp_QueueToPtr(pDevIns, hQueue));
556}
557
558
559/** @interface_method_impl{PDMDEVHLPR0,pfnQueueInsert} */
560static DECLCALLBACK(void) pdmR0DevHlp_QueueInsert(PPDMDEVINS pDevIns, PDMQUEUEHANDLE hQueue, PPDMQUEUEITEMCORE pItem)
561{
562 AssertFailed();
563 //return PDMQueueInsert(pdmR0DevHlp_QueueToPtr(pDevIns, hQueue), pItem);
564}
565
566
567/** @interface_method_impl{PDMDEVHLPR0,pfnQueueFlushIfNecessary} */
568static DECLCALLBACK(bool) pdmR0DevHlp_QueueFlushIfNecessary(PPDMDEVINS pDevIns, PDMQUEUEHANDLE hQueue)
569{
570 AssertFailed();
571 return false; //PDMQueueFlushIfNecessary(pdmR0DevHlp_QueueToPtr(pDevIns, hQueue));
572}
573
574
575/** @interface_method_impl{PDMDEVHLPR0,pfnTaskTrigger} */
576static DECLCALLBACK(int) pdmR0DevHlp_TaskTrigger(PPDMDEVINS pDevIns, PDMTASKHANDLE hTask)
577{
578 PDMDEV_ASSERT_DEVINS(pDevIns);
579 LogFlow(("pdmR0DevHlp_TaskTrigger: caller='%s'/%d: hTask=%RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, hTask));
580
581 AssertFailed();
582 int rc = VERR_NOT_IMPLEMENTED; //PDMTaskTrigger(pDevIns->Internal.s.pGVM, PDMTASKTYPE_DEV, pDevIns->pDevInsForR3, hTask);
583
584 LogFlow(("pdmR0DevHlp_TaskTrigger: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
585 return rc;
586}
587
588
589/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventSignal} */
590static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventSignal(PPDMDEVINS pDevIns, SUPSEMEVENT hEvent)
591{
592 PDMDEV_ASSERT_DEVINS(pDevIns);
593 LogFlow(("pdmR0DevHlp_SUPSemEventSignal: caller='%s'/%d: hEvent=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, hEvent));
594
595 AssertFailed();
596 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventSignal(pDevIns->Internal.s.pGVM->pSession, hEvent);
597
598 LogFlow(("pdmR0DevHlp_SUPSemEventSignal: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
599 return rc;
600}
601
602
603/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventWaitNoResume} */
604static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventWaitNoResume(PPDMDEVINS pDevIns, SUPSEMEVENT hEvent, uint32_t cMillies)
605{
606 PDMDEV_ASSERT_DEVINS(pDevIns);
607 LogFlow(("pdmR0DevHlp_SUPSemEventWaitNoResume: caller='%s'/%d: hEvent=%p cNsTimeout=%RU32\n",
608 pDevIns->pReg->szName, pDevIns->iInstance, hEvent, cMillies));
609
610 AssertFailed();
611 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventWaitNoResume(pDevIns->Internal.s.pGVM->pSession, hEvent, cMillies);
612
613 LogFlow(("pdmR0DevHlp_SUPSemEventWaitNoResume: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
614 return rc;
615}
616
617
618/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventWaitNsAbsIntr} */
619static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventWaitNsAbsIntr(PPDMDEVINS pDevIns, SUPSEMEVENT hEvent, uint64_t uNsTimeout)
620{
621 PDMDEV_ASSERT_DEVINS(pDevIns);
622 LogFlow(("pdmR0DevHlp_SUPSemEventWaitNsAbsIntr: caller='%s'/%d: hEvent=%p uNsTimeout=%RU64\n",
623 pDevIns->pReg->szName, pDevIns->iInstance, hEvent, uNsTimeout));
624
625 AssertFailed();
626 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventWaitNsAbsIntr(pDevIns->Internal.s.pGVM->pSession, hEvent, uNsTimeout);
627
628 LogFlow(("pdmR0DevHlp_SUPSemEventWaitNsAbsIntr: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
629 return rc;
630}
631
632
633/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventWaitNsRelIntr} */
634static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventWaitNsRelIntr(PPDMDEVINS pDevIns, SUPSEMEVENT hEvent, uint64_t cNsTimeout)
635{
636 PDMDEV_ASSERT_DEVINS(pDevIns);
637 LogFlow(("pdmR0DevHlp_SUPSemEventWaitNsRelIntr: caller='%s'/%d: hEvent=%p cNsTimeout=%RU64\n",
638 pDevIns->pReg->szName, pDevIns->iInstance, hEvent, cNsTimeout));
639
640 AssertFailed();
641 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventWaitNsRelIntr(pDevIns->Internal.s.pGVM->pSession, hEvent, cNsTimeout);
642
643 LogFlow(("pdmR0DevHlp_SUPSemEventWaitNsRelIntr: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
644 return rc;
645}
646
647
648/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventGetResolution} */
649static DECLCALLBACK(uint32_t) pdmR0DevHlp_SUPSemEventGetResolution(PPDMDEVINS pDevIns)
650{
651 PDMDEV_ASSERT_DEVINS(pDevIns);
652 LogFlow(("pdmR0DevHlp_SUPSemEventGetResolution: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
653
654 AssertFailed();
655 uint32_t cNsResolution = 0; //SUPSemEventGetResolution(pDevIns->Internal.s.pGVM->pSession);
656
657 LogFlow(("pdmR0DevHlp_SUPSemEventGetResolution: caller='%s'/%d: returns %u\n", pDevIns->pReg->szName, pDevIns->iInstance, cNsResolution));
658 return cNsResolution;
659}
660
661
662/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventMultiSignal} */
663static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventMultiSignal(PPDMDEVINS pDevIns, SUPSEMEVENTMULTI hEventMulti)
664{
665 PDMDEV_ASSERT_DEVINS(pDevIns);
666 LogFlow(("pdmR0DevHlp_SUPSemEventMultiSignal: caller='%s'/%d: hEventMulti=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, hEventMulti));
667
668 AssertFailed();
669 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventMultiSignal(pDevIns->Internal.s.pGVM->pSession, hEventMulti);
670
671 LogFlow(("pdmR0DevHlp_SUPSemEventMultiSignal: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
672 return rc;
673}
674
675
676/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventMultiReset} */
677static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventMultiReset(PPDMDEVINS pDevIns, SUPSEMEVENTMULTI hEventMulti)
678{
679 PDMDEV_ASSERT_DEVINS(pDevIns);
680 LogFlow(("pdmR0DevHlp_SUPSemEventMultiReset: caller='%s'/%d: hEventMulti=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, hEventMulti));
681
682 AssertFailed();
683 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventMultiReset(pDevIns->Internal.s.pGVM->pSession, hEventMulti);
684
685 LogFlow(("pdmR0DevHlp_SUPSemEventMultiReset: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
686 return rc;
687}
688
689
690/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventMultiWaitNoResume} */
691static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventMultiWaitNoResume(PPDMDEVINS pDevIns, SUPSEMEVENTMULTI hEventMulti,
692 uint32_t cMillies)
693{
694 PDMDEV_ASSERT_DEVINS(pDevIns);
695 LogFlow(("pdmR0DevHlp_SUPSemEventMultiWaitNoResume: caller='%s'/%d: hEventMulti=%p cMillies=%RU32\n",
696 pDevIns->pReg->szName, pDevIns->iInstance, hEventMulti, cMillies));
697
698 AssertFailed();
699 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventMultiWaitNoResume(pDevIns->Internal.s.pGVM->pSession, hEventMulti, cMillies);
700
701 LogFlow(("pdmR0DevHlp_SUPSemEventMultiWaitNoResume: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
702 return rc;
703}
704
705
706/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventMultiWaitNsAbsIntr} */
707static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventMultiWaitNsAbsIntr(PPDMDEVINS pDevIns, SUPSEMEVENTMULTI hEventMulti,
708 uint64_t uNsTimeout)
709{
710 PDMDEV_ASSERT_DEVINS(pDevIns);
711 LogFlow(("pdmR0DevHlp_SUPSemEventMultiWaitNsAbsIntr: caller='%s'/%d: hEventMulti=%p uNsTimeout=%RU64\n",
712 pDevIns->pReg->szName, pDevIns->iInstance, hEventMulti, uNsTimeout));
713
714 AssertFailed();
715 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventMultiWaitNsAbsIntr(pDevIns->Internal.s.pGVM->pSession, hEventMulti, uNsTimeout);
716
717 LogFlow(("pdmR0DevHlp_SUPSemEventMultiWaitNsAbsIntr: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
718 return rc;
719}
720
721
722/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventMultiWaitNsRelIntr} */
723static DECLCALLBACK(int) pdmR0DevHlp_SUPSemEventMultiWaitNsRelIntr(PPDMDEVINS pDevIns, SUPSEMEVENTMULTI hEventMulti,
724 uint64_t cNsTimeout)
725{
726 PDMDEV_ASSERT_DEVINS(pDevIns);
727 LogFlow(("pdmR0DevHlp_SUPSemEventMultiWaitNsRelIntr: caller='%s'/%d: hEventMulti=%p cNsTimeout=%RU64\n",
728 pDevIns->pReg->szName, pDevIns->iInstance, hEventMulti, cNsTimeout));
729
730 AssertFailed();
731 int rc = VERR_NOT_IMPLEMENTED; //SUPSemEventMultiWaitNsRelIntr(pDevIns->Internal.s.pGVM->pSession, hEventMulti, cNsTimeout);
732
733 LogFlow(("pdmR0DevHlp_SUPSemEventMultiWaitNsRelIntr: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
734 return rc;
735}
736
737
738/** @interface_method_impl{PDMDEVHLPR0,pfnSUPSemEventMultiGetResolution} */
739static DECLCALLBACK(uint32_t) pdmR0DevHlp_SUPSemEventMultiGetResolution(PPDMDEVINS pDevIns)
740{
741 PDMDEV_ASSERT_DEVINS(pDevIns);
742 LogFlow(("pdmR0DevHlp_SUPSemEventMultiGetResolution: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
743
744 AssertFailed();
745 uint32_t cNsResolution = 0; //SUPSemEventMultiGetResolution(pDevIns->Internal.s.pGVM->pSession);
746
747 LogFlow(("pdmR0DevHlp_SUPSemEventMultiGetResolution: caller='%s'/%d: returns %u\n", pDevIns->pReg->szName, pDevIns->iInstance, cNsResolution));
748 return cNsResolution;
749}
750
751
752/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectGetNop} */
753static DECLCALLBACK(PPDMCRITSECT) pdmR0DevHlp_CritSectGetNop(PPDMDEVINS pDevIns)
754{
755 PDMDEV_ASSERT_DEVINS(pDevIns);
756
757 PPDMCRITSECT pCritSect = &pDevIns->Internal.s.pDut->CritSectNop;
758 LogFlow(("pdmR0DevHlp_CritSectGetNop: caller='%s'/%d: return %p\n", pDevIns->pReg->szName, pDevIns->iInstance, pCritSect));
759 return pCritSect;
760}
761
762
763/** @interface_method_impl{PDMDEVHLPR0,pfnSetDeviceCritSect} */
764static DECLCALLBACK(int) pdmR0DevHlp_SetDeviceCritSect(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect)
765{
766 /*
767 * Validate input.
768 *
769 * Note! We only allow the automatically created default critical section
770 * to be replaced by this API.
771 */
772 PDMDEV_ASSERT_DEVINS(pDevIns);
773 AssertPtrReturn(pCritSect, VERR_INVALID_POINTER);
774 LogFlow(("pdmR0DevHlp_SetDeviceCritSect: caller='%s'/%d: pCritSect=%p\n",
775 pDevIns->pReg->szName, pDevIns->iInstance, pCritSect));
776 AssertReturn(RTCritSectIsInitialized(&pCritSect->s.CritSect), VERR_INVALID_PARAMETER);
777
778 pDevIns->pCritSectRoR0 = pCritSect;
779
780 LogFlow(("pdmR0DevHlp_SetDeviceCritSect: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
781 return VINF_SUCCESS;
782}
783
784
785/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectEnter} */
786static DECLCALLBACK(int) pdmR0DevHlp_CritSectEnter(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, int rcBusy)
787{
788 PDMDEV_ASSERT_DEVINS(pDevIns);
789 AssertFailed();
790 return VERR_NOT_IMPLEMENTED; //PDMCritSectEnter(pDevIns->Internal.s.pGVM, pCritSect, rcBusy);
791}
792
793
794/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectEnterDebug} */
795static DECLCALLBACK(int) pdmR0DevHlp_CritSectEnterDebug(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL)
796{
797 PDMDEV_ASSERT_DEVINS(pDevIns);
798 AssertFailed();
799 return VERR_NOT_IMPLEMENTED; //PDMCritSectEnterDebug(pDevIns->Internal.s.pGVM, pCritSect, rcBusy, uId, RT_SRC_POS_ARGS);
800}
801
802
803/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectTryEnter} */
804static DECLCALLBACK(int) pdmR0DevHlp_CritSectTryEnter(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect)
805{
806 PDMDEV_ASSERT_DEVINS(pDevIns);
807 AssertFailed();
808 return VERR_NOT_IMPLEMENTED; //PDMCritSectTryEnter(pDevIns->Internal.s.pGVM, pCritSect);
809}
810
811
812/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectTryEnterDebug} */
813static DECLCALLBACK(int) pdmR0DevHlp_CritSectTryEnterDebug(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL)
814{
815 PDMDEV_ASSERT_DEVINS(pDevIns);
816 AssertFailed();
817 return VERR_NOT_IMPLEMENTED; //PDMCritSectTryEnterDebug(pDevIns->Internal.s.pGVM, pCritSect, uId, RT_SRC_POS_ARGS);
818}
819
820
821/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectLeave} */
822static DECLCALLBACK(int) pdmR0DevHlp_CritSectLeave(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect)
823{
824 PDMDEV_ASSERT_DEVINS(pDevIns);
825 AssertFailed();
826 return VERR_NOT_IMPLEMENTED; //PDMCritSectLeave(pDevIns->Internal.s.pGVM, pCritSect);
827}
828
829
830/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectIsOwner} */
831static DECLCALLBACK(bool) pdmR0DevHlp_CritSectIsOwner(PPDMDEVINS pDevIns, PCPDMCRITSECT pCritSect)
832{
833 PDMDEV_ASSERT_DEVINS(pDevIns);
834 AssertFailed();
835 return VERR_NOT_IMPLEMENTED; //PDMCritSectIsOwner(pDevIns->Internal.s.pGVM, pCritSect);
836}
837
838
839/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectIsInitialized} */
840static DECLCALLBACK(bool) pdmR0DevHlp_CritSectIsInitialized(PPDMDEVINS pDevIns, PCPDMCRITSECT pCritSect)
841{
842 PDMDEV_ASSERT_DEVINS(pDevIns);
843 RT_NOREF(pDevIns);
844 AssertFailed();
845 return VERR_NOT_IMPLEMENTED; //PDMCritSectIsInitialized(pCritSect);
846}
847
848
849/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectHasWaiters} */
850static DECLCALLBACK(bool) pdmR0DevHlp_CritSectHasWaiters(PPDMDEVINS pDevIns, PCPDMCRITSECT pCritSect)
851{
852 PDMDEV_ASSERT_DEVINS(pDevIns);
853 AssertFailed();
854 return VERR_NOT_IMPLEMENTED; //PDMCritSectHasWaiters(pDevIns->Internal.s.pGVM, pCritSect);
855}
856
857
858/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectGetRecursion} */
859static DECLCALLBACK(uint32_t) pdmR0DevHlp_CritSectGetRecursion(PPDMDEVINS pDevIns, PCPDMCRITSECT pCritSect)
860{
861 PDMDEV_ASSERT_DEVINS(pDevIns);
862 RT_NOREF(pDevIns);
863 AssertFailed();
864 return VERR_NOT_IMPLEMENTED; //PDMCritSectGetRecursion(pCritSect);
865}
866
867
868/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectScheduleExitEvent} */
869static DECLCALLBACK(int) pdmR0DevHlp_CritSectScheduleExitEvent(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect,
870 SUPSEMEVENT hEventToSignal)
871{
872 PDMDEV_ASSERT_DEVINS(pDevIns);
873 RT_NOREF(pDevIns);
874 AssertFailed();
875 return VERR_NOT_IMPLEMENTED; //PDMHCCritSectScheduleExitEvent(pCritSect, hEventToSignal);
876}
877
878
879/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwEnterShared} */
880static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwEnterShared(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect, int rcBusy)
881{
882 PDMDEV_ASSERT_DEVINS(pDevIns);
883 AssertFailed();
884 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwEnterShared(pDevIns->Internal.s.pGVM, pCritSect, rcBusy);
885}
886
887
888/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwEnterSharedDebug} */
889static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwEnterSharedDebug(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect, int rcBusy,
890 RTHCUINTPTR uId, RT_SRC_POS_DECL)
891{
892 PDMDEV_ASSERT_DEVINS(pDevIns);
893 AssertFailed();
894 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwEnterSharedDebug(pDevIns->Internal.s.pGVM, pCritSect, rcBusy, uId, RT_SRC_POS_ARGS);
895}
896
897
898
899/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwTryEnterShared} */
900static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwTryEnterShared(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
901{
902 PDMDEV_ASSERT_DEVINS(pDevIns);
903 AssertFailed();
904 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwTryEnterShared(pDevIns->Internal.s.pGVM, pCritSect);
905}
906
907
908/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwTryEnterSharedDebug} */
909static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwTryEnterSharedDebug(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect,
910 RTHCUINTPTR uId, RT_SRC_POS_DECL)
911{
912 PDMDEV_ASSERT_DEVINS(pDevIns);
913 AssertFailed();
914 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwTryEnterSharedDebug(pDevIns->Internal.s.pGVM, pCritSect, uId, RT_SRC_POS_ARGS);
915}
916
917
918/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwLeaveShared} */
919static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwLeaveShared(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
920{
921 PDMDEV_ASSERT_DEVINS(pDevIns);
922 AssertFailed();
923 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwLeaveShared(pDevIns->Internal.s.pGVM, pCritSect);
924}
925
926
927/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwEnterExcl} */
928static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwEnterExcl(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect, int rcBusy)
929{
930 PDMDEV_ASSERT_DEVINS(pDevIns);
931 AssertFailed();
932 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwEnterExcl(pDevIns->Internal.s.pGVM, pCritSect, rcBusy);
933}
934
935
936/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwEnterExclDebug} */
937static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwEnterExclDebug(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect, int rcBusy,
938 RTHCUINTPTR uId, RT_SRC_POS_DECL)
939{
940 PDMDEV_ASSERT_DEVINS(pDevIns);
941 AssertFailed();
942 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwEnterExclDebug(pDevIns->Internal.s.pGVM, pCritSect, rcBusy, uId, RT_SRC_POS_ARGS);
943}
944
945
946/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwTryEnterExcl} */
947static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwTryEnterExcl(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
948{
949 PDMDEV_ASSERT_DEVINS(pDevIns);
950 AssertFailed();
951 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwTryEnterExcl(pDevIns->Internal.s.pGVM, pCritSect);
952}
953
954
955/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwTryEnterExclDebug} */
956static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwTryEnterExclDebug(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect,
957 RTHCUINTPTR uId, RT_SRC_POS_DECL)
958{
959 PDMDEV_ASSERT_DEVINS(pDevIns);
960 AssertFailed();
961 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwTryEnterExclDebug(pDevIns->Internal.s.pGVM, pCritSect, uId, RT_SRC_POS_ARGS);
962}
963
964
965/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwLeaveExcl} */
966static DECLCALLBACK(int) pdmR0DevHlp_CritSectRwLeaveExcl(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
967{
968 PDMDEV_ASSERT_DEVINS(pDevIns);
969 AssertFailed();
970 return VERR_NOT_IMPLEMENTED; //PDMCritSectRwLeaveExcl(pDevIns->Internal.s.pGVM, pCritSect);
971}
972
973
974/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwIsWriteOwner} */
975static DECLCALLBACK(bool) pdmR0DevHlp_CritSectRwIsWriteOwner(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
976{
977 PDMDEV_ASSERT_DEVINS(pDevIns);
978 AssertFailed();
979 return false; //PDMCritSectRwIsWriteOwner(pDevIns->Internal.s.pGVM, pCritSect);
980}
981
982
983/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwIsReadOwner} */
984static DECLCALLBACK(bool) pdmR0DevHlp_CritSectRwIsReadOwner(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect, bool fWannaHear)
985{
986 PDMDEV_ASSERT_DEVINS(pDevIns);
987 AssertFailed();
988 return false; //PDMCritSectRwIsReadOwner(pDevIns->Internal.s.pGVM, pCritSect, fWannaHear);
989}
990
991
992/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwGetWriteRecursion} */
993static DECLCALLBACK(uint32_t) pdmR0DevHlp_CritSectRwGetWriteRecursion(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
994{
995 PDMDEV_ASSERT_DEVINS(pDevIns);
996 RT_NOREF(pDevIns);
997 AssertFailed();
998 return 0; //PDMCritSectRwGetWriteRecursion(pCritSect);
999}
1000
1001
1002/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwGetWriterReadRecursion} */
1003static DECLCALLBACK(uint32_t) pdmR0DevHlp_CritSectRwGetWriterReadRecursion(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
1004{
1005 PDMDEV_ASSERT_DEVINS(pDevIns);
1006 RT_NOREF(pDevIns);
1007 AssertFailed();
1008 return 0; //PDMCritSectRwGetWriterReadRecursion(pCritSect);
1009}
1010
1011
1012/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwGetReadCount} */
1013static DECLCALLBACK(uint32_t) pdmR0DevHlp_CritSectRwGetReadCount(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
1014{
1015 PDMDEV_ASSERT_DEVINS(pDevIns);
1016 RT_NOREF(pDevIns);
1017 AssertFailed();
1018 return 0; //PDMCritSectRwGetReadCount(pCritSect);
1019}
1020
1021
1022/** @interface_method_impl{PDMDEVHLPR0,pfnCritSectRwIsInitialized} */
1023static DECLCALLBACK(bool) pdmR0DevHlp_CritSectRwIsInitialized(PPDMDEVINS pDevIns, PPDMCRITSECTRW pCritSect)
1024{
1025 PDMDEV_ASSERT_DEVINS(pDevIns);
1026 RT_NOREF(pDevIns);
1027 AssertFailed();
1028 return false; //PDMCritSectRwIsInitialized(pCritSect);
1029}
1030
1031
1032/** @interface_method_impl{PDMDEVHLPR0,pfnDBGFTraceBuf} */
1033static DECLCALLBACK(RTTRACEBUF) pdmR0DevHlp_DBGFTraceBuf(PPDMDEVINS pDevIns)
1034{
1035 PDMDEV_ASSERT_DEVINS(pDevIns);
1036 AssertFailed();
1037 RTTRACEBUF hTraceBuf = NULL; //pDevIns->Internal.s.pGVM->hTraceBufR0;
1038 LogFlow(("pdmR0DevHlp_DBGFTraceBuf: caller='%p'/%d: returns %p\n", pDevIns, pDevIns->iInstance, hTraceBuf));
1039 return hTraceBuf;
1040}
1041
1042
1043/** @interface_method_impl{PDMDEVHLPR0,pfnPCIBusSetUpContext} */
1044static DECLCALLBACK(int) pdmR0DevHlp_PCIBusSetUpContext(PPDMDEVINS pDevIns, PPDMPCIBUSREGR0 pPciBusReg, PCPDMPCIHLPR0 *ppPciHlp)
1045{
1046 PDMDEV_ASSERT_DEVINS(pDevIns);
1047 LogFlow(("pdmR0DevHlp_PCIBusSetUpContext: caller='%p'/%d: pPciBusReg=%p{.u32Version=%#x, .iBus=%#u, .pfnSetIrq=%p, u32EnvVersion=%#x} ppPciHlp=%p\n",
1048 pDevIns, pDevIns->iInstance, pPciBusReg, pPciBusReg->u32Version, pPciBusReg->iBus, pPciBusReg->pfnSetIrq,
1049 pPciBusReg->u32EndVersion, ppPciHlp));
1050#if 0
1051 PGVM pGVM = pDevIns->Internal.s.pGVM;
1052
1053 /*
1054 * Validate input.
1055 */
1056 AssertPtrReturn(pPciBusReg, VERR_INVALID_POINTER);
1057 AssertLogRelMsgReturn(pPciBusReg->u32Version == PDM_PCIBUSREGCC_VERSION,
1058 ("%#x vs %#x\n", pPciBusReg->u32Version, PDM_PCIBUSREGCC_VERSION), VERR_VERSION_MISMATCH);
1059 AssertPtrReturn(pPciBusReg->pfnSetIrq, VERR_INVALID_POINTER);
1060 AssertLogRelMsgReturn(pPciBusReg->u32EndVersion == PDM_PCIBUSREGCC_VERSION,
1061 ("%#x vs %#x\n", pPciBusReg->u32EndVersion, PDM_PCIBUSREGCC_VERSION), VERR_VERSION_MISMATCH);
1062
1063 AssertPtrReturn(ppPciHlp, VERR_INVALID_POINTER);
1064
1065 VM_ASSERT_STATE_RETURN(pGVM, VMSTATE_CREATING, VERR_WRONG_ORDER);
1066 VM_ASSERT_EMT0_RETURN(pGVM, VERR_VM_THREAD_NOT_EMT);
1067
1068 /* Check the shared bus data (registered earlier from ring-3): */
1069 uint32_t iBus = pPciBusReg->iBus;
1070 ASMCompilerBarrier();
1071 AssertLogRelMsgReturn(iBus < RT_ELEMENTS(pGVM->pdm.s.aPciBuses), ("iBus=%#x\n", iBus), VERR_OUT_OF_RANGE);
1072 PPDMPCIBUS pPciBusShared = &pGVM->pdm.s.aPciBuses[iBus];
1073 AssertLogRelMsgReturn(pPciBusShared->iBus == iBus, ("%u vs %u\n", pPciBusShared->iBus, iBus), VERR_INVALID_PARAMETER);
1074 AssertLogRelMsgReturn(pPciBusShared->pDevInsR3 == pDevIns->pDevInsForR3,
1075 ("%p vs %p (iBus=%u)\n", pPciBusShared->pDevInsR3, pDevIns->pDevInsForR3, iBus), VERR_NOT_OWNER);
1076
1077 /* Check that the bus isn't already registered in ring-0: */
1078 AssertCompile(RT_ELEMENTS(pGVM->pdm.s.aPciBuses) == RT_ELEMENTS(pGVM->pdmr0.s.aPciBuses));
1079 PPDMPCIBUSR0 pPciBusR0 = &pGVM->pdmr0.s.aPciBuses[iBus];
1080 AssertLogRelMsgReturn(pPciBusR0->pDevInsR0 == NULL,
1081 ("%p (caller pDevIns=%p, iBus=%u)\n", pPciBusR0->pDevInsR0, pDevIns, iBus),
1082 VERR_ALREADY_EXISTS);
1083
1084 /*
1085 * Do the registering.
1086 */
1087 pPciBusR0->iBus = iBus;
1088 pPciBusR0->uPadding0 = 0xbeefbeef;
1089 pPciBusR0->pfnSetIrqR0 = pPciBusReg->pfnSetIrq;
1090 pPciBusR0->pDevInsR0 = pDevIns;
1091#endif
1092
1093 AssertFailed();
1094 *ppPciHlp = NULL; //&g_pdmR0PciHlp;
1095
1096 LogFlow(("pdmR0DevHlp_PCIBusSetUpContext: caller='%p'/%d: returns VINF_SUCCESS\n", pDevIns, pDevIns->iInstance));
1097 return VINF_SUCCESS;
1098}
1099
1100
1101/** @interface_method_impl{PDMDEVHLPR0,pfnIommuSetUpContext} */
1102static DECLCALLBACK(int) pdmR0DevHlp_IommuSetUpContext(PPDMDEVINS pDevIns, PPDMIOMMUREGR0 pIommuReg, PCPDMIOMMUHLPR0 *ppIommuHlp)
1103{
1104 PDMDEV_ASSERT_DEVINS(pDevIns);
1105 LogFlow(("pdmR0DevHlp_IommuSetUpContext: caller='%p'/%d: pIommuReg=%p{.u32Version=%#x, u32TheEnd=%#x} ppIommuHlp=%p\n",
1106 pDevIns, pDevIns->iInstance, pIommuReg, pIommuReg->u32Version, pIommuReg->u32TheEnd, ppIommuHlp));
1107#if 0
1108 PGVM pGVM = pDevIns->Internal.s.pGVM;
1109
1110 /*
1111 * Validate input.
1112 */
1113 AssertPtrReturn(pIommuReg, VERR_INVALID_POINTER);
1114 AssertLogRelMsgReturn(pIommuReg->u32Version == PDM_IOMMUREGCC_VERSION,
1115 ("%#x vs %#x\n", pIommuReg->u32Version, PDM_IOMMUREGCC_VERSION), VERR_VERSION_MISMATCH);
1116 AssertPtrReturn(pIommuReg->pfnMemAccess, VERR_INVALID_POINTER);
1117 AssertPtrReturn(pIommuReg->pfnMemBulkAccess, VERR_INVALID_POINTER);
1118 AssertPtrReturn(pIommuReg->pfnMsiRemap, VERR_INVALID_POINTER);
1119 AssertLogRelMsgReturn(pIommuReg->u32TheEnd == PDM_IOMMUREGCC_VERSION,
1120 ("%#x vs %#x\n", pIommuReg->u32TheEnd, PDM_IOMMUREGCC_VERSION), VERR_VERSION_MISMATCH);
1121
1122 AssertPtrReturn(ppIommuHlp, VERR_INVALID_POINTER);
1123
1124 VM_ASSERT_STATE_RETURN(pGVM, VMSTATE_CREATING, VERR_WRONG_ORDER);
1125 VM_ASSERT_EMT0_RETURN(pGVM, VERR_VM_THREAD_NOT_EMT);
1126
1127 /* Check the IOMMU shared data (registered earlier from ring-3). */
1128 uint32_t const idxIommu = pIommuReg->idxIommu;
1129 ASMCompilerBarrier();
1130 AssertLogRelMsgReturn(idxIommu < RT_ELEMENTS(pGVM->pdm.s.aIommus), ("idxIommu=%#x\n", idxIommu), VERR_OUT_OF_RANGE);
1131 PPDMIOMMUR3 pIommuShared = &pGVM->pdm.s.aIommus[idxIommu];
1132 AssertLogRelMsgReturn(pIommuShared->idxIommu == idxIommu, ("%u vs %u\n", pIommuShared->idxIommu, idxIommu), VERR_INVALID_PARAMETER);
1133 AssertLogRelMsgReturn(pIommuShared->pDevInsR3 == pDevIns->pDevInsForR3,
1134 ("%p vs %p (idxIommu=%u)\n", pIommuShared->pDevInsR3, pDevIns->pDevInsForR3, idxIommu), VERR_NOT_OWNER);
1135
1136 /* Check that the IOMMU isn't already registered in ring-0. */
1137 AssertCompile(RT_ELEMENTS(pGVM->pdm.s.aIommus) == RT_ELEMENTS(pGVM->pdmr0.s.aIommus));
1138 PPDMIOMMUR0 pIommuR0 = &pGVM->pdmr0.s.aIommus[idxIommu];
1139 AssertLogRelMsgReturn(pIommuR0->pDevInsR0 == NULL,
1140 ("%p (caller pDevIns=%p, idxIommu=%u)\n", pIommuR0->pDevInsR0, pDevIns, idxIommu),
1141 VERR_ALREADY_EXISTS);
1142
1143 /*
1144 * Register.
1145 */
1146 pIommuR0->idxIommu = idxIommu;
1147 pIommuR0->uPadding0 = 0xdeaddead;
1148 pIommuR0->pDevInsR0 = pDevIns;
1149 pIommuR0->pfnMemAccess = pIommuReg->pfnMemAccess;
1150 pIommuR0->pfnMemBulkAccess = pIommuReg->pfnMemBulkAccess;
1151 pIommuR0->pfnMsiRemap = pIommuReg->pfnMsiRemap;
1152#endif
1153
1154 AssertFailed();
1155 *ppIommuHlp = NULL; //&g_pdmR0IommuHlp;
1156
1157 LogFlow(("pdmR0DevHlp_IommuSetUpContext: caller='%p'/%d: returns VINF_SUCCESS\n", pDevIns, pDevIns->iInstance));
1158 return VINF_SUCCESS;
1159}
1160
1161
1162/** @interface_method_impl{PDMDEVHLPR0,pfnPICSetUpContext} */
1163static DECLCALLBACK(int) pdmR0DevHlp_PICSetUpContext(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLP *ppPicHlp)
1164{
1165 PDMDEV_ASSERT_DEVINS(pDevIns);
1166 LogFlow(("pdmR0DevHlp_PICSetUpContext: caller='%s'/%d: pPicReg=%p:{.u32Version=%#x, .pfnSetIrq=%p, .pfnGetInterrupt=%p, .u32TheEnd=%#x } ppPicHlp=%p\n",
1167 pDevIns->pReg->szName, pDevIns->iInstance, pPicReg, pPicReg->u32Version, pPicReg->pfnSetIrq, pPicReg->pfnGetInterrupt, pPicReg->u32TheEnd, ppPicHlp));
1168#if 0
1169 PGVM pGVM = pDevIns->Internal.s.pGVM;
1170
1171 /*
1172 * Validate input.
1173 */
1174 AssertMsgReturn(pPicReg->u32Version == PDM_PICREG_VERSION,
1175 ("%s/%d: u32Version=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pPicReg->u32Version, PDM_PICREG_VERSION),
1176 VERR_VERSION_MISMATCH);
1177 AssertPtrReturn(pPicReg->pfnSetIrq, VERR_INVALID_POINTER);
1178 AssertPtrReturn(pPicReg->pfnGetInterrupt, VERR_INVALID_POINTER);
1179 AssertMsgReturn(pPicReg->u32TheEnd == PDM_PICREG_VERSION,
1180 ("%s/%d: u32TheEnd=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pPicReg->u32TheEnd, PDM_PICREG_VERSION),
1181 VERR_VERSION_MISMATCH);
1182 AssertPtrReturn(ppPicHlp, VERR_INVALID_POINTER);
1183
1184 VM_ASSERT_STATE_RETURN(pGVM, VMSTATE_CREATING, VERR_WRONG_ORDER);
1185 VM_ASSERT_EMT0_RETURN(pGVM, VERR_VM_THREAD_NOT_EMT);
1186
1187 /* Check that it's the same device as made the ring-3 registrations: */
1188 AssertLogRelMsgReturn(pGVM->pdm.s.Pic.pDevInsR3 == pDevIns->pDevInsForR3,
1189 ("%p vs %p\n", pGVM->pdm.s.Pic.pDevInsR3, pDevIns->pDevInsForR3), VERR_NOT_OWNER);
1190
1191 /* Check that it isn't already registered in ring-0: */
1192 AssertLogRelMsgReturn(pGVM->pdm.s.Pic.pDevInsR0 == NULL, ("%p (caller pDevIns=%p)\n", pGVM->pdm.s.Pic.pDevInsR0, pDevIns),
1193 VERR_ALREADY_EXISTS);
1194
1195 /*
1196 * Take down the callbacks and instance.
1197 */
1198 pGVM->pdm.s.Pic.pDevInsR0 = pDevIns;
1199 pGVM->pdm.s.Pic.pfnSetIrqR0 = pPicReg->pfnSetIrq;
1200 pGVM->pdm.s.Pic.pfnGetInterruptR0 = pPicReg->pfnGetInterrupt;
1201#endif
1202 Log(("PDM: Registered PIC device '%s'/%d pDevIns=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns));
1203
1204 /* set the helper pointer and return. */
1205 AssertFailed();
1206 *ppPicHlp = NULL; //&g_pdmR0PicHlp;
1207 LogFlow(("pdmR0DevHlp_PICSetUpContext: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
1208 return VINF_SUCCESS;
1209}
1210
1211
1212/** @interface_method_impl{PDMDEVHLPR0,pfnApicSetUpContext} */
1213static DECLCALLBACK(int) pdmR0DevHlp_ApicSetUpContext(PPDMDEVINS pDevIns)
1214{
1215 PDMDEV_ASSERT_DEVINS(pDevIns);
1216 LogFlow(("pdmR0DevHlp_ApicSetUpContext: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
1217#if 0
1218 PGVM pGVM = pDevIns->Internal.s.pGVM;
1219
1220 /*
1221 * Validate input.
1222 */
1223 VM_ASSERT_STATE_RETURN(pGVM, VMSTATE_CREATING, VERR_WRONG_ORDER);
1224 VM_ASSERT_EMT0_RETURN(pGVM, VERR_VM_THREAD_NOT_EMT);
1225
1226 /* Check that it's the same device as made the ring-3 registrations: */
1227 AssertLogRelMsgReturn(pGVM->pdm.s.Apic.pDevInsR3 == pDevIns->pDevInsForR3,
1228 ("%p vs %p\n", pGVM->pdm.s.Apic.pDevInsR3, pDevIns->pDevInsForR3), VERR_NOT_OWNER);
1229
1230 /* Check that it isn't already registered in ring-0: */
1231 AssertLogRelMsgReturn(pGVM->pdm.s.Apic.pDevInsR0 == NULL, ("%p (caller pDevIns=%p)\n", pGVM->pdm.s.Apic.pDevInsR0, pDevIns),
1232 VERR_ALREADY_EXISTS);
1233
1234 /*
1235 * Take down the instance.
1236 */
1237 pGVM->pdm.s.Apic.pDevInsR0 = pDevIns;
1238#endif
1239 Log(("PDM: Registered APIC device '%s'/%d pDevIns=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns));
1240
1241 /* set the helper pointer and return. */
1242 LogFlow(("pdmR0DevHlp_ApicSetUpContext: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
1243 return VINF_SUCCESS;
1244}
1245
1246
1247/** @interface_method_impl{PDMDEVHLPR0,pfnIoApicSetUpContext} */
1248static DECLCALLBACK(int) pdmR0DevHlp_IoApicSetUpContext(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLP *ppIoApicHlp)
1249{
1250 PDMDEV_ASSERT_DEVINS(pDevIns);
1251 LogFlow(("pdmR0DevHlp_IoApicSetUpContext: caller='%s'/%d: pIoApicReg=%p:{.u32Version=%#x, .pfnSetIrq=%p, .pfnSendMsi=%p, .pfnSetEoi=%p, .u32TheEnd=%#x } ppIoApicHlp=%p\n",
1252 pDevIns->pReg->szName, pDevIns->iInstance, pIoApicReg, pIoApicReg->u32Version, pIoApicReg->pfnSetIrq, pIoApicReg->pfnSendMsi, pIoApicReg->pfnSetEoi, pIoApicReg->u32TheEnd, ppIoApicHlp));
1253#if 0
1254 PGVM pGVM = pDevIns->Internal.s.pGVM;
1255
1256 /*
1257 * Validate input.
1258 */
1259 AssertMsgReturn(pIoApicReg->u32Version == PDM_IOAPICREG_VERSION,
1260 ("%s/%d: u32Version=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pIoApicReg->u32Version, PDM_IOAPICREG_VERSION),
1261 VERR_VERSION_MISMATCH);
1262 AssertPtrReturn(pIoApicReg->pfnSetIrq, VERR_INVALID_POINTER);
1263 AssertPtrReturn(pIoApicReg->pfnSendMsi, VERR_INVALID_POINTER);
1264 AssertPtrReturn(pIoApicReg->pfnSetEoi, VERR_INVALID_POINTER);
1265 AssertMsgReturn(pIoApicReg->u32TheEnd == PDM_IOAPICREG_VERSION,
1266 ("%s/%d: u32TheEnd=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pIoApicReg->u32TheEnd, PDM_IOAPICREG_VERSION),
1267 VERR_VERSION_MISMATCH);
1268 AssertPtrReturn(ppIoApicHlp, VERR_INVALID_POINTER);
1269
1270 VM_ASSERT_STATE_RETURN(pGVM, VMSTATE_CREATING, VERR_WRONG_ORDER);
1271 VM_ASSERT_EMT0_RETURN(pGVM, VERR_VM_THREAD_NOT_EMT);
1272
1273 /* Check that it's the same device as made the ring-3 registrations: */
1274 AssertLogRelMsgReturn(pGVM->pdm.s.IoApic.pDevInsR3 == pDevIns->pDevInsForR3,
1275 ("%p vs %p\n", pGVM->pdm.s.IoApic.pDevInsR3, pDevIns->pDevInsForR3), VERR_NOT_OWNER);
1276
1277 /* Check that it isn't already registered in ring-0: */
1278 AssertLogRelMsgReturn(pGVM->pdm.s.IoApic.pDevInsR0 == NULL, ("%p (caller pDevIns=%p)\n", pGVM->pdm.s.IoApic.pDevInsR0, pDevIns),
1279 VERR_ALREADY_EXISTS);
1280
1281 /*
1282 * Take down the callbacks and instance.
1283 */
1284 pGVM->pdm.s.IoApic.pDevInsR0 = pDevIns;
1285 pGVM->pdm.s.IoApic.pfnSetIrqR0 = pIoApicReg->pfnSetIrq;
1286 pGVM->pdm.s.IoApic.pfnSendMsiR0 = pIoApicReg->pfnSendMsi;
1287 pGVM->pdm.s.IoApic.pfnSetEoiR0 = pIoApicReg->pfnSetEoi;
1288#endif
1289 Log(("PDM: Registered IOAPIC device '%s'/%d pDevIns=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns));
1290
1291 /* set the helper pointer and return. */
1292 AssertFailed();
1293 *ppIoApicHlp = NULL; //&g_pdmR0IoApicHlp;
1294 LogFlow(("pdmR0DevHlp_IoApicSetUpContext: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
1295 return VINF_SUCCESS;
1296}
1297
1298
1299/** @interface_method_impl{PDMDEVHLPR0,pfnHpetSetUpContext} */
1300static DECLCALLBACK(int) pdmR0DevHlp_HpetSetUpContext(PPDMDEVINS pDevIns, PPDMHPETREG pHpetReg, PCPDMHPETHLPR0 *ppHpetHlp)
1301{
1302 PDMDEV_ASSERT_DEVINS(pDevIns);
1303 LogFlow(("pdmR0DevHlp_HpetSetUpContext: caller='%s'/%d: pHpetReg=%p:{.u32Version=%#x, } ppHpetHlp=%p\n",
1304 pDevIns->pReg->szName, pDevIns->iInstance, pHpetReg, pHpetReg->u32Version, ppHpetHlp));
1305#if 0
1306 PGVM pGVM = pDevIns->Internal.s.pGVM;
1307
1308 /*
1309 * Validate input.
1310 */
1311 AssertMsgReturn(pHpetReg->u32Version == PDM_HPETREG_VERSION,
1312 ("%s/%d: u32Version=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pHpetReg->u32Version, PDM_HPETREG_VERSION),
1313 VERR_VERSION_MISMATCH);
1314 AssertPtrReturn(ppHpetHlp, VERR_INVALID_POINTER);
1315
1316 VM_ASSERT_STATE_RETURN(pGVM, VMSTATE_CREATING, VERR_WRONG_ORDER);
1317 VM_ASSERT_EMT0_RETURN(pGVM, VERR_VM_THREAD_NOT_EMT);
1318
1319 /* Check that it's the same device as made the ring-3 registrations: */
1320 AssertLogRelMsgReturn(pGVM->pdm.s.pHpet == pDevIns->pDevInsForR3, ("%p vs %p\n", pGVM->pdm.s.pHpet, pDevIns->pDevInsForR3),
1321 VERR_NOT_OWNER);
1322
1323 ///* Check that it isn't already registered in ring-0: */
1324 //AssertLogRelMsgReturn(pGVM->pdm.s.Hpet.pDevInsR0 == NULL, ("%p (caller pDevIns=%p)\n", pGVM->pdm.s.Hpet.pDevInsR0, pDevIns),
1325 // VERR_ALREADY_EXISTS);
1326#endif
1327 /*
1328 * Nothing to take down here at present.
1329 */
1330 Log(("PDM: Registered HPET device '%s'/%d pDevIns=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns));
1331
1332 /* set the helper pointer and return. */
1333 AssertFailed();
1334 *ppHpetHlp = NULL; //&g_pdmR0HpetHlp;
1335 LogFlow(("pdmR0DevHlp_HpetSetUpContext: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
1336 return VINF_SUCCESS;
1337}
1338
1339
1340/** @interface_method_impl{PDMDEVHLPR0,pfnPGMHandlerPhysicalPageTempOff} */
1341static DECLCALLBACK(int) pdmR0DevHlp_PGMHandlerPhysicalPageTempOff(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage)
1342{
1343 PDMDEV_ASSERT_DEVINS(pDevIns);
1344 LogFlow(("pdmR0DevHlp_PGMHandlerPhysicalPageTempOff: caller='%s'/%d: GCPhys=%RGp\n", pDevIns->pReg->szName, pDevIns->iInstance, GCPhys));
1345
1346 AssertFailed();
1347 int rc = VERR_NOT_IMPLEMENTED; //PGMHandlerPhysicalPageTempOff(pDevIns->Internal.s.pGVM, GCPhys, GCPhysPage);
1348
1349 Log(("pdmR0DevHlp_PGMHandlerPhysicalPageTempOff: caller='%s'/%d: returns %Rrc\n",
1350 pDevIns->pReg->szName, pDevIns->iInstance, rc));
1351 return rc;
1352}
1353
1354
1355/** @interface_method_impl{PDMDEVHLPR0,pfnMmioMapMmio2Page} */
1356static DECLCALLBACK(int) pdmR0DevHlp_MmioMapMmio2Page(PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion, RTGCPHYS offRegion,
1357 uint64_t hMmio2, RTGCPHYS offMmio2, uint64_t fPageFlags)
1358{
1359 PDMDEV_ASSERT_DEVINS(pDevIns);
1360 LogFlow(("pdmR0DevHlp_MmioMapMmio2Page: caller='%s'/%d: hRegion=%RX64 offRegion=%RGp hMmio2=%RX64 offMmio2=%RGp fPageFlags=%RX64\n",
1361 pDevIns->pReg->szName, pDevIns->iInstance, hRegion, offRegion, hMmio2, offMmio2, fPageFlags));
1362
1363 AssertFailed();
1364 int rc = VERR_NOT_IMPLEMENTED; //IOMMmioMapMmio2Page(pDevIns->Internal.s.pGVM, pDevIns, hRegion, offRegion, hMmio2, offMmio2, fPageFlags);
1365
1366 Log(("pdmR0DevHlp_MmioMapMmio2Page: caller='%s'/%d: returns %Rrc\n",
1367 pDevIns->pReg->szName, pDevIns->iInstance, rc));
1368 return rc;
1369}
1370
1371
1372/** @interface_method_impl{PDMDEVHLPR0,pfnMmioResetRegion} */
1373static DECLCALLBACK(int) pdmR0DevHlp_MmioResetRegion(PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion)
1374{
1375 PDMDEV_ASSERT_DEVINS(pDevIns);
1376 LogFlow(("pdmR0DevHlp_MmioResetRegion: caller='%s'/%d: hRegion=%RX64\n",
1377 pDevIns->pReg->szName, pDevIns->iInstance, hRegion));
1378
1379 AssertFailed();
1380 int rc = VERR_NOT_IMPLEMENTED; //IOMMmioResetRegion(pDevIns->Internal.s.pGVM, pDevIns, hRegion);
1381
1382 Log(("pdmR0DevHlp_MmioResetRegion: caller='%s'/%d: returns %Rrc\n",
1383 pDevIns->pReg->szName, pDevIns->iInstance, rc));
1384 return rc;
1385}
1386
1387
1388/** @interface_method_impl{PDMDEVHLPR0,pfnGIMGetMmio2Regions} */
1389static DECLCALLBACK(PGIMMMIO2REGION) pdmR0DevHlp_GIMGetMmio2Regions(PPDMDEVINS pDevIns, uint32_t *pcRegions)
1390{
1391 PDMDEV_ASSERT_DEVINS(pDevIns);
1392
1393 LogFlow(("pdmR0DevHlp_GIMGetMmio2Regions: caller='%s'/%d: pcRegions=%p\n",
1394 pDevIns->pReg->szName, pDevIns->iInstance, pcRegions));
1395
1396 AssertFailed();
1397 PGIMMMIO2REGION pRegion = NULL; //GIMGetMmio2Regions(pDevIns->Internal.s.pGVM, pcRegions);
1398
1399 LogFlow(("pdmR0DevHlp_GIMGetMmio2Regions: caller='%s'/%d: returns %p\n", pDevIns->pReg->szName, pDevIns->iInstance, pRegion));
1400 return pRegion;
1401}
1402
1403
1404/**
1405 * The Ring-0 Device Helper Callbacks.
1406 */
1407const PDMDEVHLPR0 g_tstDevPdmDevHlpR0 =
1408{
1409 PDM_DEVHLPR0_VERSION,
1410 pdmR0DevHlp_IoPortSetUpContextEx,
1411 pdmR0DevHlp_MmioSetUpContextEx,
1412 pdmR0DevHlp_Mmio2SetUpContext,
1413 pdmR0DevHlp_PCIPhysRead,
1414 pdmR0DevHlp_PCIPhysWrite,
1415 pdmR0DevHlp_PCISetIrq,
1416 pdmR0DevHlp_ISASetIrq,
1417 pdmR0DevHlp_PhysRead,
1418 pdmR0DevHlp_PhysWrite,
1419 pdmR0DevHlp_A20IsEnabled,
1420 pdmR0DevHlp_VMState,
1421 pdmR0DevHlp_GetVM,
1422 pdmR0DevHlp_GetVMCPU,
1423 pdmR0DevHlp_GetCurrentCpuId,
1424 pdmR0DevHlp_GetMainExecutionEngine,
1425 pdmR0DevHlp_TimerFromMicro,
1426 pdmR0DevHlp_TimerFromMilli,
1427 pdmR0DevHlp_TimerFromNano,
1428 pdmR0DevHlp_TimerGet,
1429 pdmR0DevHlp_TimerGetFreq,
1430 pdmR0DevHlp_TimerGetNano,
1431 pdmR0DevHlp_TimerIsActive,
1432 pdmR0DevHlp_TimerIsLockOwner,
1433 pdmR0DevHlp_TimerLockClock,
1434 pdmR0DevHlp_TimerLockClock2,
1435 pdmR0DevHlp_TimerSet,
1436 pdmR0DevHlp_TimerSetFrequencyHint,
1437 pdmR0DevHlp_TimerSetMicro,
1438 pdmR0DevHlp_TimerSetMillies,
1439 pdmR0DevHlp_TimerSetNano,
1440 pdmR0DevHlp_TimerSetRelative,
1441 pdmR0DevHlp_TimerStop,
1442 pdmR0DevHlp_TimerUnlockClock,
1443 pdmR0DevHlp_TimerUnlockClock2,
1444 pdmR0DevHlp_TMTimeVirtGet,
1445 pdmR0DevHlp_TMTimeVirtGetFreq,
1446 pdmR0DevHlp_TMTimeVirtGetNano,
1447 pdmR0DevHlp_QueueAlloc,
1448 pdmR0DevHlp_QueueInsert,
1449 pdmR0DevHlp_QueueFlushIfNecessary,
1450 pdmR0DevHlp_TaskTrigger,
1451 pdmR0DevHlp_SUPSemEventSignal,
1452 pdmR0DevHlp_SUPSemEventWaitNoResume,
1453 pdmR0DevHlp_SUPSemEventWaitNsAbsIntr,
1454 pdmR0DevHlp_SUPSemEventWaitNsRelIntr,
1455 pdmR0DevHlp_SUPSemEventGetResolution,
1456 pdmR0DevHlp_SUPSemEventMultiSignal,
1457 pdmR0DevHlp_SUPSemEventMultiReset,
1458 pdmR0DevHlp_SUPSemEventMultiWaitNoResume,
1459 pdmR0DevHlp_SUPSemEventMultiWaitNsAbsIntr,
1460 pdmR0DevHlp_SUPSemEventMultiWaitNsRelIntr,
1461 pdmR0DevHlp_SUPSemEventMultiGetResolution,
1462 pdmR0DevHlp_CritSectGetNop,
1463 pdmR0DevHlp_SetDeviceCritSect,
1464 pdmR0DevHlp_CritSectEnter,
1465 pdmR0DevHlp_CritSectEnterDebug,
1466 pdmR0DevHlp_CritSectTryEnter,
1467 pdmR0DevHlp_CritSectTryEnterDebug,
1468 pdmR0DevHlp_CritSectLeave,
1469 pdmR0DevHlp_CritSectIsOwner,
1470 pdmR0DevHlp_CritSectIsInitialized,
1471 pdmR0DevHlp_CritSectHasWaiters,
1472 pdmR0DevHlp_CritSectGetRecursion,
1473 pdmR0DevHlp_CritSectScheduleExitEvent,
1474 pdmR0DevHlp_CritSectRwEnterShared,
1475 pdmR0DevHlp_CritSectRwEnterSharedDebug,
1476 pdmR0DevHlp_CritSectRwTryEnterShared,
1477 pdmR0DevHlp_CritSectRwTryEnterSharedDebug,
1478 pdmR0DevHlp_CritSectRwLeaveShared,
1479 pdmR0DevHlp_CritSectRwEnterExcl,
1480 pdmR0DevHlp_CritSectRwEnterExclDebug,
1481 pdmR0DevHlp_CritSectRwTryEnterExcl,
1482 pdmR0DevHlp_CritSectRwTryEnterExclDebug,
1483 pdmR0DevHlp_CritSectRwLeaveExcl,
1484 pdmR0DevHlp_CritSectRwIsWriteOwner,
1485 pdmR0DevHlp_CritSectRwIsReadOwner,
1486 pdmR0DevHlp_CritSectRwGetWriteRecursion,
1487 pdmR0DevHlp_CritSectRwGetWriterReadRecursion,
1488 pdmR0DevHlp_CritSectRwGetReadCount,
1489 pdmR0DevHlp_CritSectRwIsInitialized,
1490 pdmR0DevHlp_DBGFTraceBuf,
1491 pdmR0DevHlp_PCIBusSetUpContext,
1492 pdmR0DevHlp_IommuSetUpContext,
1493 pdmR0DevHlp_PICSetUpContext,
1494 pdmR0DevHlp_ApicSetUpContext,
1495 pdmR0DevHlp_IoApicSetUpContext,
1496 pdmR0DevHlp_HpetSetUpContext,
1497 pdmR0DevHlp_PGMHandlerPhysicalPageTempOff,
1498 pdmR0DevHlp_MmioMapMmio2Page,
1499 pdmR0DevHlp_MmioResetRegion,
1500 pdmR0DevHlp_GIMGetMmio2Regions,
1501 NULL /*pfnReserved1*/,
1502 NULL /*pfnReserved2*/,
1503 NULL /*pfnReserved3*/,
1504 NULL /*pfnReserved4*/,
1505 NULL /*pfnReserved5*/,
1506 NULL /*pfnReserved6*/,
1507 NULL /*pfnReserved7*/,
1508 NULL /*pfnReserved8*/,
1509 NULL /*pfnReserved9*/,
1510 NULL /*pfnReserved10*/,
1511 PDM_DEVHLPR0_VERSION
1512};
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