VirtualBox

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

Last change on this file since 71800 was 70948, checked in by vboxsync, 7 years ago

VMM: Added a bMainExecutionEngine member to the VM structure for use instead of fHMEnabled and fNEMEnabled. Changed a lot of HMIsEnabled invocations to use the new macros VM_IS_RAW_MODE_ENABLED and VM_IS_HM_OR_NEM_ENABLED. Eliminated fHMEnabledFixed. Fixed inverted test for raw-mode debug register sanity checking. Some other minor cleanups.

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