VirtualBox

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

Last change on this file since 80074 was 78208, checked in by vboxsync, 6 years ago

PDM,APIC,PIC: Don't use AssertRelease on VMCPU_FF_INTERRUPT_PIC, VMCPU_FF_INTERRUPT_APIC and friends during restore. Instead added debug assertions in the relevant functions causing these to be set by misbehaving device state loaders. ticketref:18331 ticketref:18265

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