VirtualBox

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


Ignore:
Timestamp:
Jul 27, 2010 12:06:18 PM (15 years ago)
Author:
vboxsync
Message:

PGM: cache the last physical handler lookup result in each ring.

Location:
trunk/src/VBox/VMM/VMMAll
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r31123 r31136  
    162162        const RTGCPHYS  GCPhysFault = (RTGCPHYS)pvFault;
    163163# endif
    164         PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhysFault);
     164        PPGMPHYSHANDLER pCur = pgmHandlerPhysicalLookup(pVM, GCPhysFault);
    165165        if (pCur)
    166166        {
     
    212212                STAM_PROFILE_START(&pCur->Stat, h);
    213213                if (fLeaveLock)
    214                     pgmUnlock(pVM); /* @todo: Not entirely safe. */
     214                    pgmUnlock(pVM); /** @todo: Not entirely safe. */
    215215
    216216                rc = pfnHandler(pVM, uErr, pRegFrame, pvFault, GCPhysFault, pvUser);
     
    218218                    pgmLock(pVM);
    219219#  ifdef VBOX_WITH_STATISTICS
    220                 pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhysFault);
     220                pCur = pgmHandlerPhysicalLookup(pVM, GCPhysFault);
    221221                if (pCur)
    222222                    STAM_PROFILE_STOP(&pCur->Stat, h);
  • trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp

    r31123 r31136  
    55
    66/*
    7  * Copyright (C) 2006-2007 Oracle Corporation
     7 * Copyright (C) 2006-2010 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    262262
    263263        /*
    264          * Clear the page bits and notify the REM about this change.
     264         * Clear the page bits, notify the REM about this change and clear
     265         * the cache.
    265266         */
    266267        pgmHandlerPhysicalResetRamFlags(pVM, pCur);
    267268        pgmHandlerPhysicalDeregisterNotifyREM(pVM, pCur);
     269        pVM->pgm.s.pLastPhysHandlerR0 = 0;
     270        pVM->pgm.s.pLastPhysHandlerR3 = 0;
     271        pVM->pgm.s.pLastPhysHandlerRC = 0;
    268272        MMHyperFree(pVM, pCur);
    269273        pgmUnlock(pVM);
     
    575579
    576580        /*
    577          * Invalid new location, free it.
     581         * Invalid new location, flush the cache and free it.
    578582         * We've only gotta notify REM and free the memory.
    579583         */
    580584        pgmHandlerPhysicalDeregisterNotifyREM(pVM, pCur);
     585        pVM->pgm.s.pLastPhysHandlerR0 = 0;
     586        pVM->pgm.s.pLastPhysHandlerR3 = 0;
     587        pVM->pgm.s.pLastPhysHandlerRC = 0;
    581588        MMHyperFree(pVM, pCur);
    582589    }
     
    746753                        LogFlow(("PGMHandlerPhysicalJoin: %RGp-%RGp %RGp-%RGp\n",
    747754                                 pCur1->Core.Key, pCur1->Core.KeyLast, pCur2->Core.Key, pCur2->Core.KeyLast));
     755                        pVM->pgm.s.pLastPhysHandlerR0 = 0;
     756                        pVM->pgm.s.pLastPhysHandlerR3 = 0;
     757                        pVM->pgm.s.pLastPhysHandlerRC = 0;
    748758                        MMHyperFree(pVM, pCur2);
    749759                        pgmUnlock(pVM);
     
    11751185     */
    11761186    pgmLock(pVM);
    1177     PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
     1187    PPGMPHYSHANDLER pCur = pgmHandlerPhysicalLookup(pVM, GCPhys);
    11781188    if (pCur)
    11791189    {
     
    12041214{
    12051215    pgmLock(pVM);
    1206     PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
     1216    PPGMPHYSHANDLER pCur = pgmHandlerPhysicalLookup(pVM, GCPhys);
    12071217    if (!pCur)
    12081218    {
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r31123 r31136  
    17581758    {
    17591759#ifdef IN_RING3
    1760         pPhys = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
     1760        pPhys = pgmHandlerPhysicalLookup(pVM, GCPhys);
    17611761        AssertReleaseMsg(pPhys, ("GCPhys=%RGp cb=%#x\n", GCPhys, cb));
    17621762        Assert(GCPhys >= pPhys->Core.Key && GCPhys <= pPhys->Core.KeyLast);
     
    17761776        pgmLock(pVM);
    17771777# ifdef VBOX_WITH_STATISTICS
    1778         pPhys = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
     1778        pPhys = pgmHandlerPhysicalLookup(pVM, GCPhys);
    17791779        if (pPhys)
    17801780            STAM_PROFILE_STOP(&pPhys->Stat, h);
     
    19871987        ||  PGM_PAGE_IS_MMIO(pPage) /* screw virtual handlers on MMIO pages */)
    19881988    {
    1989         PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
     1989        PPGMPHYSHANDLER pCur = pgmHandlerPhysicalLookup(pVM, GCPhys);
    19901990        if (pCur)
    19911991        {
     
    20212021                pgmLock(pVM);
    20222022# ifdef VBOX_WITH_STATISTICS
    2023                 pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
     2023                pCur = pgmHandlerPhysicalLookup(pVM, GCPhys);
    20242024                if (pCur)
    20252025                    STAM_PROFILE_STOP(&pCur->Stat, h);
     
    21742174        if (fMorePhys && !pPhys)
    21752175        {
    2176             pPhys = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
     2176            pPhys = pgmHandlerPhysicalLookup(pVM, GCPhys);
    21772177            if (pPhys)
    21782178            {
     
    22332233            pgmLock(pVM);
    22342234# ifdef VBOX_WITH_STATISTICS
    2235             pPhys = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
     2235            pPhys = pgmHandlerPhysicalLookup(pVM, GCPhys);
    22362236            if (pPhys)
    22372237                STAM_PROFILE_STOP(&pPhys->Stat, h);
     
    23022302            pgmLock(pVM);
    23032303# ifdef VBOX_WITH_STATISTICS
    2304             pPhys = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
     2304            pPhys = pgmHandlerPhysicalLookup(pVM, GCPhys);
    23052305            if (pPhys)
    23062306                STAM_PROFILE_STOP(&pPhys->Stat, h);
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