VirtualBox

Changeset 47739 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Aug 14, 2013 7:52:30 PM (11 years ago)
Author:
vboxsync
Message:

PGM: Added an API that IEM can use to spot MMIO and other troublesome memory in verification.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r46420 r47739  
    41164116}
    41174117
     4118
     4119/**
     4120 * Checks if the give GCPhys page requires special handling for the given access
     4121 * because it's MMIO or otherwise monitored.
     4122 *
     4123 * @returns VBox status code (no informational statuses).
     4124 * @retval  VINF_SUCCESS on success.
     4125 * @retval  VERR_PGM_PHYS_TLB_CATCH_WRITE and *ppv set if the page has a write
     4126 *          access handler of some kind.
     4127 * @retval  VERR_PGM_PHYS_TLB_CATCH_ALL if the page has a handler catching all
     4128 *          accesses or is odd in any way.
     4129 * @retval  VERR_PGM_PHYS_TLB_UNASSIGNED if the page doesn't exist.
     4130 *
     4131 * @param   pVM         Pointer to the VM.
     4132 * @param   GCPhys      The GC physical address to convert.  Since this is only
     4133 *                      used for filling the REM TLB, the A20 mask must be
     4134 *                      applied before calling this API.
     4135 * @param   fWritable   Whether write access is required.
     4136 *
     4137 * @remarks This is a watered down version PGMPhysIemGCPhys2Ptr and really just
     4138 *          a stop gap thing that should be removed once there is a better TLB
     4139 *          for virtual address accesses.
     4140 */
     4141VMM_INT_DECL(int) PGMPhysIemQueryAccess(PVM pVM, RTGCPHYS GCPhys, bool fWritable, bool fByPassHandlers)
     4142{
     4143    pgmLock(pVM);
     4144    PGM_A20_ASSERT_MASKED(VMMGetCpu(pVM), GCPhys);
     4145
     4146    PPGMRAMRANGE pRam;
     4147    PPGMPAGE pPage;
     4148    int rc = pgmPhysGetPageAndRangeEx(pVM, GCPhys, &pPage, &pRam);
     4149    if (RT_SUCCESS(rc))
     4150    {
     4151        if (PGM_PAGE_IS_BALLOONED(pPage))
     4152            rc = VERR_PGM_PHYS_TLB_CATCH_WRITE;
     4153        else if (   !PGM_PAGE_HAS_ANY_HANDLERS(pPage)
     4154                 || (fByPassHandlers && !PGM_PAGE_IS_MMIO(pPage)) )
     4155            rc = VINF_SUCCESS;
     4156        else
     4157        {
     4158            if (PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(pPage)) /* catches MMIO */
     4159            {
     4160                Assert(!fByPassHandlers || PGM_PAGE_IS_MMIO(pPage));
     4161                rc = VERR_PGM_PHYS_TLB_CATCH_ALL;
     4162            }
     4163            else if (PGM_PAGE_HAS_ACTIVE_HANDLERS(pPage) && fWritable)
     4164            {
     4165                Assert(!fByPassHandlers);
     4166                rc = VERR_PGM_PHYS_TLB_CATCH_WRITE;
     4167            }
     4168        }
     4169    }
     4170
     4171    pgmUnlock(pVM);
     4172    return rc;
     4173}
     4174
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette