VirtualBox

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

Last change on this file since 97698 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

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