Changeset 26175 in vbox for trunk/src/VBox/VMM/VMMGC
- Timestamp:
- Feb 2, 2010 10:14:21 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.
Note:
See TracChangeset
for help on using the changeset viewer.