Changeset 93622 in vbox
- Timestamp:
- Feb 6, 2022 3:55:04 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 149767
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/MMAll.cpp
r93621 r93622 156 156 157 157 158 /** 159 * Lookup a raw-mode context address. 160 * 161 * @returns Pointer to the corresponding lookup record. 162 * @returns NULL on failure. 163 * @param pVM The cross context VM structure. 164 * @param RCPtr The raw-mode context address to lookup. 165 * @param poff Where to store the offset into the HMA memory chunk. 166 */ 167 DECLINLINE(PMMLOOKUPHYPER) mmHyperLookupRC(PVM pVM, RTRCPTR RCPtr, uint32_t *poff) 168 { 169 /** @todo cache last lookup this stuff ain't cheap! */ 170 unsigned offRC = (RTRCUINTPTR)RCPtr - (RTGCUINTPTR)pVM->mm.s.pvHyperAreaGC; 171 PMMLOOKUPHYPER pLookup = (PMMLOOKUPHYPER)((uint8_t *)pVM->mm.s.CTX_SUFF(pHyperHeap) + pVM->mm.s.offLookupHyper); 172 for (;;) 173 { 174 const uint32_t off = offRC - pLookup->off; 175 if (off < pLookup->cb) 176 { 177 switch (pLookup->enmType) 178 { 179 case MMLOOKUPHYPERTYPE_LOCKED: 180 case MMLOOKUPHYPERTYPE_HCPHYS: 181 *poff = off; 182 return pLookup; 183 default: 184 break; 185 } 186 AssertMsgFailed(("enmType=%d\n", pLookup->enmType)); 187 *poff = 0; /* shut up gcc */ 188 return NULL; 189 } 190 191 /* next */ 192 if (pLookup->offNext == (int32_t)NIL_OFFSET) 193 break; 194 pLookup = (PMMLOOKUPHYPER)((uint8_t *)pLookup + pLookup->offNext); 195 } 196 197 AssertMsgFailed(("RCPtr=%RRv is not inside the hypervisor memory area!\n", RCPtr)); 198 *poff = 0; /* shut up gcc */ 199 return NULL; 200 } 201 202 158 #ifdef IN_RING3 203 159 /** 204 160 * Lookup a current context address. … … 212 168 DECLINLINE(PMMLOOKUPHYPER) mmHyperLookupCC(PVM pVM, void *pv, uint32_t *poff) 213 169 { 214 # ifdef IN_RING0170 # ifdef IN_RING0 215 171 return mmHyperLookupR0(pVM, pv, poff); 216 # elif defined(IN_RING3)172 # elif defined(IN_RING3) 217 173 return mmHyperLookupR3(pVM, pv, poff); 218 #else 219 # error "Neither IN_RING0 nor IN_RING3!" 220 #endif 221 } 222 223 174 # else 175 # error "Neither IN_RING0 nor IN_RING3!" 176 # endif 177 } 178 #endif 179 180 181 #ifdef IN_RING3 224 182 /** 225 183 * Calculate the host context ring-3 address of an offset into the HMA memory chunk. … … 242 200 } 243 201 } 202 #endif 244 203 245 204
Note:
See TracChangeset
for help on using the changeset viewer.