VirtualBox

Changeset 14659 in vbox


Ignore:
Timestamp:
Nov 26, 2008 6:11:25 PM (16 years ago)
Author:
vboxsync
Message:

PGMR0DynMap: Fixes and logging.

File:
1 edited

Legend:

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

    r14607 r14659  
    2323*   Internal Functions                                                         *
    2424*******************************************************************************/
     25#define LOG_GROUP LOG_GROUP_PGM
    2526#include <VBox/pgm.h>
    2627#include "../PGMInternal.h"
     
    11121113        X86PGUINT       uOld2 = uOld; NOREF(uOld2);
    11131114        X86PGUINT       uNew  = (uOld & X86_PTE_G | X86_PTE_PAT | X86_PTE_PCD | X86_PTE_PWT)
    1114                               | X86_PTE_P | X86_PTE_A | X86_PTE_D
     1115                              | X86_PTE_P | X86_PTE_RW | X86_PTE_A | X86_PTE_D
    11151116                              | (HCPhys & X86_PTE_PG_MASK);
    11161117        while (!ASMAtomicCmpXchgExU32(&paPages[iFreePage].uPte.pLegacy->u, uNew, uOld, &uOld))
     
    11221123        X86PGPAEUINT    uOld2 = uOld; NOREF(uOld2);
    11231124        X86PGPAEUINT    uNew  = (uOld & X86_PTE_G | X86_PTE_PAT | X86_PTE_PCD | X86_PTE_PWT)
    1124                               | X86_PTE_P | X86_PTE_A | X86_PTE_D
     1125                              | X86_PTE_P | X86_PTE_RW | X86_PTE_A | X86_PTE_D
    11251126                              | (HCPhys & X86_PTE_PAE_PG_MASK);
    11261127        while (!ASMAtomicCmpXchgExU64(&paPages[iFreePage].uPte.pPae->u, uNew, uOld, &uOld))
    11271128            AssertMsgFailed(("uOld=%#llx uOld2=%#llx uNew=%#llx\n", uOld, uOld2, uNew));
     1129        Log6(("pgmR0DynMapPageSlow: #%x - %RHp %p %#llx\n", iFreePage, HCPhys, paPages[iFreePage].pvPage, uNew));
    11281130    }
    11291131    return iFreePage;
     
    12391241VMMDECL(void) PGMDynMapStartAutoSet(PVMCPU pVCpu)
    12401242{
     1243    Log6(("PGMDynMapStartAutoSet\n"));
    12411244    Assert(pVCpu->pgm.s.AutoSet.cEntries == PGMMAPSET_CLOSED);
    12421245    pVCpu->pgm.s.AutoSet.cEntries = 0;
     
    12551258
    12561259    /* close the set */
    1257     uint32_t    i = pVCpu->pgm.s.AutoSet.cEntries;
    1258     AssertMsg(i <= RT_ELEMENTS(pVCpu->pgm.s.AutoSet.aEntries), ("%#x (%u)\n", i, i));
    1259     pVCpu->pgm.s.AutoSet.cEntries = PGMMAPSET_CLOSED;
     1260    uint32_t    i = pSet->cEntries;
     1261    AssertMsg(i <= RT_ELEMENTS(pSet->aEntries), ("%#x (%u)\n", i, i));
     1262    pSet->cEntries = PGMMAPSET_CLOSED;
    12601263
    12611264    /* release any pages we're referencing. */
    1262     if (i != 0 && RT_LIKELY(i <= RT_ELEMENTS(pVCpu->pgm.s.AutoSet.aEntries)))
     1265    if (i != 0 && RT_LIKELY(i <= RT_ELEMENTS(pSet->aEntries)))
    12631266    {
    12641267        PPGMR0DYNMAP    pThis = g_pPGMR0DynMap;
     
    12811284        RTSpinlockRelease(pThis->hSpinlock, &Tmp);
    12821285    }
    1283 }
    1284 
    1285 
    1286 /**
    1287  * Migrates the automatic mapping set of the current vCPU if necessary.
     1286    Log6(("PGMDynMapReleaseAutoSet\n"));
     1287}
     1288
     1289
     1290/**
     1291 * Migrates the automatic mapping set of the current vCPU if it's active and
     1292 * necessary.
    12881293 *
    12891294 * This is called when re-entering the hardware assisted execution mode after a
     
    12991304{
    13001305    PPGMMAPSET  pSet = &pVCpu->pgm.s.AutoSet;
    1301     uint32_t    i = pVCpu->pgm.s.AutoSet.cEntries;
    1302     AssertMsg(i <= RT_ELEMENTS(pVCpu->pgm.s.AutoSet.aEntries), ("%#x (%u)\n", i, i));
    1303     if (i != 0 && RT_LIKELY(i <= RT_ELEMENTS(pVCpu->pgm.s.AutoSet.aEntries)))
    1304     {
    1305         PPGMR0DYNMAP    pThis = g_pPGMR0DynMap;
    1306         RTCPUID         idRealCpu = RTMpCpuId();
    1307 
    1308         while (i-- > 0)
    1309         {
    1310             Assert(pSet->aEntries[i].cRefs > 0);
    1311             uint32_t iPage = pSet->aEntries[i].iPage;
    1312             Assert(iPage < pThis->cPages);
    1313             if (RTCpuSetIsMember(&pThis->paPages[iPage].PendingSet, idRealCpu))
    1314             {
    1315                 RTCpuSetDel(&pThis->paPages[iPage].PendingSet, idRealCpu);
    1316                 ASMInvalidatePage(pThis->paPages[iPage].pvPage);
    1317             }
    1318         }
     1306    uint32_t    i = pSet->cEntries;
     1307    if (i != PGMMAPSET_CLOSED)
     1308    {
     1309        AssertMsg(i <= RT_ELEMENTS(pSet->aEntries), ("%#x (%u)\n", i, i));
     1310        if (i != 0 && RT_LIKELY(i <= RT_ELEMENTS(pSet->aEntries)))
     1311        {
     1312            PPGMR0DYNMAP    pThis = g_pPGMR0DynMap;
     1313            RTCPUID         idRealCpu = RTMpCpuId();
     1314
     1315            while (i-- > 0)
     1316            {
     1317                Assert(pSet->aEntries[i].cRefs > 0);
     1318                uint32_t iPage = pSet->aEntries[i].iPage;
     1319                Assert(iPage < pThis->cPages);
     1320                if (RTCpuSetIsMember(&pThis->paPages[iPage].PendingSet, idRealCpu))
     1321                {
     1322                    RTCpuSetDel(&pThis->paPages[iPage].PendingSet, idRealCpu);
     1323                    ASMInvalidatePage(pThis->paPages[iPage].pvPage);
     1324                }
     1325            }
     1326        }
     1327        Log6(("PGMDynMapMigrateAutoSet\n"));
    13191328    }
    13201329}
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