Changeset 26175 in vbox
- Timestamp:
- Feb 2, 2010 10:14:21 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/pdmdrv.h
r26172 r26175 507 507 508 508 509 /** 510 * PDM Driver API - raw-mode context variant. 511 */ 512 typedef struct PDMDRVHLPRC 513 { 514 /** Structure version. PDM_DRVHLPRC_VERSION defines the current version. */ 515 uint32_t u32Version; 516 517 /** 518 * Set the VM error message 519 * 520 * @returns rc. 521 * @param pDrvIns Driver instance. 522 * @param rc VBox status code. 523 * @param RT_SRC_POS_DECL Use RT_SRC_POS. 524 * @param pszFormat Error message format string. 525 * @param ... Error message arguments. 526 */ 527 DECLRCCALLBACKMEMBER(int, pfnVMSetError,(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)); 528 529 /** 530 * Set the VM error message 531 * 532 * @returns rc. 533 * @param pDrvIns Driver instance. 534 * @param rc VBox status code. 535 * @param RT_SRC_POS_DECL Use RT_SRC_POS. 536 * @param pszFormat Error message format string. 537 * @param va Error message arguments. 538 */ 539 DECLRCCALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)); 540 541 /** 542 * Set the VM runtime error message 543 * 544 * @returns VBox status code. 545 * @param pDrvIns Driver instance. 546 * @param fFlags The action flags. See VMSETRTERR_FLAGS_*. 547 * @param pszErrorId Error ID string. 548 * @param pszFormat Error message format string. 549 * @param ... Error message arguments. 550 */ 551 DECLRCCALLBACKMEMBER(int, pfnVMSetRuntimeError,(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...)); 552 553 /** 554 * Set the VM runtime error message 555 * 556 * @returns VBox status code. 557 * @param pDrvIns Driver instance. 558 * @param fFlags The action flags. See VMSETRTERR_FLAGS_*. 559 * @param pszErrorId Error ID string. 560 * @param pszFormat Error message format string. 561 * @param va Error message arguments. 562 */ 563 DECLRCCALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va)); 564 565 /** 566 * Assert that the current thread is the emulation thread. 567 * 568 * @returns True if correct. 569 * @returns False if wrong. 570 * @param pDrvIns Driver instance. 571 * @param pszFile Filename of the assertion location. 572 * @param iLine Linenumber of the assertion location. 573 * @param pszFunction Function of the assertion location. 574 */ 575 DECLRCCALLBACKMEMBER(bool, pfnAssertEMT,(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction)); 576 577 /** 578 * Assert that the current thread is NOT the emulation thread. 579 * 580 * @returns True if correct. 581 * @returns False if wrong. 582 * @param pDrvIns Driver instance. 583 * @param pszFile Filename of the assertion location. 584 * @param iLine Linenumber of the assertion location. 585 * @param pszFunction Function of the assertion location. 586 */ 587 DECLRCCALLBACKMEMBER(bool, pfnAssertOther,(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction)); 588 589 /** Just a safety precaution. */ 590 uint32_t u32TheEnd; 591 } PDMDRVHLPRC; 592 /** Current PDMDRVHLPRC version number. */ 593 #define PDM_DRVHLPRC_VERSION PDM_VERSION_MAKE(0xf0f9, 1, 0) 594 595 596 /** 597 * PDM Driver API, ring-0 context. 598 */ 599 typedef struct PDMDRVHLPR0 600 { 601 /** Structure version. PDM_DRVHLPR0_VERSION defines the current version. */ 602 uint32_t u32Version; 603 604 /** 605 * Set the VM error message 606 * 607 * @returns rc. 608 * @param pDrvIns Driver instance. 609 * @param rc VBox status code. 610 * @param RT_SRC_POS_DECL Use RT_SRC_POS. 611 * @param pszFormat Error message format string. 612 * @param ... Error message arguments. 613 */ 614 DECLR0CALLBACKMEMBER(int, pfnVMSetError,(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)); 615 616 /** 617 * Set the VM error message 618 * 619 * @returns rc. 620 * @param pDrvIns Driver instance. 621 * @param rc VBox status code. 622 * @param RT_SRC_POS_DECL Use RT_SRC_POS. 623 * @param pszFormat Error message format string. 624 * @param va Error message arguments. 625 */ 626 DECLR0CALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)); 627 628 /** 629 * Set the VM runtime error message 630 * 631 * @returns VBox status code. 632 * @param pDrvIns Driver instance. 633 * @param fFlags The action flags. See VMSETRTERR_FLAGS_*. 634 * @param pszErrorId Error ID string. 635 * @param pszFormat Error message format string. 636 * @param ... Error message arguments. 637 */ 638 DECLR0CALLBACKMEMBER(int, pfnVMSetRuntimeError,(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...)); 639 640 /** 641 * Set the VM runtime error message 642 * 643 * @returns VBox status code. 644 * @param pDrvIns Driver instance. 645 * @param fFlags The action flags. See VMSETRTERR_FLAGS_*. 646 * @param pszErrorId Error ID string. 647 * @param pszFormat Error message format string. 648 * @param va Error message arguments. 649 */ 650 DECLR0CALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va)); 651 652 /** 653 * Assert that the current thread is the emulation thread. 654 * 655 * @returns True if correct. 656 * @returns False if wrong. 657 * @param pDrvIns Driver instance. 658 * @param pszFile Filename of the assertion location. 659 * @param iLine Linenumber of the assertion location. 660 * @param pszFunction Function of the assertion location. 661 */ 662 DECLR0CALLBACKMEMBER(bool, pfnAssertEMT,(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction)); 663 664 /** 665 * Assert that the current thread is NOT the emulation thread. 666 * 667 * @returns True if correct. 668 * @returns False if wrong. 669 * @param pDrvIns Driver instance. 670 * @param pszFile Filename of the assertion location. 671 * @param iLine Linenumber of the assertion location. 672 * @param pszFunction Function of the assertion location. 673 */ 674 DECLR0CALLBACKMEMBER(bool, pfnAssertOther,(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction)); 675 676 /** Just a safety precaution. */ 677 uint32_t u32TheEnd; 678 } PDMDRVHLPR0; 679 /** Current DRVHLP version number. */ 680 #define PDM_DRVHLPR0_VERSION PDM_VERSION_MAKE(0xf0f8, 1, 0) 681 682 509 683 #ifdef IN_RING3 684 510 685 /** 511 686 * PDM Driver API. … … 935 1110 #define PDM_DRVHLPR3_VERSION PDM_VERSION_MAKE(0xf0fb, 1, 0) 936 1111 1112 #endif /* IN_RING3 */ 1113 937 1114 938 1115 /** … … 990 1167 } 991 1168 992 #endif /* IN_RING3 */993 1169 994 1170 -
trunk/src/VBox/VMM/PDM.cpp
r26169 r26175 452 452 453 453 /* 454 * Devices .455 */ 456 PCPDMDEVHLPRC p HlpRC;457 int rc = PDMR3LdrGetSymbolRC(pVM, NULL, "g_pdmRCDevHlp", &p HlpRC);454 * Devices & Drivers. 455 */ 456 PCPDMDEVHLPRC pDevHlpRC; 457 int rc = PDMR3LdrGetSymbolRC(pVM, NULL, "g_pdmRCDevHlp", &pDevHlpRC); 458 458 AssertReleaseMsgRC(rc, ("rc=%Rrc when resolving g_pdmRCDevHlp\n", rc)); 459 460 PCPDMDRVHLPRC pDrvHlpRC; 461 rc = PDMR3LdrGetSymbolRC(pVM, NULL, "g_pdmRCDevHlp", &pDrvHlpRC); 462 AssertReleaseMsgRC(rc, ("rc=%Rrc when resolving g_pdmRCDevHlp\n", rc)); 463 459 464 for (PPDMDEVINS pDevIns = pVM->pdm.s.pDevInstances; pDevIns; pDevIns = pDevIns->Internal.s.pNextR3) 460 465 { 461 466 if (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_RC) 462 467 { 463 pDevIns->pHlpRC = p HlpRC;468 pDevIns->pHlpRC = pDevHlpRC; 464 469 pDevIns->pvInstanceDataRC = MMHyperR3ToRC(pVM, pDevIns->pvInstanceDataR3); 465 470 pDevIns->Internal.s.pVMRC = pVM->pVMRC; … … 475 480 } 476 481 } 482 483 for (PPDMLUN pLun = pDevIns->Internal.s.pLunsR3; pLun; pLun = pLun->pNext) 484 { 485 for (PPDMDRVINS pDrvIns = pLun->pTop; pDrvIns; pDrvIns = pDrvIns->Internal.s.pDown) 486 { 487 if (pDrvIns->pReg->fFlags & PDM_DRVREG_FLAGS_RC) 488 { 489 pDrvIns->pHlpRC = pDrvHlpRC; 490 pDrvIns->pvInstanceDataRC = MMHyperR3ToRC(pVM, pDrvIns->pvInstanceDataR3); 491 pDrvIns->Internal.s.pVMRC = pVM->pVMRC; 492 if (pDrvIns->pReg->pfnRelocate) 493 { 494 LogFlow(("PDMR3Relocate: Relocating driver '%s'/%u attached to '%s'/%d/%u\n", 495 pDrvIns->pReg->szName, pDrvIns->iInstance, 496 pDevIns->pReg->szName, pDevIns->iInstance, pLun->iLun)); 497 pDrvIns->pReg->pfnRelocate(pDrvIns, offDelta); 498 } 499 } 500 } 501 } 502 477 503 } 478 504 } -
trunk/src/VBox/VMM/PDMDriver.cpp
r26172 r26175 68 68 * Internal Functions * 69 69 *******************************************************************************/ 70 /** @def PDMDRV_ASSERT_DRVINS71 * Asserts the validity of the driver instance.72 */73 #ifdef VBOX_STRICT74 # define PDMDRV_ASSERT_DRVINS(pDrvIns) \75 do { \76 AssertPtr(pDrvIns); \77 Assert(pDrvIns->u32Version == PDM_DRVINS_VERSION); \78 Assert(pDrvIns->pvInstanceDataR3 == (void *)&pDrvIns->achInstanceData[0]); \79 } while (0)80 #else81 # define PDMDRV_ASSERT_DRVINS(pDrvIns) do { } while (0)82 #endif83 /** @} */84 85 70 static DECLCALLBACK(int) pdmR3DrvRegister(PCPDMDRVREGCB pCallbacks, PCPDMDRVREG pReg); 86 71 static int pdmR3DrvLoad(PVM pVM, PPDMDRVREGCBINT pRegCB, const char *pszFilename, const char *pszName); -
trunk/src/VBox/VMM/PDMInternal.h
r26162 r26175 1076 1076 #endif 1077 1077 1078 /** @def PDMDRV_ASSERT_DRVINS 1079 * Asserts the validity of the driver instance. 1080 */ 1081 #ifdef VBOX_STRICT 1082 # define PDMDRV_ASSERT_DRVINS(pDrvIns) \ 1083 do { \ 1084 AssertPtr(pDrvIns); \ 1085 Assert(pDrvIns->u32Version == PDM_DRVINS_VERSION); \ 1086 Assert(pDrvIns->CTX_SUFF(pvInstanceData) == (void *)&pDrvIns->achInstanceData[0]); \ 1087 } while (0) 1088 #else 1089 # define PDMDRV_ASSERT_DRVINS(pDrvIns) do { } while (0) 1090 #endif 1091 1078 1092 1079 1093 /******************************************************************************* -
trunk/src/VBox/VMM/VMMGC/PDMGCDevice.cpp
r26152 r26175 50 50 extern DECLEXPORT(const PDMPCIHLPRC) g_pdmRCPciHlp; 51 51 extern DECLEXPORT(const PDMHPETHLPRC) g_pdmRCHpetHlp; 52 extern DECLEXPORT(const PDMDRVHLPRC) g_pdmRCDrvHlp; 52 53 RT_C_DECLS_END 53 54 … … 67 68 68 69 /** @interface_method_impl{PDMDEVHLPRC,pfnPCISetIrq} */ 69 static DECLCALLBACK(void) pdm GCDevHlp_PCISetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel)70 { 71 PDMDEV_ASSERT_DEVINS(pDevIns); 72 LogFlow(("pdm GCDevHlp_PCISetIrq: caller=%p/%d: iIrq=%d iLevel=%d\n", pDevIns, pDevIns->iInstance, iIrq, iLevel));70 static DECLCALLBACK(void) pdmRCDevHlp_PCISetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel) 71 { 72 PDMDEV_ASSERT_DEVINS(pDevIns); 73 LogFlow(("pdmRCDevHlp_PCISetIrq: caller=%p/%d: iIrq=%d iLevel=%d\n", pDevIns, pDevIns->iInstance, iIrq, iLevel)); 73 74 74 75 PVM pVM = pDevIns->Internal.s.pVMRC; … … 100 101 } 101 102 102 LogFlow(("pdm GCDevHlp_PCISetIrq: caller=%p/%d: returns void\n", pDevIns, pDevIns->iInstance));103 } 104 105 106 /** @interface_method_impl{PDMD EVHLPRC,pfnPCISetIrq} */107 static DECLCALLBACK(void) pdm GCDevHlp_ISASetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel)108 { 109 PDMDEV_ASSERT_DEVINS(pDevIns); 110 LogFlow(("pdm GCDevHlp_ISASetIrq: caller=%p/%d: iIrq=%d iLevel=%d\n", pDevIns, pDevIns->iInstance, iIrq, iLevel));103 LogFlow(("pdmRCDevHlp_PCISetIrq: caller=%p/%d: returns void\n", pDevIns, pDevIns->iInstance)); 104 } 105 106 107 /** @interface_method_impl{PDMDRVHLPRC,pfnPCISetIrq} */ 108 static DECLCALLBACK(void) pdmRCDevHlp_ISASetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel) 109 { 110 PDMDEV_ASSERT_DEVINS(pDevIns); 111 LogFlow(("pdmRCDevHlp_ISASetIrq: caller=%p/%d: iIrq=%d iLevel=%d\n", pDevIns, pDevIns->iInstance, iIrq, iLevel)); 111 112 112 113 pdmRCIsaSetIrq(pDevIns->Internal.s.pVMRC, iIrq, iLevel); 113 114 114 LogFlow(("pdm GCDevHlp_ISASetIrq: caller=%p/%d: returns void\n", pDevIns, pDevIns->iInstance));115 LogFlow(("pdmRCDevHlp_ISASetIrq: caller=%p/%d: returns void\n", pDevIns, pDevIns->iInstance)); 115 116 } 116 117 117 118 118 119 /** @interface_method_impl{PDMDEVHLPRC,pfnPhysRead} */ 119 static DECLCALLBACK(int) pdm GCDevHlp_PhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)120 { 121 PDMDEV_ASSERT_DEVINS(pDevIns); 122 LogFlow(("pdm GCDevHlp_PhysRead: caller=%p/%d: GCPhys=%RGp pvBuf=%p cbRead=%#x\n",120 static DECLCALLBACK(int) pdmRCDevHlp_PhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead) 121 { 122 PDMDEV_ASSERT_DEVINS(pDevIns); 123 LogFlow(("pdmRCDevHlp_PhysRead: caller=%p/%d: GCPhys=%RGp pvBuf=%p cbRead=%#x\n", 123 124 pDevIns, pDevIns->iInstance, GCPhys, pvBuf, cbRead)); 124 125 … … 126 127 AssertRC(rc); /** @todo track down the users for this bugger. */ 127 128 128 Log(("pdm GCDevHlp_PhysRead: caller=%p/%d: returns %Rrc\n", pDevIns, pDevIns->iInstance, rc));129 Log(("pdmRCDevHlp_PhysRead: caller=%p/%d: returns %Rrc\n", pDevIns, pDevIns->iInstance, rc)); 129 130 return rc; 130 131 } … … 132 133 133 134 /** @interface_method_impl{PDMDEVHLPRC,pfnPhysWrite} */ 134 static DECLCALLBACK(int) pdm GCDevHlp_PhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)135 { 136 PDMDEV_ASSERT_DEVINS(pDevIns); 137 LogFlow(("pdm GCDevHlp_PhysWrite: caller=%p/%d: GCPhys=%RGp pvBuf=%p cbWrite=%#x\n",135 static DECLCALLBACK(int) pdmRCDevHlp_PhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite) 136 { 137 PDMDEV_ASSERT_DEVINS(pDevIns); 138 LogFlow(("pdmRCDevHlp_PhysWrite: caller=%p/%d: GCPhys=%RGp pvBuf=%p cbWrite=%#x\n", 138 139 pDevIns, pDevIns->iInstance, GCPhys, pvBuf, cbWrite)); 139 140 … … 141 142 AssertRC(rc); /** @todo track down the users for this bugger. */ 142 143 143 Log(("pdm GCDevHlp_PhysWrite: caller=%p/%d: returns %Rrc\n", pDevIns, pDevIns->iInstance, rc));144 Log(("pdmRCDevHlp_PhysWrite: caller=%p/%d: returns %Rrc\n", pDevIns, pDevIns->iInstance, rc)); 144 145 return rc; 145 146 } … … 147 148 148 149 /** @interface_method_impl{PDMDEVHLPRC,pfnA20IsEnabled} */ 149 static DECLCALLBACK(bool) pdm GCDevHlp_A20IsEnabled(PPDMDEVINS pDevIns)150 { 151 PDMDEV_ASSERT_DEVINS(pDevIns); 152 LogFlow(("pdm GCDevHlp_A20IsEnabled: caller=%p/%d:\n", pDevIns, pDevIns->iInstance));150 static DECLCALLBACK(bool) pdmRCDevHlp_A20IsEnabled(PPDMDEVINS pDevIns) 151 { 152 PDMDEV_ASSERT_DEVINS(pDevIns); 153 LogFlow(("pdmRCDevHlp_A20IsEnabled: caller=%p/%d:\n", pDevIns, pDevIns->iInstance)); 153 154 154 155 bool fEnabled = PGMPhysIsA20Enabled(VMMGetCpu0(pDevIns->Internal.s.pVMRC)); 155 156 156 Log(("pdm GCDevHlp_A20IsEnabled: caller=%p/%d: returns %RTbool\n", pDevIns, pDevIns->iInstance, fEnabled));157 Log(("pdmRCDevHlp_A20IsEnabled: caller=%p/%d: returns %RTbool\n", pDevIns, pDevIns->iInstance, fEnabled)); 157 158 return fEnabled; 158 159 } … … 160 161 161 162 /** @interface_method_impl{PDMDEVHLPRC,pfnVMSetError} */ 162 static DECLCALLBACK(int) pdm GCDevHlp_VMSetError(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)163 static DECLCALLBACK(int) pdmRCDevHlp_VMSetError(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...) 163 164 { 164 165 PDMDEV_ASSERT_DEVINS(pDevIns); … … 172 173 173 174 /** @interface_method_impl{PDMDEVHLPRC,pfnVMSetErrorV} */ 174 static DECLCALLBACK(int) pdm GCDevHlp_VMSetErrorV(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)175 static DECLCALLBACK(int) pdmRCDevHlp_VMSetErrorV(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va) 175 176 { 176 177 PDMDEV_ASSERT_DEVINS(pDevIns); … … 181 182 182 183 /** @interface_method_impl{PDMDEVHLPRC,pfnVMSetRuntimeError} */ 183 static DECLCALLBACK(int) pdm GCDevHlp_VMSetRuntimeError(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...)184 static DECLCALLBACK(int) pdmRCDevHlp_VMSetRuntimeError(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...) 184 185 { 185 186 PDMDEV_ASSERT_DEVINS(pDevIns); … … 193 194 194 195 /** @interface_method_impl{PDMDEVHLPRC,pfnVMSetErrorV} */ 195 static DECLCALLBACK(int) pdm GCDevHlp_VMSetRuntimeErrorV(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va)196 static DECLCALLBACK(int) pdmRCDevHlp_VMSetRuntimeErrorV(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va) 196 197 { 197 198 PDMDEV_ASSERT_DEVINS(pDevIns); … … 202 203 203 204 /** @interface_method_impl{PDMDEVHLPRC,pfnPATMSetMMIOPatchInfo} */ 204 static DECLCALLBACK(int) pdm GCDevHlp_PATMSetMMIOPatchInfo(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPTR pCachedData)205 { 206 PDMDEV_ASSERT_DEVINS(pDevIns); 207 LogFlow(("pdm GCDevHlp_PATMSetMMIOPatchInfo: caller=%p/%d:\n", pDevIns, pDevIns->iInstance));205 static DECLCALLBACK(int) pdmRCDevHlp_PATMSetMMIOPatchInfo(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPTR pCachedData) 206 { 207 PDMDEV_ASSERT_DEVINS(pDevIns); 208 LogFlow(("pdmRCDevHlp_PATMSetMMIOPatchInfo: caller=%p/%d:\n", pDevIns, pDevIns->iInstance)); 208 209 209 210 return PATMSetMMIOPatchInfo(pDevIns->Internal.s.pVMRC, GCPhys, (RTRCPTR)pCachedData); … … 212 213 213 214 /** @interface_method_impl{PDMDEVHLPRC,pfnGetVM} */ 214 static DECLCALLBACK(PVM) pdm GCDevHlp_GetVM(PPDMDEVINS pDevIns)215 { 216 PDMDEV_ASSERT_DEVINS(pDevIns); 217 LogFlow(("pdm GCDevHlp_GetVM: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));215 static DECLCALLBACK(PVM) pdmRCDevHlp_GetVM(PPDMDEVINS pDevIns) 216 { 217 PDMDEV_ASSERT_DEVINS(pDevIns); 218 LogFlow(("pdmRCDevHlp_GetVM: caller='%p'/%d\n", pDevIns, pDevIns->iInstance)); 218 219 return pDevIns->Internal.s.pVMRC; 219 220 } … … 221 222 222 223 /** @interface_method_impl{PDMDEVHLPRC,pfnGetVMCPU} */ 223 static DECLCALLBACK(PVMCPU) pdm GCDevHlp_GetVMCPU(PPDMDEVINS pDevIns)224 { 225 PDMDEV_ASSERT_DEVINS(pDevIns); 226 LogFlow(("pdm GCDevHlp_GetVMCPU: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));224 static DECLCALLBACK(PVMCPU) pdmRCDevHlp_GetVMCPU(PPDMDEVINS pDevIns) 225 { 226 PDMDEV_ASSERT_DEVINS(pDevIns); 227 LogFlow(("pdmRCDevHlp_GetVMCPU: caller='%p'/%d\n", pDevIns, pDevIns->iInstance)); 227 228 return VMMGetCpu(pDevIns->Internal.s.pVMRC); 228 229 } … … 235 236 { 236 237 PDM_DEVHLPRC_VERSION, 237 pdm GCDevHlp_PCISetIrq,238 pdm GCDevHlp_ISASetIrq,239 pdm GCDevHlp_PhysRead,240 pdm GCDevHlp_PhysWrite,241 pdm GCDevHlp_A20IsEnabled,242 pdm GCDevHlp_VMSetError,243 pdm GCDevHlp_VMSetErrorV,244 pdm GCDevHlp_VMSetRuntimeError,245 pdm GCDevHlp_VMSetRuntimeErrorV,246 pdm GCDevHlp_PATMSetMMIOPatchInfo,247 pdm GCDevHlp_GetVM,248 pdm GCDevHlp_GetVMCPU,238 pdmRCDevHlp_PCISetIrq, 239 pdmRCDevHlp_ISASetIrq, 240 pdmRCDevHlp_PhysRead, 241 pdmRCDevHlp_PhysWrite, 242 pdmRCDevHlp_A20IsEnabled, 243 pdmRCDevHlp_VMSetError, 244 pdmRCDevHlp_VMSetErrorV, 245 pdmRCDevHlp_VMSetRuntimeError, 246 pdmRCDevHlp_VMSetRuntimeErrorV, 247 pdmRCDevHlp_PATMSetMMIOPatchInfo, 248 pdmRCDevHlp_GetVM, 249 pdmRCDevHlp_GetVMCPU, 249 250 PDM_DEVHLPRC_VERSION 250 251 }; … … 618 619 619 620 621 /** @name Raw-Mode Context Driver Helpers 622 * @{ 623 */ 624 625 /** @interface_method_impl{PDMDRVHLPRC,pfnVMSetError} */ 626 static DECLCALLBACK(int) pdmRCDrvHlp_VMSetError(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...) 627 { 628 PDMDRV_ASSERT_DRVINS(pDrvIns); 629 va_list args; 630 va_start(args, pszFormat); 631 int rc2 = VMSetErrorV(pDrvIns->Internal.s.pVMRC, rc, RT_SRC_POS_ARGS, pszFormat, args); Assert(rc2 == rc); NOREF(rc2); 632 va_end(args); 633 return rc; 634 } 635 636 637 /** @interface_method_impl{PDMDRVHLPRC,pfnVMSetErrorV} */ 638 static DECLCALLBACK(int) pdmRCDrvHlp_VMSetErrorV(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va) 639 { 640 PDMDRV_ASSERT_DRVINS(pDrvIns); 641 int rc2 = VMSetErrorV(pDrvIns->Internal.s.pVMRC, rc, RT_SRC_POS_ARGS, pszFormat, va); Assert(rc2 == rc); NOREF(rc2); 642 return rc; 643 } 644 645 646 /** @interface_method_impl{PDMDRVHLPRC,pfnVMSetRuntimeError} */ 647 static DECLCALLBACK(int) pdmRCDrvHlp_VMSetRuntimeError(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...) 648 { 649 PDMDRV_ASSERT_DRVINS(pDrvIns); 650 va_list va; 651 va_start(va, pszFormat); 652 int rc = VMSetRuntimeErrorV(pDrvIns->Internal.s.pVMRC, fFlags, pszErrorId, pszFormat, va); 653 va_end(va); 654 return rc; 655 } 656 657 658 /** @interface_method_impl{PDMDRVHLPRC,pfnVMSetErrorV} */ 659 static DECLCALLBACK(int) pdmRCDrvHlp_VMSetRuntimeErrorV(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va) 660 { 661 PDMDRV_ASSERT_DRVINS(pDrvIns); 662 int rc = VMSetRuntimeErrorV(pDrvIns->Internal.s.pVMRC, fFlags, pszErrorId, pszFormat, va); 663 return rc; 664 } 665 666 667 /** @interface_method_impl{PDMDRVHLPRC,pfnAssertEMT} */ 668 static DECLCALLBACK(bool) pdmRCDrvHlp_AssertEMT(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction) 669 { 670 PDMDRV_ASSERT_DRVINS(pDrvIns); 671 if (VM_IS_EMT(pDrvIns->Internal.s.pVMRC)) 672 return true; 673 674 RTAssertMsg1Weak("AssertEMT", iLine, pszFile, pszFunction); 675 RTAssertPanic(); 676 return false; 677 } 678 679 680 /** @interface_method_impl{PDMDRVHLPRC,pfnAssertOther} */ 681 static DECLCALLBACK(bool) pdmRCDrvHlp_AssertOther(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction) 682 { 683 PDMDRV_ASSERT_DRVINS(pDrvIns); 684 if (!VM_IS_EMT(pDrvIns->Internal.s.pVMRC)) 685 return true; 686 687 /* Note: While we don't have any other threads but EMT(0) in RC, might 688 still have drive code compiled in which it shouldn't execute. */ 689 RTAssertMsg1Weak("AssertOther", iLine, pszFile, pszFunction); 690 RTAssertPanic(); 691 return false; 692 } 693 694 695 /** 696 * The Raw-Mode Context Driver Helper Callbacks. 697 */ 698 extern DECLEXPORT(const PDMDRVHLPRC) g_pdmRCDrvHlp = 699 { 700 PDM_DRVHLPRC_VERSION, 701 pdmRCDrvHlp_VMSetError, 702 pdmRCDrvHlp_VMSetErrorV, 703 pdmRCDrvHlp_VMSetRuntimeError, 704 pdmRCDrvHlp_VMSetRuntimeErrorV, 705 pdmRCDrvHlp_AssertEMT, 706 pdmRCDrvHlp_AssertOther, 707 PDM_DRVHLPRC_VERSION 708 }; 709 710 /** @} */ 711 712 713 714 620 715 /** 621 716 * Sets an irq on the I/O APIC. -
trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp
r26152 r26175 52 52 extern DECLEXPORT(const PDMPCIHLPR0) g_pdmR0PciHlp; 53 53 extern DECLEXPORT(const PDMHPETHLPR0) g_pdmR0HpetHlp; 54 extern DECLEXPORT(const PDMDRVHLPR0) g_pdmR0DrvHlp; 54 55 RT_C_DECLS_END 55 56 … … 652 653 653 654 655 656 /** @name Ring-0 Context Driver Helpers 657 * @{ 658 */ 659 660 /** @interface_method_impl{PDMDRVHLPR0,pfnVMSetError} */ 661 static DECLCALLBACK(int) pdmR0DrvHlp_VMSetError(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...) 662 { 663 PDMDRV_ASSERT_DRVINS(pDrvIns); 664 va_list args; 665 va_start(args, pszFormat); 666 int rc2 = VMSetErrorV(pDrvIns->Internal.s.pVMR0, rc, RT_SRC_POS_ARGS, pszFormat, args); Assert(rc2 == rc); NOREF(rc2); 667 va_end(args); 668 return rc; 669 } 670 671 672 /** @interface_method_impl{PDMDRVHLPR0,pfnVMSetErrorV} */ 673 static DECLCALLBACK(int) pdmR0DrvHlp_VMSetErrorV(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va) 674 { 675 PDMDRV_ASSERT_DRVINS(pDrvIns); 676 int rc2 = VMSetErrorV(pDrvIns->Internal.s.pVMR0, rc, RT_SRC_POS_ARGS, pszFormat, va); Assert(rc2 == rc); NOREF(rc2); 677 return rc; 678 } 679 680 681 /** @interface_method_impl{PDMDRVHLPR0,pfnVMSetRuntimeError} */ 682 static DECLCALLBACK(int) pdmR0DrvHlp_VMSetRuntimeError(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...) 683 { 684 PDMDRV_ASSERT_DRVINS(pDrvIns); 685 va_list va; 686 va_start(va, pszFormat); 687 int rc = VMSetRuntimeErrorV(pDrvIns->Internal.s.pVMR0, fFlags, pszErrorId, pszFormat, va); 688 va_end(va); 689 return rc; 690 } 691 692 693 /** @interface_method_impl{PDMDRVHLPR0,pfnVMSetErrorV} */ 694 static DECLCALLBACK(int) pdmR0DrvHlp_VMSetRuntimeErrorV(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va) 695 { 696 PDMDRV_ASSERT_DRVINS(pDrvIns); 697 int rc = VMSetRuntimeErrorV(pDrvIns->Internal.s.pVMR0, fFlags, pszErrorId, pszFormat, va); 698 return rc; 699 } 700 701 702 /** @interface_method_impl{PDMDRVHLPR0,pfnAssertEMT} */ 703 static DECLCALLBACK(bool) pdmR0DrvHlp_AssertEMT(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction) 704 { 705 PDMDRV_ASSERT_DRVINS(pDrvIns); 706 if (VM_IS_EMT(pDrvIns->Internal.s.pVMR0)) 707 return true; 708 709 RTAssertMsg1Weak("AssertEMT", iLine, pszFile, pszFunction); 710 RTAssertPanic(); 711 return false; 712 } 713 714 715 /** @interface_method_impl{PDMDRVHLPR0,pfnAssertOther} */ 716 static DECLCALLBACK(bool) pdmR0DrvHlp_AssertOther(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction) 717 { 718 PDMDRV_ASSERT_DRVINS(pDrvIns); 719 if (!VM_IS_EMT(pDrvIns->Internal.s.pVMR0)) 720 return true; 721 722 RTAssertMsg1Weak("AssertOther", iLine, pszFile, pszFunction); 723 RTAssertPanic(); 724 return false; 725 } 726 727 728 /** 729 * The Raw-Mode Context Driver Helper Callbacks. 730 */ 731 extern DECLEXPORT(const PDMDRVHLPR0) g_pdmR0DrvHlp = 732 { 733 PDM_DRVHLPRC_VERSION, 734 pdmR0DrvHlp_VMSetError, 735 pdmR0DrvHlp_VMSetErrorV, 736 pdmR0DrvHlp_VMSetRuntimeError, 737 pdmR0DrvHlp_VMSetRuntimeErrorV, 738 pdmR0DrvHlp_AssertEMT, 739 pdmR0DrvHlp_AssertOther, 740 PDM_DRVHLPRC_VERSION 741 }; 742 743 /** @} */ 744 745 746 747 654 748 /** 655 749 * Sets an irq on the I/O APIC.
Note:
See TracChangeset
for help on using the changeset viewer.