Changeset 37452 in vbox for trunk/src/VBox/VMM/include/IOMInline.h
- Timestamp:
- Jun 14, 2011 6:13:48 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/include/IOMInline.h
r37426 r37452 65 65 * @param GCPhys Physical address to lookup. 66 66 */ 67 DECLINLINE(PIOMMMIORANGE) iomM MIOGetRange(PVM pVM, RTGCPHYS GCPhys)67 DECLINLINE(PIOMMMIORANGE) iomMmioGetRange(PVM pVM, RTGCPHYS GCPhys) 68 68 { 69 Assert(PDMCritSectIsOwner(&pVM->iom.s.EmtLock) || !PDMCritSectIsInitialized(&pVM->iom.s.EmtLock));69 Assert(PDMCritSectIsOwner(&pVM->iom.s.EmtLock)); 70 70 PIOMMMIORANGE pRange = pVM->iom.s.CTX_SUFF(pMMIORangeLast); 71 71 if ( !pRange 72 72 || GCPhys - pRange->GCPhys >= pRange->cb) 73 pVM->iom.s.CTX_SUFF(pMMIORangeLast) = pRange 73 pVM->iom.s.CTX_SUFF(pMMIORangeLast) = pRange 74 74 = (PIOMMMIORANGE)RTAvlroGCPhysRangeGet(&pVM->iom.s.CTX_SUFF(pTrees)->MMIOTree, GCPhys); 75 75 return pRange; 76 } 77 78 /** 79 * Retain a MMIO range. 80 * 81 * @param pRange The range to release. 82 */ 83 DECLINLINE(void) iomMmioRetainRange(PIOMMMIORANGE pRange) 84 { 85 uint32_t cRefs = ASMAtomicIncU32(&pRange->cRefs); 86 Assert(cRefs > 1); 87 Assert(cRefs < _1M); 88 } 89 90 91 /** 92 * Gets the referenced MMIO range for the specified physical address in the 93 * current context. 94 * 95 * @returns Pointer to MMIO range. 96 * @returns NULL if address not in a MMIO range. 97 * 98 * @param pVM The VM handle. 99 * @param GCPhys Physical address to lookup. 100 */ 101 DECLINLINE(PIOMMMIORANGE) iomMmioGetRangeWithRef(PVM pVM, RTGCPHYS GCPhys) 102 { 103 int rc = PDMCritSectEnter(&pVM->iom.s.EmtLock, VINF_SUCCESS); 104 AssertRCReturn(rc, NULL); 105 106 PIOMMMIORANGE pRange = pVM->iom.s.CTX_SUFF(pMMIORangeLast); 107 if ( !pRange 108 || GCPhys - pRange->GCPhys >= pRange->cb) 109 pVM->iom.s.CTX_SUFF(pMMIORangeLast) = pRange 110 = (PIOMMMIORANGE)RTAvlroGCPhysRangeGet(&pVM->iom.s.CTX_SUFF(pTrees)->MMIOTree, GCPhys); 111 if (pRange) 112 iomMmioRetainRange(pRange); 113 114 PDMCritSectLeave(&pVM->iom.s.EmtLock); 115 return pRange; 116 } 117 118 119 /** 120 * Releases a MMIO range. 121 * 122 * @param pVM The VM handle. 123 * @param pRange The range to release. 124 */ 125 DECLINLINE(void) iomMmioReleaseRange(PVM pVM, PIOMMMIORANGE pRange) 126 { 127 uint32_t cRefs = ASMAtomicDecU32(&pRange->cRefs); 128 if (!cRefs) 129 iomMmioFreeRange(pVM, pRange); 76 130 } 77 131 … … 92 146 if ( !pRange 93 147 || GCPhys - pRange->GCPhys >= pRange->cb) 94 pVM->iom.s.CTX_SUFF(pMMIORangeLast) = pRange 148 pVM->iom.s.CTX_SUFF(pMMIORangeLast) = pRange 95 149 = (PIOMMMIORANGE)RTAvlroGCPhysRangeGet(&pVM->iom.s.CTX_SUFF(pTrees)->MMIOTree, GCPhys); 96 150 return pRange; … … 113 167 * @param pRange The MMIO range. 114 168 */ 115 DECLINLINE(PIOMMMIOSTATS) iomM MIOGetStats(PVM pVM, RTGCPHYS GCPhys, PIOMMMIORANGE pRange)169 DECLINLINE(PIOMMMIOSTATS) iomMmioGetStats(PVM pVM, RTGCPHYS GCPhys, PIOMMMIORANGE pRange) 116 170 { 117 Assert(PDMCritSectIsOwner(&pVM->iom.s.EmtLock));171 PDMCritSectEnter(&pVM->iom.s.EmtLock, VINF_SUCCESS); 118 172 119 173 /* For large ranges, we'll put everything on the first byte. */ … … 125 179 || pStats->Core.Key != GCPhys) 126 180 { 127 pStats = (PIOMMMIOSTATS)RTAvloGCPhysGet(&pVM->iom.s.CTX_SUFF(pTrees)->M MIOStatTree, GCPhys);181 pStats = (PIOMMMIOSTATS)RTAvloGCPhysGet(&pVM->iom.s.CTX_SUFF(pTrees)->MmioStatTree, GCPhys); 128 182 # ifdef IN_RING3 129 183 if (!pStats) … … 131 185 # endif 132 186 } 187 188 PDMCritSectLeave(&pVM->iom.s.EmtLock); 133 189 return pStats; 134 190 }
Note:
See TracChangeset
for help on using the changeset viewer.