VirtualBox

Changeset 41456 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
May 28, 2012 10:11:53 AM (13 years ago)
Author:
vboxsync
Message:

PGMPool: PGMPOOLPAGE adjustments and cleanups, no real code changes intended.

Location:
trunk/src/VBox/VMM
Files:
6 edited

Legend:

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

    r41420 r41456  
    16161616
    16171617        /* Note that iPTDst can be used to index the guest PT even in the pae/32bit combo as we copy only half the table; see pgmPoolAddDirtyPage. */
    1618         pGstPT = (PGSTPT)&pPool->aDirtyPages[pShwPage->idxDirty].aPage[0];
     1618        pGstPT = (PGSTPT)&pPool->aDirtyPages[pShwPage->idxDirtyEntry].aPage[0];
    16191619        GCPhysOldPage = GST_GET_PTE_GCPHYS(pGstPT->a[iPTDst]);
    16201620        pGstPT->a[iPTDst].u = PteSrc.u;
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r41386 r41456  
    160160}
    161161
     162
    162163/**
    163164 * Process shadow entries before they are changed by the guest.
     
    174175 * @param   cbWrite     Write size; might be zero if the caller knows we're not crossing entry boundaries
    175176 */
    176 void pgmPoolMonitorChainChanging(PVMCPU pVCpu, PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTGCPHYS GCPhysFault, CTXTYPE(RTGCPTR, RTHCPTR, RTGCPTR) pvAddress, unsigned cbWrite)
     177void pgmPoolMonitorChainChanging(PVMCPU pVCpu, PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTGCPHYS GCPhysFault,
     178                                 CTXTYPE(RTGCPTR, RTHCPTR, RTGCPTR) pvAddress, unsigned cbWrite)
    177179{
    178180    AssertMsg(pPage->iMonitoredPrev == NIL_PGMPOOL_IDX, ("%u (idx=%u)\n", pPage->iMonitoredPrev, pPage->idx));
     
    690692
    691693# ifndef IN_RING3
     694
    692695/**
    693696 * Checks if a access could be a fork operation in progress.
     
    812815}
    813816
     817
    814818/**
    815819 * Flushes the page being accessed.
     
    866870    return rc;
    867871}
     872
    868873
    869874/**
     
    10241029}
    10251030
     1031
    10261032/**
    10271033 * \#PF Handler callback for PT write accesses.
     
    10361042 * @param   pvUser      User argument.
    10371043 */
    1038 DECLEXPORT(int) pgmPoolAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
     1044DECLEXPORT(int) pgmPoolAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
     1045                                     RTGCPHYS GCPhysFault, void *pvUser)
    10391046{
    10401047    STAM_PROFILE_START(&pVM->pgm.s.CTX_SUFF(pPool)->CTX_SUFF_Z(StatMonitor), a);
     
    11141121     */
    11151122    pVCpu->pgm.s.cPoolAccessHandler++;
    1116     if (    pPage->pvLastAccessHandlerRip >= pRegFrame->rip - 0x40      /* observed loops in Windows 7 x64 */
    1117         &&  pPage->pvLastAccessHandlerRip <  pRegFrame->rip + 0x40
    1118         &&  pvFault == (pPage->pvLastAccessHandlerFault + pDis->param1.size)
    1119         &&  pVCpu->pgm.s.cPoolAccessHandler == (pPage->cLastAccessHandlerCount + 1))
     1123    if (    pPage->GCPtrLastAccessHandlerRip >= pRegFrame->rip - 0x40      /* observed loops in Windows 7 x64 */
     1124        &&  pPage->GCPtrLastAccessHandlerRip <  pRegFrame->rip + 0x40
     1125        &&  pvFault == (pPage->GCPtrLastAccessHandlerFault + pDis->param1.size)
     1126        &&  pVCpu->pgm.s.cPoolAccessHandler == pPage->cLastAccessHandler + 1)
    11201127    {
    11211128        Log(("Possible page reuse cMods=%d -> %d (locked=%d type=%s)\n", pPage->cModifications, pPage->cModifications * 2, pgmPoolIsPageLocked(pPage), pgmPoolPoolKindToStr(pPage->enmKind)));
    11221129        Assert(pPage->cModifications < 32000);
    1123         pPage->cModifications           = pPage->cModifications * 2;
    1124         pPage->pvLastAccessHandlerFault = pvFault;
    1125         pPage->cLastAccessHandlerCount  = pVCpu->pgm.s.cPoolAccessHandler;
     1130        pPage->cModifications               = pPage->cModifications * 2;
     1131        pPage->GCPtrLastAccessHandlerFault = pvFault;
     1132        pPage->cLastAccessHandler           = pVCpu->pgm.s.cPoolAccessHandler;
    11261133        if (pPage->cModifications >= cMaxModifications)
    11271134        {
     
    11621169                && (pvFault & PAGE_OFFSET_MASK) == 0)
    11631170            {
    1164                 pPage->pvLastAccessHandlerFault = pvFault;
    1165                 pPage->cLastAccessHandlerCount  = pVCpu->pgm.s.cPoolAccessHandler;
    1166                 pPage->pvLastAccessHandlerRip   = pRegFrame->rip;
     1171                pPage->GCPtrLastAccessHandlerFault = pvFault;
     1172                pPage->cLastAccessHandler          = pVCpu->pgm.s.cPoolAccessHandler;
     1173                pPage->GCPtrLastAccessHandlerRip   = pRegFrame->rip;
    11671174                /* Make sure we don't kick out a page too quickly. */
    11681175                if (pPage->cModifications > 8)
    11691176                    pPage->cModifications = 2;
    11701177            }
     1178            else if (pPage->GCPtrLastAccessHandlerFault == pvFault)
     1179            {
     1180                /* ignore the 2nd write to this page table entry. */
     1181                pPage->cLastAccessHandler       = pVCpu->pgm.s.cPoolAccessHandler;
     1182            }
    11711183            else
    1172             if (pPage->pvLastAccessHandlerFault == pvFault)
    1173             {
    1174                 /* ignore the 2nd write to this page table entry. */
    1175                 pPage->cLastAccessHandlerCount  = pVCpu->pgm.s.cPoolAccessHandler;
    1176             }
    1177             else
    1178             {
    1179                 pPage->pvLastAccessHandlerFault = 0;
    1180                 pPage->pvLastAccessHandlerRip   = 0;
     1184            {
     1185                pPage->GCPtrLastAccessHandlerFault = NIL_RTGCPTR;
     1186                pPage->GCPtrLastAccessHandlerRip   = 0;
    11811187            }
    11821188
     
    12971303                        ||  rc == VERR_PAGE_NOT_PRESENT,
    12981304                        ("PGMShwModifyPage -> GCPtr=%RGv rc=%d\n", pvFault, rc));
    1299 
    1300                 pPage->pvDirtyFault = pvFault;
     1305# ifdef VBOX_STRICT
     1306                pPage->GCPtrDirtyFault = pvFault;
     1307# endif
    13011308
    13021309                STAM_PROFILE_STOP(&pVM->pgm.s.CTX_SUFF(pPool)->CTX_SUFF_Z(StatMonitor), a);
     
    14011408    AssertMsg(!cErrors, ("cErrors=%d: last rc=%d idx=%d guest %RX64 shw=%RX64 vs %RHp\n", cErrors, LastRc, LastPTE, pGstPT->a[LastPTE].u, PGMSHWPTEPAE_GET_LOG(pShwPT->a[LastPTE]), LastHCPhys));
    14021409}
     1410
    14031411
    14041412/**
     
    15361544}
    15371545
     1546
    15381547/**
    15391548 * Clear references to guest physical memory in a PAE / PAE page table.
     
    16031612}
    16041613
     1614
    16051615/**
    16061616 * Flush a dirty page
     
    16421652    uint64_t fFlags = 0;
    16431653    RTHCPHYS HCPhys;
    1644     rc = PGMShwGetPage(VMMGetCpu(pVM), pPage->pvDirtyFault, &fFlags, &HCPhys);
     1654    rc = PGMShwGetPage(VMMGetCpu(pVM), pPage->GCPtrDirtyFault, &fFlags, &HCPhys);
    16451655    AssertMsg(      (   rc == VINF_SUCCESS
    16461656                     && (!(fFlags & X86_PTE_RW) || HCPhys != pPage->Core.Key))
     
    16481658              ||    rc == VERR_PAGE_TABLE_NOT_PRESENT
    16491659              ||    rc == VERR_PAGE_NOT_PRESENT,
    1650               ("PGMShwGetPage -> GCPtr=%RGv rc=%d flags=%RX64\n", pPage->pvDirtyFault, rc, fFlags));
     1660              ("PGMShwGetPage -> GCPtr=%RGv rc=%d flags=%RX64\n", pPage->GCPtrDirtyFault, rc, fFlags));
    16511661#endif
    16521662
     
    16991709#endif
    17001710}
     1711
    17011712
    17021713# ifndef IN_RING3
     
    17501761    STAM_COUNTER_INC(&pPool->StatDirtyPage);
    17511762    pPage->fDirty                    = true;
    1752     pPage->idxDirty                  = idxFree;
     1763    pPage->idxDirtyEntry             = (uint8_t)idxFree; Assert(pPage->idxDirtyEntry == idxFree);
    17531764    pPool->aDirtyPages[idxFree].uIdx = pPage->idx;
    17541765    pPool->cDirtyPages++;
     
    17751786}
    17761787# endif /* !IN_RING3 */
     1788
    17771789
    17781790/**
     
    18071819}
    18081820
     1821
    18091822/**
    18101823 * Reset all dirty pages by reinstating page monitoring.
     
    18451858}
    18461859
     1860
    18471861/**
    18481862 * Invalidate the PT entry for the specified page
     
    18651879    }
    18661880}
     1881
    18671882
    18681883/**
     
    24432458#ifdef PGMPOOL_WITH_OPTIMIZED_DIRTY_PT
    24442459        if (pPageHead->fDirty)
    2445             pgmPoolFlushDirtyPage(pPool->CTX_SUFF(pVM), pPool, pPageHead->idxDirty, false /* do not remove */);
     2460            pgmPoolFlushDirtyPage(pPool->CTX_SUFF(pVM), pPool, pPageHead->idxDirtyEntry, false /* do not remove */);
    24462461#endif
    24472462
     
    29032918#  ifdef PGMPOOL_WITH_OPTIMIZED_DIRTY_PT
    29042919    if (pPage->fDirty)
    2905         pgmPoolFlushDirtyPage(pPool->CTX_SUFF(pVM), pPool, pPage->idxDirty, false /* do not remove */);
     2920        pgmPoolFlushDirtyPage(pPool->CTX_SUFF(pVM), pPool, pPage->idxDirtyEntry, false /* do not remove */);
    29062921#  endif
    29072922
     
    44034418
    44044419
    4405 
    44064420/**
    44074421 * Clear references to shadowed pages in a 32 bits page directory.
     
    44284442    }
    44294443}
     4444
    44304445
    44314446/**
     
    44644479    }
    44654480}
     4481
    44664482
    44674483/**
     
    47264742    PGM_DYNMAP_UNUSED_HINT_VM(pVM, pvShw);
    47274743}
     4744
    47284745
    47294746/**
     
    47944811#ifdef PGMPOOL_WITH_OPTIMIZED_DIRTY_PT
    47954812    if (pPage->fDirty)
    4796         pgmPoolFlushDirtyPage(pVM, pPool, pPage->idxDirty, false /* do not remove */);
     4813        pgmPoolFlushDirtyPage(pVM, pPool, pPage->idxDirtyEntry, false /* do not remove */);
    47974814#endif
    47984815
     
    49264943}
    49274944
     4945
    49284946/**
    49294947 * Allocates a page from the pool.
     
    50095027    pPage->fMonitored = false;
    50105028    pPage->fCached = false;
    5011 #ifdef PGMPOOL_WITH_OPTIMIZED_DIRTY_PT
    50125029    pPage->fDirty = false;
    5013 #endif
    50145030    pPage->fReusedFlushPending = false;
    50155031    pPage->cModifications = 0;
    50165032    pPage->iModifiedNext = NIL_PGMPOOL_IDX;
    50175033    pPage->iModifiedPrev = NIL_PGMPOOL_IDX;
    5018     pPage->cLocked  = 0;
    50195034    pPage->cPresent = 0;
    50205035    pPage->iFirstPresent = NIL_PGMPOOL_PRESENT_INDEX;
    5021     pPage->pvLastAccessHandlerFault = 0;
    5022     pPage->cLastAccessHandlerCount  = 0;
    5023     pPage->pvLastAccessHandlerRip   = 0;
     5036    pPage->idxDirtyEntry = 0;
     5037    pPage->GCPtrLastAccessHandlerFault = NIL_RTGCPTR;
     5038    pPage->GCPtrLastAccessHandlerRip   = NIL_RTGCPTR;
     5039    pPage->cLastAccessHandler = 0;
     5040    pPage->cLocked = 0;
     5041# ifdef VBOX_STRICT
     5042    pPage->GCPtrDirtyFault = NIL_RTGCPTR;
     5043# endif
    50245044
    50255045    /*
     
    50835103}
    50845104
     5105
    50855106/**
    50865107 * Internal worker for finding a 'in-use' shadow page give by it's physical address.
     
    51175138}
    51185139
    5119 
    51205140#ifdef IN_RING3 /* currently only used in ring 3; save some space in the R0 & GC modules (left it here as we might need it elsewhere later on) */
     5141
    51215142/**
    51225143 * Flush the specified page if present
     
    52005221    return;
    52015222}
     5223
    52025224#endif /* IN_RING3 */
    5203 
    52045225#ifdef IN_RING3
    5205 
    52065226
    52075227/**
     
    53955415    STAM_PROFILE_STOP(&pPool->StatR3Reset, a);
    53965416}
     5417
    53975418#endif /* IN_RING3 */
    53985419
    53995420#ifdef LOG_ENABLED
     5421/**
     5422 * Stringifies a PGMPOOLKIND value.
     5423 */
    54005424static const char *pgmPoolPoolKindToStr(uint8_t enmKind)
    54015425{
    5402     switch(enmKind)
    5403     {
    5404     case PGMPOOLKIND_INVALID:
    5405         return "PGMPOOLKIND_INVALID";
    5406     case PGMPOOLKIND_FREE:
    5407         return "PGMPOOLKIND_FREE";
    5408     case PGMPOOLKIND_32BIT_PT_FOR_PHYS:
    5409         return "PGMPOOLKIND_32BIT_PT_FOR_PHYS";
    5410     case PGMPOOLKIND_32BIT_PT_FOR_32BIT_PT:
    5411         return "PGMPOOLKIND_32BIT_PT_FOR_32BIT_PT";
    5412     case PGMPOOLKIND_32BIT_PT_FOR_32BIT_4MB:
    5413         return "PGMPOOLKIND_32BIT_PT_FOR_32BIT_4MB";
    5414     case PGMPOOLKIND_PAE_PT_FOR_PHYS:
    5415         return "PGMPOOLKIND_PAE_PT_FOR_PHYS";
    5416     case PGMPOOLKIND_PAE_PT_FOR_32BIT_PT:
    5417         return "PGMPOOLKIND_PAE_PT_FOR_32BIT_PT";
    5418     case PGMPOOLKIND_PAE_PT_FOR_32BIT_4MB:
    5419         return "PGMPOOLKIND_PAE_PT_FOR_32BIT_4MB";
    5420     case PGMPOOLKIND_PAE_PT_FOR_PAE_PT:
    5421         return "PGMPOOLKIND_PAE_PT_FOR_PAE_PT";
    5422     case PGMPOOLKIND_PAE_PT_FOR_PAE_2MB:
    5423         return "PGMPOOLKIND_PAE_PT_FOR_PAE_2MB";
    5424     case PGMPOOLKIND_32BIT_PD:
    5425         return "PGMPOOLKIND_32BIT_PD";
    5426     case PGMPOOLKIND_32BIT_PD_PHYS:
    5427         return "PGMPOOLKIND_32BIT_PD_PHYS";
    5428     case PGMPOOLKIND_PAE_PD0_FOR_32BIT_PD:
    5429         return "PGMPOOLKIND_PAE_PD0_FOR_32BIT_PD";
    5430     case PGMPOOLKIND_PAE_PD1_FOR_32BIT_PD:
    5431         return "PGMPOOLKIND_PAE_PD1_FOR_32BIT_PD";
    5432     case PGMPOOLKIND_PAE_PD2_FOR_32BIT_PD:
    5433         return "PGMPOOLKIND_PAE_PD2_FOR_32BIT_PD";
    5434     case PGMPOOLKIND_PAE_PD3_FOR_32BIT_PD:
    5435         return "PGMPOOLKIND_PAE_PD3_FOR_32BIT_PD";
    5436     case PGMPOOLKIND_PAE_PD_FOR_PAE_PD:
    5437         return "PGMPOOLKIND_PAE_PD_FOR_PAE_PD";
    5438     case PGMPOOLKIND_PAE_PD_PHYS:
    5439         return "PGMPOOLKIND_PAE_PD_PHYS";
    5440     case PGMPOOLKIND_PAE_PDPT_FOR_32BIT:
    5441         return "PGMPOOLKIND_PAE_PDPT_FOR_32BIT";
    5442     case PGMPOOLKIND_PAE_PDPT:
    5443         return "PGMPOOLKIND_PAE_PDPT";
    5444     case PGMPOOLKIND_PAE_PDPT_PHYS:
    5445         return "PGMPOOLKIND_PAE_PDPT_PHYS";
    5446     case PGMPOOLKIND_64BIT_PDPT_FOR_64BIT_PDPT:
    5447         return "PGMPOOLKIND_64BIT_PDPT_FOR_64BIT_PDPT";
    5448     case PGMPOOLKIND_64BIT_PDPT_FOR_PHYS:
    5449         return "PGMPOOLKIND_64BIT_PDPT_FOR_PHYS";
    5450     case PGMPOOLKIND_64BIT_PD_FOR_64BIT_PD:
    5451         return "PGMPOOLKIND_64BIT_PD_FOR_64BIT_PD";
    5452     case PGMPOOLKIND_64BIT_PD_FOR_PHYS:
    5453         return "PGMPOOLKIND_64BIT_PD_FOR_PHYS";
    5454     case PGMPOOLKIND_64BIT_PML4:
    5455         return "PGMPOOLKIND_64BIT_PML4";
    5456     case PGMPOOLKIND_EPT_PDPT_FOR_PHYS:
    5457         return "PGMPOOLKIND_EPT_PDPT_FOR_PHYS";
    5458     case PGMPOOLKIND_EPT_PD_FOR_PHYS:
    5459         return "PGMPOOLKIND_EPT_PD_FOR_PHYS";
    5460     case PGMPOOLKIND_EPT_PT_FOR_PHYS:
    5461         return "PGMPOOLKIND_EPT_PT_FOR_PHYS";
    5462     case PGMPOOLKIND_ROOT_NESTED:
    5463         return "PGMPOOLKIND_ROOT_NESTED";
     5426    switch ((PGMPOOLKIND)enmKind)
     5427    {
     5428        case PGMPOOLKIND_INVALID:
     5429            return "PGMPOOLKIND_INVALID";
     5430        case PGMPOOLKIND_FREE:
     5431            return "PGMPOOLKIND_FREE";
     5432        case PGMPOOLKIND_32BIT_PT_FOR_PHYS:
     5433            return "PGMPOOLKIND_32BIT_PT_FOR_PHYS";
     5434        case PGMPOOLKIND_32BIT_PT_FOR_32BIT_PT:
     5435            return "PGMPOOLKIND_32BIT_PT_FOR_32BIT_PT";
     5436        case PGMPOOLKIND_32BIT_PT_FOR_32BIT_4MB:
     5437            return "PGMPOOLKIND_32BIT_PT_FOR_32BIT_4MB";
     5438        case PGMPOOLKIND_PAE_PT_FOR_PHYS:
     5439            return "PGMPOOLKIND_PAE_PT_FOR_PHYS";
     5440        case PGMPOOLKIND_PAE_PT_FOR_32BIT_PT:
     5441            return "PGMPOOLKIND_PAE_PT_FOR_32BIT_PT";
     5442        case PGMPOOLKIND_PAE_PT_FOR_32BIT_4MB:
     5443            return "PGMPOOLKIND_PAE_PT_FOR_32BIT_4MB";
     5444        case PGMPOOLKIND_PAE_PT_FOR_PAE_PT:
     5445            return "PGMPOOLKIND_PAE_PT_FOR_PAE_PT";
     5446        case PGMPOOLKIND_PAE_PT_FOR_PAE_2MB:
     5447            return "PGMPOOLKIND_PAE_PT_FOR_PAE_2MB";
     5448        case PGMPOOLKIND_32BIT_PD:
     5449            return "PGMPOOLKIND_32BIT_PD";
     5450        case PGMPOOLKIND_32BIT_PD_PHYS:
     5451            return "PGMPOOLKIND_32BIT_PD_PHYS";
     5452        case PGMPOOLKIND_PAE_PD0_FOR_32BIT_PD:
     5453            return "PGMPOOLKIND_PAE_PD0_FOR_32BIT_PD";
     5454        case PGMPOOLKIND_PAE_PD1_FOR_32BIT_PD:
     5455            return "PGMPOOLKIND_PAE_PD1_FOR_32BIT_PD";
     5456        case PGMPOOLKIND_PAE_PD2_FOR_32BIT_PD:
     5457            return "PGMPOOLKIND_PAE_PD2_FOR_32BIT_PD";
     5458        case PGMPOOLKIND_PAE_PD3_FOR_32BIT_PD:
     5459            return "PGMPOOLKIND_PAE_PD3_FOR_32BIT_PD";
     5460        case PGMPOOLKIND_PAE_PD_FOR_PAE_PD:
     5461            return "PGMPOOLKIND_PAE_PD_FOR_PAE_PD";
     5462        case PGMPOOLKIND_PAE_PD_PHYS:
     5463            return "PGMPOOLKIND_PAE_PD_PHYS";
     5464        case PGMPOOLKIND_PAE_PDPT_FOR_32BIT:
     5465            return "PGMPOOLKIND_PAE_PDPT_FOR_32BIT";
     5466        case PGMPOOLKIND_PAE_PDPT:
     5467            return "PGMPOOLKIND_PAE_PDPT";
     5468        case PGMPOOLKIND_PAE_PDPT_PHYS:
     5469            return "PGMPOOLKIND_PAE_PDPT_PHYS";
     5470        case PGMPOOLKIND_64BIT_PDPT_FOR_64BIT_PDPT:
     5471            return "PGMPOOLKIND_64BIT_PDPT_FOR_64BIT_PDPT";
     5472        case PGMPOOLKIND_64BIT_PDPT_FOR_PHYS:
     5473            return "PGMPOOLKIND_64BIT_PDPT_FOR_PHYS";
     5474        case PGMPOOLKIND_64BIT_PD_FOR_64BIT_PD:
     5475            return "PGMPOOLKIND_64BIT_PD_FOR_64BIT_PD";
     5476        case PGMPOOLKIND_64BIT_PD_FOR_PHYS:
     5477            return "PGMPOOLKIND_64BIT_PD_FOR_PHYS";
     5478        case PGMPOOLKIND_64BIT_PML4:
     5479            return "PGMPOOLKIND_64BIT_PML4";
     5480        case PGMPOOLKIND_EPT_PDPT_FOR_PHYS:
     5481            return "PGMPOOLKIND_EPT_PDPT_FOR_PHYS";
     5482        case PGMPOOLKIND_EPT_PD_FOR_PHYS:
     5483            return "PGMPOOLKIND_EPT_PD_FOR_PHYS";
     5484        case PGMPOOLKIND_EPT_PT_FOR_PHYS:
     5485            return "PGMPOOLKIND_EPT_PT_FOR_PHYS";
     5486        case PGMPOOLKIND_ROOT_NESTED:
     5487            return "PGMPOOLKIND_ROOT_NESTED";
    54645488    }
    54655489    return "Unknown kind!";
    54665490}
    54675491#endif /* LOG_ENABLED*/
     5492
  • trunk/src/VBox/VMM/VMMR3/PGMPool.cpp

    r39755 r41456  
    909909}
    910910
     911
    911912/**
    912913 * Protect all pgm pool page table entries to monitor writes
     
    914915 * @param   pVM         The VM handle.
    915916 *
    916  * Remark: assumes the caller will flush all TLBs (!!)
     917 * @remarks ASSUMES the caller will flush all TLBs!!
    917918 */
    918919void pgmR3PoolWriteProtectPages(PVM pVM)
  • trunk/src/VBox/VMM/include/PGMInline.h

    r39034 r41456  
    8686
    8787
    88 
    8988/**
    9089 * Gets the PGMPAGE structure for a guest page.
     
    132131    return VINF_SUCCESS;
    133132}
    134 
    135 
    136133
    137134
     
    417414}
    418415
     416
    419417/**
    420418 * Maps the page into current context (RC and maybe R0).
     
    503501
    504502#endif /* !IN_RC */
    505 
    506503
    507504/**
     
    667664    return VINF_SUCCESS;
    668665}
     666
    669667
    670668/**
     
    11741172
    11751173#endif /* !IN_RC */
    1176 
    11771174
    11781175/**
     
    14311428}
    14321429
     1430
    14331431/**
    14341432 * Locks a page to prevent flushing (important for cr3 root pages or shadow pae pd pages).
  • trunk/src/VBox/VMM/include/PGMInternal.h

    r41437 r41456  
    21142114    R3R0PTRTYPE(void *) pvPageR3;
    21152115#endif
    2116     /** The guest physical address. */
    21172116#if HC_ARCH_BITS == 32 && GC_ARCH_BITS == 64
    21182117    uint32_t            Alignment0;
    21192118#endif
     2119    /** The guest physical address. */
    21202120    RTGCPHYS            GCPhys;
    2121 
    2122     /** Access handler statistics to determine whether the guest is (re)initializing a page table. */
    2123     RTGCPTR             pvLastAccessHandlerRip;
    2124     RTGCPTR             pvLastAccessHandlerFault;
    2125     uint64_t            cLastAccessHandlerCount;
    2126 
    21272121    /** The kind of page we're shadowing. (This is really a PGMPOOLKIND enum.) */
    21282122    uint8_t             enmKind;
    21292123    /** The subkind of page we're shadowing. (This is really a PGMPOOLACCESS enum.) */
    21302124    uint8_t             enmAccess;
     2125    /** This supplements enmKind and enmAccess */
     2126    bool                fA20Enabled : 1;
     2127
     2128    /** Used to indicate that the page is zeroed. */
     2129    bool                fZeroed : 1;
     2130    /** Used to indicate that a PT has non-global entries. */
     2131    bool                fSeenNonGlobal : 1;
     2132    /** Used to indicate that we're monitoring writes to the guest page. */
     2133    bool                fMonitored : 1;
     2134    /** Used to indicate that the page is in the cache (e.g. in the GCPhys hash).
     2135     * (All pages are in the age list.) */
     2136    bool                fCached : 1;
     2137    /** This is used by the R3 access handlers when invoked by an async thread.
     2138     * It's a hack required because of REMR3NotifyHandlerPhysicalDeregister. */
     2139    bool volatile       fReusedFlushPending : 1;
     2140    /** Used to mark the page as dirty (write monitoring is temporarily
     2141     *  off). */
     2142    bool                fDirty : 1;
     2143    bool                afPadding1 : 1+8;
     2144
    21312145    /** The index of this page. */
    21322146    uint16_t            idx;
     
    21542168    /** The previous page in the age list. */
    21552169    uint16_t            iAgePrev;
    2156     /** Used to indicate that the page is zeroed. */
    2157     bool                fZeroed;
    2158     /** Used to indicate that a PT has non-global entries. */
    2159     bool                fSeenNonGlobal;
    2160     /** Used to indicate that we're monitoring writes to the guest page. */
    2161     bool                fMonitored;
    2162     /** Used to indicate that the page is in the cache (e.g. in the GCPhys hash).
    2163      * (All pages are in the age list.) */
    2164     bool                fCached;
    2165     /** This is used by the R3 access handlers when invoked by an async thread.
    2166      * It's a hack required because of REMR3NotifyHandlerPhysicalDeregister. */
    2167     bool volatile       fReusedFlushPending;
    2168     /** Used to mark the page as dirty (write monitoring is temporarily
    2169      *  off). */
    2170     bool                fDirty;
    2171 
    2172     /** Used to indicate that this page can't be flushed. Important for cr3 root pages or shadow pae pd pages). */
    2173     uint32_t            cLocked;
    2174     uint32_t            idxDirty;
    2175     RTGCPTR             pvDirtyFault;
    2176 } PGMPOOLPAGE, *PPGMPOOLPAGE, **PPPGMPOOLPAGE;
     2170    /** Index into PGMPOOL::aDirtyPages if fDirty is set. */
     2171    uint8_t             idxDirtyEntry;
     2172
     2173    /** @name Access handler statistics to determine whether the guest is
     2174     *        (re)initializing a page table.
     2175     * @{ */
     2176    RTGCPTR             GCPtrLastAccessHandlerRip;
     2177    RTGCPTR             GCPtrLastAccessHandlerFault;
     2178    uint64_t            cLastAccessHandler;
     2179    /** @}  */
     2180    /** Used to indicate that this page can't be flushed. Important for cr3 root pages or shadow pae pd pages. */
     2181    uint32_t volatile   cLocked;
     2182#if GC_ARCH_BITS == 64
     2183    uint32_t            Alignment2;
     2184#endif
     2185# ifdef VBOX_STRICT
     2186    RTGCPTR             GCPtrDirtyFault;
     2187# endif
     2188} PGMPOOLPAGE;
     2189/** Pointer to a pool page. */
     2190typedef PGMPOOLPAGE *PPGMPOOLPAGE;
    21772191/** Pointer to a const pool page. */
    21782192typedef PGMPOOLPAGE const *PCPGMPOOLPAGE;
     2193/** Pointer to a pool page pointer. */
     2194typedef PGMPOOLPAGE **PPPGMPOOLPAGE;
    21792195
    21802196
     
    22562272    uint32_t                    u32Padding2;
    22572273# endif
    2258     /* Next available slot. */
     2274    /** Next available slot (in aDirtyPages). */
    22592275    uint32_t                    idxFreeDirtyPage;
    2260     /* Number of active dirty pages. */
     2276    /** Number of active dirty pages. */
    22612277    uint32_t                    cDirtyPages;
    2262     /* Array of current dirty pgm pool page indices. */
     2278    /** Array of current dirty pgm pool page indices. */
    22632279    struct
    22642280    {
  • trunk/src/VBox/VMM/testcase/tstVMStruct.h

    r41268 r41456  
    838838    GEN_CHECK_OFF(PGMPOOLPAGE, enmKind);
    839839    GEN_CHECK_OFF(PGMPOOLPAGE, enmAccess);
     840    //GEN_CHECK_OFF(PGMPOOLPAGE, fA20Enabled);
     841    //GEN_CHECK_OFF(PGMPOOLPAGE, fSeenNonGlobal);
     842    //GEN_CHECK_OFF(PGMPOOLPAGE, fMonitored);
     843    //GEN_CHECK_OFF(PGMPOOLPAGE, fCached);
     844    //GEN_CHECK_OFF(PGMPOOLPAGE, fReusedFlushPending);
    840845    GEN_CHECK_OFF(PGMPOOLPAGE, idx);
    841846    GEN_CHECK_OFF(PGMPOOLPAGE, iNext);
    842 #ifdef PGMPOOL_WITH_USER_TRACKING
    843847    GEN_CHECK_OFF(PGMPOOLPAGE, iUserHead);
    844848    GEN_CHECK_OFF(PGMPOOLPAGE, cPresent);
    845849    GEN_CHECK_OFF(PGMPOOLPAGE, iFirstPresent);
    846 #endif
    847 #ifdef PGMPOOL_WITH_MONITORING
    848850    GEN_CHECK_OFF(PGMPOOLPAGE, cModifications);
    849851    GEN_CHECK_OFF(PGMPOOLPAGE, iModifiedNext);
     
    851853    GEN_CHECK_OFF(PGMPOOLPAGE, iMonitoredNext);
    852854    GEN_CHECK_OFF(PGMPOOLPAGE, iMonitoredPrev);
    853 #endif
    854 #ifdef PGMPOOL_WITH_CACHE
    855855    GEN_CHECK_OFF(PGMPOOLPAGE, iAgeNext);
    856856    GEN_CHECK_OFF(PGMPOOLPAGE, iAgePrev);
    857 #endif
    858     GEN_CHECK_OFF(PGMPOOLPAGE, fZeroed);
    859     GEN_CHECK_OFF(PGMPOOLPAGE, fSeenNonGlobal);
    860     GEN_CHECK_OFF(PGMPOOLPAGE, fMonitored);
    861     GEN_CHECK_OFF(PGMPOOLPAGE, fCached);
    862     GEN_CHECK_OFF(PGMPOOLPAGE, fReusedFlushPending);
     857    GEN_CHECK_OFF(PGMPOOLPAGE, idxDirtyEntry);
     858    GEN_CHECK_OFF(PGMPOOLPAGE, GCPtrLastAccessHandlerRip);
     859    GEN_CHECK_OFF(PGMPOOLPAGE, GCPtrLastAccessHandlerFault);
     860    GEN_CHECK_OFF(PGMPOOLPAGE, cLastAccessHandler);
    863861    GEN_CHECK_OFF(PGMPOOLPAGE, cLocked);
     862#ifdef VBOX_STRICT
     863    GEN_CHECK_OFF(PGMPOOLPAGE, GCPtrDirtyFault);
     864#endif
    864865    GEN_CHECK_SIZE(PGMPOOL);
    865866    GEN_CHECK_OFF(PGMPOOL, pVMR3);
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