Changeset 37424 in vbox for trunk/src/VBox/VMM/include
- Timestamp:
- Jun 12, 2011 7:28:11 PM (13 years ago)
- Location:
- trunk/src/VBox/VMM/include
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/include/IOMInternal.h
r35346 r37424 428 428 #endif 429 429 430 431 /**432 * Gets the I/O port range for the specified I/O port in the current context.433 *434 * @returns Pointer to I/O port range.435 * @returns NULL if no port registered.436 *437 * @param pIOM IOM instance data.438 * @param Port Port to lookup.439 */440 DECLINLINE(CTX_SUFF(PIOMIOPORTRANGE)) iomIOPortGetRange(PIOM pIOM, RTIOPORT Port)441 {442 #ifdef IN_RING3443 if (PDMCritSectIsInitialized(&pIOM->EmtLock))444 #endif445 Assert(IOMIsLockOwner(IOM2VM(pIOM)));446 CTX_SUFF(PIOMIOPORTRANGE) pRange = (CTX_SUFF(PIOMIOPORTRANGE))RTAvlroIOPortRangeGet(&pIOM->CTX_SUFF(pTrees)->CTX_SUFF(IOPortTree), Port);447 return pRange;448 }449 450 451 /**452 * Gets the I/O port range for the specified I/O port in the HC.453 *454 * @returns Pointer to I/O port range.455 * @returns NULL if no port registered.456 *457 * @param pIOM IOM instance data.458 * @param Port Port to lookup.459 */460 DECLINLINE(PIOMIOPORTRANGER3) iomIOPortGetRangeR3(PIOM pIOM, RTIOPORT Port)461 {462 #ifdef IN_RING3463 if (PDMCritSectIsInitialized(&pIOM->EmtLock))464 #endif465 Assert(IOMIsLockOwner(IOM2VM(pIOM)));466 PIOMIOPORTRANGER3 pRange = (PIOMIOPORTRANGER3)RTAvlroIOPortRangeGet(&pIOM->CTX_SUFF(pTrees)->IOPortTreeR3, Port);467 return pRange;468 }469 470 471 /**472 * Gets the MMIO range for the specified physical address in the current context.473 *474 * @returns Pointer to MMIO range.475 * @returns NULL if address not in a MMIO range.476 *477 * @param pIOM IOM instance data.478 * @param GCPhys Physical address to lookup.479 */480 DECLINLINE(PIOMMMIORANGE) iomMMIOGetRange(PIOM pIOM, RTGCPHYS GCPhys)481 {482 #ifdef IN_RING3483 if (PDMCritSectIsInitialized(&pIOM->EmtLock))484 #endif485 Assert(IOMIsLockOwner(IOM2VM(pIOM)));486 PIOMMMIORANGE pRange = pIOM->CTX_SUFF(pMMIORangeLast);487 if ( !pRange488 || GCPhys - pRange->GCPhys >= pRange->cb)489 pIOM->CTX_SUFF(pMMIORangeLast) = pRange = (PIOMMMIORANGE)RTAvlroGCPhysRangeGet(&pIOM->CTX_SUFF(pTrees)->MMIOTree, GCPhys);490 return pRange;491 }492 493 #ifdef VBOX_STRICT494 /**495 * Gets the MMIO range for the specified physical address in the current context.496 *497 * @returns Pointer to MMIO range.498 * @returns NULL if address not in a MMIO range.499 *500 * @param pIOM IOM instance data.501 * @param GCPhys Physical address to lookup.502 */503 DECLINLINE(PIOMMMIORANGE) iomMMIOGetRangeUnsafe(PIOM pIOM, RTGCPHYS GCPhys)504 {505 PIOMMMIORANGE pRange = pIOM->CTX_SUFF(pMMIORangeLast);506 if ( !pRange507 || GCPhys - pRange->GCPhys >= pRange->cb)508 pIOM->CTX_SUFF(pMMIORangeLast) = pRange = (PIOMMMIORANGE)RTAvlroGCPhysRangeGet(&pIOM->CTX_SUFF(pTrees)->MMIOTree, GCPhys);509 return pRange;510 }511 #endif512 513 514 #ifdef VBOX_WITH_STATISTICS515 /**516 * Gets the MMIO statistics record.517 *518 * In ring-3 this will lazily create missing records, while in GC/R0 the caller has to519 * return the appropriate status to defer the operation to ring-3.520 *521 * @returns Pointer to MMIO stats.522 * @returns NULL if not found (R0/GC), or out of memory (R3).523 *524 * @param pIOM IOM instance data.525 * @param GCPhys Physical address to lookup.526 * @param pRange The MMIO range.527 */528 DECLINLINE(PIOMMMIOSTATS) iomMMIOGetStats(PIOM pIOM, RTGCPHYS GCPhys, PIOMMMIORANGE pRange)529 {530 Assert(IOMIsLockOwner(IOM2VM(pIOM)));531 /* For large ranges, we'll put everything on the first byte. */532 if (pRange->cb > PAGE_SIZE)533 GCPhys = pRange->GCPhys;534 535 PIOMMMIOSTATS pStats = pIOM->CTX_SUFF(pMMIOStatsLast);536 if ( !pStats537 || pStats->Core.Key != GCPhys)538 {539 pStats = (PIOMMMIOSTATS)RTAvloGCPhysGet(&pIOM->CTX_SUFF(pTrees)->MMIOStatTree, GCPhys);540 # ifdef IN_RING3541 if (!pStats)542 pStats = iomR3MMIOStatsCreate(IOM2VM(pIOM), GCPhys, pRange->pszDesc);543 # endif544 }545 return pStats;546 }547 #endif548 549 430 /* IOM locking helpers. */ 550 431 int iomLock(PVM pVM);
Note:
See TracChangeset
for help on using the changeset viewer.