VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMR3/PDMDevMiscHlp.cpp@ 80191

Last change on this file since 80191 was 80191, checked in by vboxsync, 5 years ago

VMM/r3: Refactored VMCPU enumeration in preparation that aCpus will be replaced with a pointer array. Removed two raw-mode offset members from the CPUM and CPUMCPU sub-structures. bugref:9217 bugref:9517

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 17.3 KB
Line 
1/* $Id: PDMDevMiscHlp.cpp 80191 2019-08-08 00:36:57Z vboxsync $ */
2/** @file
3 * PDM - Pluggable Device and Driver Manager, Misc. Device Helpers.
4 */
5
6/*
7 * Copyright (C) 2006-2019 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 VBOX_BUGREF_9217_PART_I
23#define LOG_GROUP LOG_GROUP_PDM_DEVICE
24#include "PDMInternal.h"
25#include <VBox/vmm/pdm.h>
26#include <VBox/vmm/pgm.h>
27#include <VBox/vmm/hm.h>
28#include <VBox/vmm/apic.h>
29#ifdef VBOX_WITH_REM
30# include <VBox/vmm/rem.h>
31#endif
32#include <VBox/vmm/vm.h>
33#include <VBox/vmm/vmm.h>
34
35#include <VBox/log.h>
36#include <VBox/err.h>
37#include <iprt/asm.h>
38#include <iprt/assert.h>
39#include <iprt/thread.h>
40
41
42#include "PDMInline.h"
43#include "dtrace/VBoxVMM.h"
44
45
46
47/** @name Ring-3 PIC Helpers
48 * @{
49 */
50
51/** @interface_method_impl{PDMPICHLPR3,pfnSetInterruptFF} */
52static DECLCALLBACK(void) pdmR3PicHlp_SetInterruptFF(PPDMDEVINS pDevIns)
53{
54 PDMDEV_ASSERT_DEVINS(pDevIns);
55 PVM pVM = pDevIns->Internal.s.pVMR3;
56 PVMCPU pVCpu = pVM->apCpusR3[0]; /* for PIC we always deliver to CPU 0, MP use APIC */
57
58 /* IRQ state should be loaded as-is by "LoadExec". Changes can be made from LoadDone. */
59 Assert(pVM->enmVMState != VMSTATE_LOADING || pVM->pdm.s.fStateLoaded);
60
61 APICLocalInterrupt(pVCpu, 0 /* u8Pin */, 1 /* u8Level */, VINF_SUCCESS /* rcRZ */);
62}
63
64
65/** @interface_method_impl{PDMPICHLPR3,pfnClearInterruptFF} */
66static DECLCALLBACK(void) pdmR3PicHlp_ClearInterruptFF(PPDMDEVINS pDevIns)
67{
68 PDMDEV_ASSERT_DEVINS(pDevIns);
69 PVM pVM = pDevIns->Internal.s.pVMR3;
70 PVMCPU pVCpu = pVM->apCpusR3[0]; /* for PIC we always deliver to CPU 0, MP use APIC */
71
72 /* IRQ state should be loaded as-is by "LoadExec". Changes can be made from LoadDone. */
73 Assert(pVM->enmVMState != VMSTATE_LOADING || pVM->pdm.s.fStateLoaded);
74
75 APICLocalInterrupt(pVCpu, 0 /* u8Pin */, 0 /* u8Level */, VINF_SUCCESS /* rcRZ */);
76}
77
78
79/** @interface_method_impl{PDMPICHLPR3,pfnLock} */
80static DECLCALLBACK(int) pdmR3PicHlp_Lock(PPDMDEVINS pDevIns, int rc)
81{
82 PDMDEV_ASSERT_DEVINS(pDevIns);
83 return pdmLockEx(pDevIns->Internal.s.pVMR3, rc);
84}
85
86
87/** @interface_method_impl{PDMPICHLPR3,pfnUnlock} */
88static DECLCALLBACK(void) pdmR3PicHlp_Unlock(PPDMDEVINS pDevIns)
89{
90 PDMDEV_ASSERT_DEVINS(pDevIns);
91 pdmUnlock(pDevIns->Internal.s.pVMR3);
92}
93
94
95/** @interface_method_impl{PDMPICHLPR3,pfnGetRCHelpers} */
96static DECLCALLBACK(PCPDMPICHLPRC) pdmR3PicHlp_GetRCHelpers(PPDMDEVINS pDevIns)
97{
98 PDMDEV_ASSERT_DEVINS(pDevIns);
99 PVM pVM = pDevIns->Internal.s.pVMR3;
100 VM_ASSERT_EMT(pVM);
101
102 RTRCPTR pRCHelpers = NIL_RTRCPTR;
103 if (VM_IS_RAW_MODE_ENABLED(pVM))
104 {
105 int rc = PDMR3LdrGetSymbolRC(pVM, NULL, "g_pdmRCPicHlp", &pRCHelpers);
106 AssertReleaseRC(rc);
107 AssertRelease(pRCHelpers);
108 }
109
110 LogFlow(("pdmR3PicHlp_GetRCHelpers: caller='%s'/%d: returns %RRv\n",
111 pDevIns->pReg->szName, pDevIns->iInstance, pRCHelpers));
112 return pRCHelpers;
113}
114
115
116/** @interface_method_impl{PDMPICHLPR3,pfnGetR0Helpers} */
117static DECLCALLBACK(PCPDMPICHLPR0) pdmR3PicHlp_GetR0Helpers(PPDMDEVINS pDevIns)
118{
119 PDMDEV_ASSERT_DEVINS(pDevIns);
120 PVM pVM = pDevIns->Internal.s.pVMR3;
121 VM_ASSERT_EMT(pVM);
122 PCPDMPICHLPR0 pR0Helpers = 0;
123 int rc = PDMR3LdrGetSymbolR0(pVM, NULL, "g_pdmR0PicHlp", &pR0Helpers);
124 AssertReleaseRC(rc);
125 AssertRelease(pR0Helpers);
126 LogFlow(("pdmR3PicHlp_GetR0Helpers: caller='%s'/%d: returns %RHv\n",
127 pDevIns->pReg->szName, pDevIns->iInstance, pR0Helpers));
128 return pR0Helpers;
129}
130
131
132/**
133 * PIC Device Helpers.
134 */
135const PDMPICHLPR3 g_pdmR3DevPicHlp =
136{
137 PDM_PICHLPR3_VERSION,
138 pdmR3PicHlp_SetInterruptFF,
139 pdmR3PicHlp_ClearInterruptFF,
140 pdmR3PicHlp_Lock,
141 pdmR3PicHlp_Unlock,
142 pdmR3PicHlp_GetRCHelpers,
143 pdmR3PicHlp_GetR0Helpers,
144 PDM_PICHLPR3_VERSION /* the end */
145};
146
147/** @} */
148
149
150/** @name Ring-3 I/O APIC Helpers
151 * @{
152 */
153
154/** @interface_method_impl{PDMIOAPICHLPR3,pfnApicBusDeliver} */
155static DECLCALLBACK(int) pdmR3IoApicHlp_ApicBusDeliver(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode,
156 uint8_t u8DeliveryMode, uint8_t uVector, uint8_t u8Polarity,
157 uint8_t u8TriggerMode, uint32_t uTagSrc)
158{
159 PDMDEV_ASSERT_DEVINS(pDevIns);
160 PVM pVM = pDevIns->Internal.s.pVMR3;
161 LogFlow(("pdmR3IoApicHlp_ApicBusDeliver: caller='%s'/%d: u8Dest=%RX8 u8DestMode=%RX8 u8DeliveryMode=%RX8 uVector=%RX8 u8Polarity=%RX8 u8TriggerMode=%RX8 uTagSrc=%#x\n",
162 pDevIns->pReg->szName, pDevIns->iInstance, u8Dest, u8DestMode, u8DeliveryMode, uVector, u8Polarity, u8TriggerMode, uTagSrc));
163 return APICBusDeliver(pVM, u8Dest, u8DestMode, u8DeliveryMode, uVector, u8Polarity, u8TriggerMode, uTagSrc);
164}
165
166
167/** @interface_method_impl{PDMIOAPICHLPR3,pfnLock} */
168static DECLCALLBACK(int) pdmR3IoApicHlp_Lock(PPDMDEVINS pDevIns, int rc)
169{
170 PDMDEV_ASSERT_DEVINS(pDevIns);
171 LogFlow(("pdmR3IoApicHlp_Lock: caller='%s'/%d: rc=%Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
172 return pdmLockEx(pDevIns->Internal.s.pVMR3, rc);
173}
174
175
176/** @interface_method_impl{PDMIOAPICHLPR3,pfnUnlock} */
177static DECLCALLBACK(void) pdmR3IoApicHlp_Unlock(PPDMDEVINS pDevIns)
178{
179 PDMDEV_ASSERT_DEVINS(pDevIns);
180 LogFlow(("pdmR3IoApicHlp_Unlock: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
181 pdmUnlock(pDevIns->Internal.s.pVMR3);
182}
183
184
185/** @interface_method_impl{PDMIOAPICHLPR3,pfnGetRCHelpers} */
186static DECLCALLBACK(PCPDMIOAPICHLPRC) pdmR3IoApicHlp_GetRCHelpers(PPDMDEVINS pDevIns)
187{
188 PDMDEV_ASSERT_DEVINS(pDevIns);
189 PVM pVM = pDevIns->Internal.s.pVMR3;
190 VM_ASSERT_EMT(pVM);
191
192 RTRCPTR pRCHelpers = NIL_RTRCPTR;
193 if (VM_IS_RAW_MODE_ENABLED(pVM))
194 {
195 int rc = PDMR3LdrGetSymbolRC(pVM, NULL, "g_pdmRCIoApicHlp", &pRCHelpers);
196 AssertReleaseRC(rc);
197 AssertRelease(pRCHelpers);
198 }
199
200 LogFlow(("pdmR3IoApicHlp_GetRCHelpers: caller='%s'/%d: returns %RRv\n",
201 pDevIns->pReg->szName, pDevIns->iInstance, pRCHelpers));
202 return pRCHelpers;
203}
204
205
206/** @interface_method_impl{PDMIOAPICHLPR3,pfnGetR0Helpers} */
207static DECLCALLBACK(PCPDMIOAPICHLPR0) pdmR3IoApicHlp_GetR0Helpers(PPDMDEVINS pDevIns)
208{
209 PDMDEV_ASSERT_DEVINS(pDevIns);
210 PVM pVM = pDevIns->Internal.s.pVMR3;
211 VM_ASSERT_EMT(pVM);
212 PCPDMIOAPICHLPR0 pR0Helpers = 0;
213 int rc = PDMR3LdrGetSymbolR0(pVM, NULL, "g_pdmR0IoApicHlp", &pR0Helpers);
214 AssertReleaseRC(rc);
215 AssertRelease(pR0Helpers);
216 LogFlow(("pdmR3IoApicHlp_GetR0Helpers: caller='%s'/%d: returns %RHv\n",
217 pDevIns->pReg->szName, pDevIns->iInstance, pR0Helpers));
218 return pR0Helpers;
219}
220
221
222/**
223 * I/O APIC Device Helpers.
224 */
225const PDMIOAPICHLPR3 g_pdmR3DevIoApicHlp =
226{
227 PDM_IOAPICHLPR3_VERSION,
228 pdmR3IoApicHlp_ApicBusDeliver,
229 pdmR3IoApicHlp_Lock,
230 pdmR3IoApicHlp_Unlock,
231 pdmR3IoApicHlp_GetRCHelpers,
232 pdmR3IoApicHlp_GetR0Helpers,
233 PDM_IOAPICHLPR3_VERSION /* the end */
234};
235
236/** @} */
237
238
239
240
241/** @name Ring-3 PCI Bus Helpers
242 * @{
243 */
244
245/** @interface_method_impl{PDMPCIHLPR3,pfnIsaSetIrq} */
246static DECLCALLBACK(void) pdmR3PciHlp_IsaSetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel, uint32_t uTagSrc)
247{
248 PDMDEV_ASSERT_DEVINS(pDevIns);
249 Log4(("pdmR3PciHlp_IsaSetIrq: iIrq=%d iLevel=%d uTagSrc=%#x\n", iIrq, iLevel, uTagSrc));
250 PDMIsaSetIrq(pDevIns->Internal.s.pVMR3, iIrq, iLevel, uTagSrc);
251}
252
253/** @interface_method_impl{PDMPCIHLPR3,pfnIoApicSetIrq} */
254static DECLCALLBACK(void) pdmR3PciHlp_IoApicSetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel, uint32_t uTagSrc)
255{
256 PDMDEV_ASSERT_DEVINS(pDevIns);
257 Log4(("pdmR3PciHlp_IoApicSetIrq: iIrq=%d iLevel=%d uTagSrc=%#x\n", iIrq, iLevel, uTagSrc));
258 PDMIoApicSetIrq(pDevIns->Internal.s.pVMR3, iIrq, iLevel, uTagSrc);
259}
260
261/** @interface_method_impl{PDMPCIHLPR3,pfnIoApicSendMsi} */
262static DECLCALLBACK(void) pdmR3PciHlp_IoApicSendMsi(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue, uint32_t uTagSrc)
263{
264 PDMDEV_ASSERT_DEVINS(pDevIns);
265 Log4(("pdmR3PciHlp_IoApicSendMsi: address=%p value=%x uTagSrc=%#x\n", GCPhys, uValue, uTagSrc));
266 PDMIoApicSendMsi(pDevIns->Internal.s.pVMR3, GCPhys, uValue, uTagSrc);
267}
268
269/** @interface_method_impl{PDMPCIHLPR3,pfnIsMMIOExBase} */
270static DECLCALLBACK(bool) pdmR3PciHlp_IsMMIO2Base(PPDMDEVINS pDevIns, PPDMDEVINS pOwner, RTGCPHYS GCPhys)
271{
272 PDMDEV_ASSERT_DEVINS(pDevIns);
273 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
274 bool fRc = PGMR3PhysMMIOExIsBase(pDevIns->Internal.s.pVMR3, pOwner, GCPhys);
275 Log4(("pdmR3PciHlp_IsMMIOExBase: pOwner=%p GCPhys=%RGp -> %RTbool\n", pOwner, GCPhys, fRc));
276 return fRc;
277}
278
279
280/** @interface_method_impl{PDMPCIHLPR3,pfnLock} */
281static DECLCALLBACK(int) pdmR3PciHlp_Lock(PPDMDEVINS pDevIns, int rc)
282{
283 PDMDEV_ASSERT_DEVINS(pDevIns);
284 LogFlow(("pdmR3PciHlp_Lock: caller='%s'/%d: rc=%Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
285 return pdmLockEx(pDevIns->Internal.s.pVMR3, rc);
286}
287
288
289/** @interface_method_impl{PDMPCIHLPR3,pfnUnlock} */
290static DECLCALLBACK(void) pdmR3PciHlp_Unlock(PPDMDEVINS pDevIns)
291{
292 PDMDEV_ASSERT_DEVINS(pDevIns);
293 LogFlow(("pdmR3PciHlp_Unlock: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance));
294 pdmUnlock(pDevIns->Internal.s.pVMR3);
295}
296
297
298/** @interface_method_impl{PDMPCIHLPR3,pfnGetRCHelpers} */
299static DECLCALLBACK(PCPDMPCIHLPRC) pdmR3PciHlp_GetRCHelpers(PPDMDEVINS pDevIns)
300{
301 PDMDEV_ASSERT_DEVINS(pDevIns);
302 PVM pVM = pDevIns->Internal.s.pVMR3;
303 VM_ASSERT_EMT(pVM);
304
305 RTRCPTR pRCHelpers = NIL_RTRCPTR;
306 if (VM_IS_RAW_MODE_ENABLED(pVM))
307 {
308 int rc = PDMR3LdrGetSymbolRC(pVM, NULL, "g_pdmRCPciHlp", &pRCHelpers);
309 AssertReleaseRC(rc);
310 AssertRelease(pRCHelpers);
311 }
312
313 LogFlow(("pdmR3PciHlp_GetRCHelpers: caller='%s'/%d: returns %RRv\n",
314 pDevIns->pReg->szName, pDevIns->iInstance, pRCHelpers));
315 return pRCHelpers;
316}
317
318
319/** @interface_method_impl{PDMPCIHLPR3,pfnGetR0Helpers} */
320static DECLCALLBACK(PCPDMPCIHLPR0) pdmR3PciHlp_GetR0Helpers(PPDMDEVINS pDevIns)
321{
322 PDMDEV_ASSERT_DEVINS(pDevIns);
323 PVM pVM = pDevIns->Internal.s.pVMR3;
324 VM_ASSERT_EMT(pVM);
325 PCPDMPCIHLPR0 pR0Helpers = 0;
326 int rc = PDMR3LdrGetSymbolR0(pVM, NULL, "g_pdmR0PciHlp", &pR0Helpers);
327 AssertReleaseRC(rc);
328 AssertRelease(pR0Helpers);
329 LogFlow(("pdmR3PciHlp_GetR0Helpers: caller='%s'/%d: returns %RHv\n",
330 pDevIns->pReg->szName, pDevIns->iInstance, pR0Helpers));
331 return pR0Helpers;
332}
333
334
335/**
336 * PCI Bus Device Helpers.
337 */
338const PDMPCIHLPR3 g_pdmR3DevPciHlp =
339{
340 PDM_PCIHLPR3_VERSION,
341 pdmR3PciHlp_IsaSetIrq,
342 pdmR3PciHlp_IoApicSetIrq,
343 pdmR3PciHlp_IoApicSendMsi,
344 pdmR3PciHlp_IsMMIO2Base,
345 pdmR3PciHlp_GetRCHelpers,
346 pdmR3PciHlp_GetR0Helpers,
347 pdmR3PciHlp_Lock,
348 pdmR3PciHlp_Unlock,
349 PDM_PCIHLPR3_VERSION, /* the end */
350};
351
352/** @} */
353
354
355
356
357/** @name Ring-3 HPET Helpers
358 * {@
359 */
360
361/** @interface_method_impl{PDMHPETHLPR3,pfnSetLegacyMode} */
362static DECLCALLBACK(int) pdmR3HpetHlp_SetLegacyMode(PPDMDEVINS pDevIns, bool fActivated)
363{
364 PDMDEV_ASSERT_DEVINS(pDevIns);
365 LogFlow(("pdmR3HpetHlp_SetLegacyMode: caller='%s'/%d: fActivated=%RTbool\n", pDevIns->pReg->szName, pDevIns->iInstance, fActivated));
366
367 size_t i;
368 int rc = VINF_SUCCESS;
369 static const char * const s_apszDevsToNotify[] =
370 {
371 "i8254",
372 "mc146818"
373 };
374 for (i = 0; i < RT_ELEMENTS(s_apszDevsToNotify); i++)
375 {
376 PPDMIBASE pBase;
377 rc = PDMR3QueryDevice(pDevIns->Internal.s.pVMR3->pUVM, "i8254", 0, &pBase);
378 if (RT_SUCCESS(rc))
379 {
380 PPDMIHPETLEGACYNOTIFY pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIHPETLEGACYNOTIFY);
381 AssertLogRelMsgBreakStmt(pPort, ("%s\n", s_apszDevsToNotify[i]), rc = VERR_PDM_HPET_LEGACY_NOTIFY_MISSING);
382 pPort->pfnModeChanged(pPort, fActivated);
383 }
384 else if ( rc == VERR_PDM_DEVICE_NOT_FOUND
385 || rc == VERR_PDM_DEVICE_INSTANCE_NOT_FOUND)
386 rc = VINF_SUCCESS; /* the device isn't configured, ignore. */
387 else
388 AssertLogRelMsgFailedBreak(("%s -> %Rrc\n", s_apszDevsToNotify[i], rc));
389 }
390
391 /* Don't bother cleaning up, any failure here will cause a guru meditation. */
392
393 LogFlow(("pdmR3HpetHlp_SetLegacyMode: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
394 return rc;
395}
396
397
398/** @interface_method_impl{PDMHPETHLPR3,pfnSetIrq} */
399static DECLCALLBACK(int) pdmR3HpetHlp_SetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel)
400{
401 PDMDEV_ASSERT_DEVINS(pDevIns);
402 LogFlow(("pdmR3HpetHlp_SetIrq: caller='%s'/%d: iIrq=%d iLevel=%d\n", pDevIns->pReg->szName, pDevIns->iInstance, iIrq, iLevel));
403 PVM pVM = pDevIns->Internal.s.pVMR3;
404
405 pdmLock(pVM);
406 uint32_t uTagSrc;
407 if (iLevel & PDM_IRQ_LEVEL_HIGH)
408 {
409 pDevIns->Internal.s.uLastIrqTag = uTagSrc = pdmCalcIrqTag(pVM, pDevIns->idTracing);
410 if (iLevel == PDM_IRQ_LEVEL_HIGH)
411 VBOXVMM_PDM_IRQ_HIGH(VMMGetCpu(pVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc));
412 else
413 VBOXVMM_PDM_IRQ_HILO(VMMGetCpu(pVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc));
414 }
415 else
416 uTagSrc = pDevIns->Internal.s.uLastIrqTag;
417
418 PDMIsaSetIrq(pVM, iIrq, iLevel, uTagSrc); /* (The API takes the lock recursively.) */
419
420 if (iLevel == PDM_IRQ_LEVEL_LOW)
421 VBOXVMM_PDM_IRQ_LOW(VMMGetCpu(pVM), RT_LOWORD(uTagSrc), RT_HIWORD(uTagSrc));
422 pdmUnlock(pVM);
423 return 0;
424}
425
426
427/** @interface_method_impl{PDMHPETHLPR3,pfnGetRCHelpers} */
428static DECLCALLBACK(PCPDMHPETHLPRC) pdmR3HpetHlp_GetRCHelpers(PPDMDEVINS pDevIns)
429{
430 PDMDEV_ASSERT_DEVINS(pDevIns);
431 PVM pVM = pDevIns->Internal.s.pVMR3;
432 VM_ASSERT_EMT(pVM);
433
434 RTRCPTR pRCHelpers = NIL_RTRCPTR;
435 if (VM_IS_RAW_MODE_ENABLED(pVM))
436 {
437 int rc = PDMR3LdrGetSymbolRC(pVM, NULL, "g_pdmRCHpetHlp", &pRCHelpers);
438 AssertReleaseRC(rc);
439 AssertRelease(pRCHelpers);
440 }
441
442 LogFlow(("pdmR3HpetHlp_GetGCHelpers: caller='%s'/%d: returns %RRv\n",
443 pDevIns->pReg->szName, pDevIns->iInstance, pRCHelpers));
444 return pRCHelpers;
445}
446
447
448/** @interface_method_impl{PDMHPETHLPR3,pfnGetR0Helpers} */
449static DECLCALLBACK(PCPDMHPETHLPR0) pdmR3HpetHlp_GetR0Helpers(PPDMDEVINS pDevIns)
450{
451 PDMDEV_ASSERT_DEVINS(pDevIns);
452 PVM pVM = pDevIns->Internal.s.pVMR3;
453 VM_ASSERT_EMT(pVM);
454 PCPDMHPETHLPR0 pR0Helpers = 0;
455 int rc = PDMR3LdrGetSymbolR0(pVM, NULL, "g_pdmR0HpetHlp", &pR0Helpers);
456 AssertReleaseRC(rc);
457 AssertRelease(pR0Helpers);
458 LogFlow(("pdmR3HpetHlp_GetR0Helpers: caller='%s'/%d: returns %RHv\n",
459 pDevIns->pReg->szName, pDevIns->iInstance, pR0Helpers));
460 return pR0Helpers;
461}
462
463
464/**
465 * HPET Device Helpers.
466 */
467const PDMHPETHLPR3 g_pdmR3DevHpetHlp =
468{
469 PDM_HPETHLPR3_VERSION,
470 pdmR3HpetHlp_GetRCHelpers,
471 pdmR3HpetHlp_GetR0Helpers,
472 pdmR3HpetHlp_SetLegacyMode,
473 pdmR3HpetHlp_SetIrq,
474 PDM_HPETHLPR3_VERSION, /* the end */
475};
476
477/** @} */
478
479
480/** @name Ring-3 Raw PCI Device Helpers
481 * {@
482 */
483
484/** @interface_method_impl{PDMPCIRAWHLPR3,pfnGetRCHelpers} */
485static DECLCALLBACK(PCPDMPCIRAWHLPRC) pdmR3PciRawHlp_GetRCHelpers(PPDMDEVINS pDevIns)
486{
487 PDMDEV_ASSERT_DEVINS(pDevIns);
488 PVM pVM = pDevIns->Internal.s.pVMR3;
489 VM_ASSERT_EMT(pVM);
490
491 RTRCPTR pRCHelpers = NIL_RTRCPTR;
492 if (VM_IS_RAW_MODE_ENABLED(pVM))
493 {
494 int rc = PDMR3LdrGetSymbolRC(pVM, NULL, "g_pdmRCPciRawHlp", &pRCHelpers);
495 AssertReleaseRC(rc);
496 AssertRelease(pRCHelpers);
497 }
498
499 LogFlow(("pdmR3PciRawHlp_GetGCHelpers: caller='%s'/%d: returns %RRv\n",
500 pDevIns->pReg->szName, pDevIns->iInstance, pRCHelpers));
501 return pRCHelpers;
502}
503
504
505/** @interface_method_impl{PDMPCIRAWHLPR3,pfnGetR0Helpers} */
506static DECLCALLBACK(PCPDMPCIRAWHLPR0) pdmR3PciRawHlp_GetR0Helpers(PPDMDEVINS pDevIns)
507{
508 PDMDEV_ASSERT_DEVINS(pDevIns);
509 PVM pVM = pDevIns->Internal.s.pVMR3;
510 VM_ASSERT_EMT(pVM);
511 PCPDMHPETHLPR0 pR0Helpers = NIL_RTR0PTR;
512 int rc = PDMR3LdrGetSymbolR0(pVM, NULL, "g_pdmR0PciRawHlp", &pR0Helpers);
513 AssertReleaseRC(rc);
514 AssertRelease(pR0Helpers);
515 LogFlow(("pdmR3PciRawHlp_GetR0Helpers: caller='%s'/%d: returns %RHv\n",
516 pDevIns->pReg->szName, pDevIns->iInstance, pR0Helpers));
517 return pR0Helpers;
518}
519
520
521/**
522 * Raw PCI Device Helpers.
523 */
524const PDMPCIRAWHLPR3 g_pdmR3DevPciRawHlp =
525{
526 PDM_PCIRAWHLPR3_VERSION,
527 pdmR3PciRawHlp_GetRCHelpers,
528 pdmR3PciRawHlp_GetR0Helpers,
529 PDM_PCIRAWHLPR3_VERSION, /* the end */
530};
531
532/** @} */
533
534
535/* none yet */
536
537/**
538 * Firmware Device Helpers.
539 */
540const PDMFWHLPR3 g_pdmR3DevFirmwareHlp =
541{
542 PDM_FWHLPR3_VERSION,
543 PDM_FWHLPR3_VERSION
544};
545
546/**
547 * DMAC Device Helpers.
548 */
549const PDMDMACHLP g_pdmR3DevDmacHlp =
550{
551 PDM_DMACHLP_VERSION
552};
553
554
555
556
557/* none yet */
558
559/**
560 * RTC Device Helpers.
561 */
562const PDMRTCHLP g_pdmR3DevRtcHlp =
563{
564 PDM_RTCHLP_VERSION
565};
566
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