VirtualBox

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

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

Devices/testcase/tstDevice: Started working on supporting R0 device instances, bugref:9006

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