VirtualBox

Changeset 32087 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Aug 30, 2010 12:23:05 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
65355
Message:

PGM: Account for aliased and off pages in physical handlers so that PGMR0Trap0eHandlerNPMisconfig can avoid resolving the PGMPAGE when these features are not used.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/PGMR0.cpp

    r32036 r32087  
    340340    if (RT_LIKELY(pHandler && pHandler->enmType != PGMPHYSHANDLERTYPE_PHYSICAL_WRITE))
    341341    {
    342         if (pHandler->CTX_SUFF(pfnHandler))
    343         {
    344             CTX_MID(PFNPGM,PHYSHANDLER) pfnHandler = pHandler->CTX_SUFF(pfnHandler);
    345             void                       *pvUser     = pHandler->CTX_SUFF(pvUser);
    346             STAM_PROFILE_START(&pHandler->Stat, h);
     342        /*
     343         * If the handle has aliases page or pages that have been temporarily
     344         * disabled, we'll have to take a detour to make sure we resync them
     345         * to avoid lots of unnecessary exits.
     346         */
     347        PPGMPAGE pPage;
     348        if (   (   pHandler->cAliasedPages
     349                || pHandler->cTmpOffPages)
     350            && (   (pPage = pgmPhysGetPage(&pVM->pgm.s, GCPhysFault)) == NULL
     351                || PGM_PAGE_GET_HNDL_PHYS_STATE(pPage) == PGM_PAGE_HNDL_PHYS_STATE_DISABLED)
     352           )
     353        {
     354            Log(("PGMR0Trap0eHandlerNPMisconfig: Resyncing aliases / tmp-off page at %RGp (uErr=%#x) %R[pgmpage]\n", GCPhysFault, uErr, pPage));
     355            STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->StatR0NpMiscfgSyncPage);
     356            rc = pgmShwSyncNestedPageLocked(pVCpu, GCPhysFault, 1 /*cPages*/, enmShwPagingMode);
    347357            pgmUnlock(pVM);
    348 
    349             Log6(("PGMR0Trap0eHandlerNPMisconfig: calling %p(,%#x,,%RGp,%p)\n", pfnHandler, uErr, GCPhysFault, pvUser));
    350             rc = pfnHandler(pVM, uErr == UINT32_MAX ? RTGCPTR_MAX : uErr, pRegFrame, GCPhysFault, GCPhysFault, pvUser);
     358        }
     359        else
     360        {
     361            if (pHandler->CTX_SUFF(pfnHandler))
     362            {
     363                CTX_MID(PFNPGM,PHYSHANDLER) pfnHandler = pHandler->CTX_SUFF(pfnHandler);
     364                void                       *pvUser     = pHandler->CTX_SUFF(pvUser);
     365                STAM_PROFILE_START(&pHandler->Stat, h);
     366                pgmUnlock(pVM);
     367
     368                Log6(("PGMR0Trap0eHandlerNPMisconfig: calling %p(,%#x,,%RGp,%p)\n", pfnHandler, uErr, GCPhysFault, pvUser));
     369                rc = pfnHandler(pVM, uErr == UINT32_MAX ? RTGCPTR_MAX : uErr, pRegFrame, GCPhysFault, GCPhysFault, pvUser);
    351370
    352371#ifdef VBOX_WITH_STATISTICS
    353             pgmLock(pVM);
    354             pHandler = pgmHandlerPhysicalLookup(pVM, GCPhysFault);
    355             if (pHandler)
    356                 STAM_PROFILE_STOP(&pHandler->Stat, h);
    357             pgmUnlock(pVM);
     372                pgmLock(pVM);
     373                pHandler = pgmHandlerPhysicalLookup(pVM, GCPhysFault);
     374                if (pHandler)
     375                    STAM_PROFILE_STOP(&pHandler->Stat, h);
     376                pgmUnlock(pVM);
    358377#endif
    359         }
    360         else
    361         {
    362             pgmUnlock(pVM);
    363             Log(("PGMR0Trap0eHandlerNPMisconfig: %RGp (uErr=%#x) -> R3\n", GCPhysFault, uErr));
    364             rc = VINF_EM_RAW_EMULATE_INSTR;
     378            }
     379            else
     380            {
     381                pgmUnlock(pVM);
     382                Log(("PGMR0Trap0eHandlerNPMisconfig: %RGp (uErr=%#x) -> R3\n", GCPhysFault, uErr));
     383                rc = VINF_EM_RAW_EMULATE_INSTR;
     384            }
    365385        }
    366386    }
     
    369389        /*
    370390         * Must be out of sync, so do a SyncPage and restart the instruction.
     391         *
     392         * ASSUMES that ALL handlers are page aligned and covers whole pages
     393         * (assumption asserted in PGMHandlerPhysicalRegisterEx).
    371394         */
    372395        Log(("PGMR0Trap0eHandlerNPMisconfig: Out of sync page at %RGp (uErr=%#x)\n", GCPhysFault, uErr));
Note: See TracChangeset for help on using the changeset viewer.

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