VirtualBox

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


Ignore:
Timestamp:
Feb 18, 2009 3:04:16 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
43029
Message:

VBOX_WITH_PGMPOOL_PAGING_ONLY: changes for marking root pages as special.

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

Legend:

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

    r16882 r16907  
    719719        pVM->pgm.s.fSyncFlags &= ~PGM_SYNC_MONITOR_CR3;
    720720        Assert(!pVM->pgm.s.fMappingsFixed);
    721 #ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY
    722721        Assert(pVM->pgm.s.GCPhysCR3 == pVM->pgm.s.GCPhysGstCR3Monitored);
    723722        rc = PGM_GST_PFN(MonitorCR3, pVM)(pVM, pVM->pgm.s.GCPhysCR3);
    724 #endif
    725723    }
    726724
     
    16411639            {
    16421640                pVM->pgm.s.fSyncFlags &= ~PGM_SYNC_MONITOR_CR3;
    1643 #ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY
    16441641                rc = PGM_GST_PFN(MonitorCR3, pVM)(pVM, GCPhysCR3);
    1645 #endif
    16461642            }
    16471643        }
     
    16701666            pVM->pgm.s.fSyncFlags &= ~PGM_SYNC_MONITOR_CR3;
    16711667            Assert(!pVM->pgm.s.fMappingsFixed);
    1672 #ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY
    16731668            rc = PGM_GST_PFN(MonitorCR3, pVM)(pVM, GCPhysCR3);
    1674 #endif
    16751669        }
    16761670        if (fGlobal)
     
    18481842            pVM->pgm.s.fSyncFlags &= ~PGM_SYNC_MONITOR_CR3;
    18491843            Assert(!pVM->pgm.s.fMappingsFixed);
    1850 #ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY
    18511844            Assert(pVM->pgm.s.GCPhysCR3 == pVM->pgm.s.GCPhysGstCR3Monitored);
    18521845            rc = PGM_GST_PFN(MonitorCR3, pVM)(pVM, pVM->pgm.s.GCPhysCR3);
    1853 #endif
    18541846        }
    18551847    }
  • trunk/src/VBox/VMM/VMMAll/PGMAllGst.h

    r16317 r16907  
    129129PGM_GST_DECL(int, ModifyPage)(PVM pVM, RTGCPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask);
    130130PGM_GST_DECL(int, GetPDE)(PVM pVM, RTGCPTR GCPtr, PX86PDEPAE pPDE);
    131 #ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY
    132131PGM_GST_DECL(int, MonitorCR3)(PVM pVM, RTGCPHYS GCPhysCR3);
    133132PGM_GST_DECL(int, UnmonitorCR3)(PVM pVM);
    134 #endif
    135133PGM_GST_DECL(bool, HandlerVirtualUpdate)(PVM pVM, uint32_t cr4);
    136134#ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY
     
    414412
    415413
    416 #ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY
    417 
    418414#undef LOG_GROUP
    419415#define LOG_GROUP LOG_GROUP_PGM_POOL
     
    438434     * Register/Modify write phys handler for guest's CR3 if it changed.
    439435     */
     436#ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY
     437
     438    if (pVM->pgm.s.GCPhysGstCR3Monitored != GCPhysCR3)
     439    {
     440        rc = pgmPoolMonitorMonitorCR3(pVM->pgm.s.CTX_SUFF(pPool), GCPhysCR3);
     441        if (RT_FAILURE(rc))
     442        {
     443            AssertMsgFailed(("PGMHandlerPhysicalModify/PGMR3HandlerPhysicalRegister failed, rc=%Rrc GCPhysGstCR3Monitored=%RGp GCPhysCR3=%RGp\n",
     444                             rc, pVM->pgm.s.GCPhysGstCR3Monitored, GCPhysCR3));
     445            return rc;
     446        }
     447        pVM->pgm.s.GCPhysGstCR3Monitored = GCPhysCR3;
     448    }
     449
     450#if PGM_GST_TYPE == PGM_TYPE_PAE
     451    /*
     452     * Do the 4 PDs.
     453     */
     454    PX86PDPT pGuestPDPT = pgmGstGetPaePDPTPtr(&pVM->pgm.s);
     455    for (unsigned i = 0; i < X86_PG_PAE_PDPE_ENTRIES; i++)
     456    {
     457        if (pGuestPDPT->a[i].n.u1Present)
     458        {
     459            RTGCPHYS GCPhys = pGuestPDPT->a[i].u & X86_PDPE_PG_MASK;
     460            if (pVM->pgm.s.aGCPhysGstPaePDsMonitored[i] != GCPhys)
     461            {
     462                Assert(pVM->pgm.s.enmShadowMode == PGMMODE_PAE || pVM->pgm.s.enmShadowMode == PGMMODE_PAE_NX);
     463
     464                rc = pgmPoolMonitorMonitorCR3(pVM->pgm.s.CTX_SUFF(pPool), GCPhys);
     465            }
     466
     467            if (RT_FAILURE(rc))
     468            {
     469                AssertMsgFailed(("PGMHandlerPhysicalModify/PGMR3HandlerPhysicalRegister failed, rc=%Rrc GCPhysGstCR3Monitored=%RGp GCPhysCR3=%RGp\n",
     470                                 rc, pVM->pgm.s.aGCPhysGstPaePDsMonitored[i], GCPhys));
     471                return rc;
     472            }
     473            pVM->pgm.s.aGCPhysGstPaePDsMonitored[i] = GCPhys;
     474        }
     475        else if (pVM->pgm.s.aGCPhysGstPaePDsMonitored[i] != NIL_RTGCPHYS)
     476        {
     477            rc = pgmPoolMonitorUnmonitorCR3(pVM->pgm.s.CTX_SUFF(pPool), pVM->pgm.s.aGCPhysGstPaePDsMonitored[i]);
     478            AssertRC(rc);
     479            pVM->pgm.s.aGCPhysGstPaePDsMonitored[i] = NIL_RTGCPHYS;
     480        }
     481    }
     482
     483#else
     484    /* prot/real/amd64 mode stub */
     485
     486#endif
     487
     488#else
    440489#if PGM_GST_TYPE == PGM_TYPE_32BIT
    441490
     
    525574
    526575#endif
     576#endif /* VBOX_WITH_PGMPOOL_PAGING_ONLY */
    527577    return rc;
    528578}
     
    544594     * before we enter GC again.
    545595     */
     596#ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY
     597
     598    /* Unmonitor the root. (pd or pdpt) */
     599    if (pVM->pgm.s.GCPhysGstCR3Monitored != NIL_RTGCPHYS)
     600    {
     601        rc = pgmPoolMonitorUnmonitorCR3(pVM->pgm.s.CTX_SUFF(pPool), pVM->pgm.s.GCPhysGstCR3Monitored);
     602        AssertRCReturn(rc, rc);
     603        pVM->pgm.s.GCPhysGstCR3Monitored = NIL_RTGCPHYS;
     604    }
     605
     606#if PGM_GST_TYPE == PGM_TYPE_PAE
     607    /* The 4 PDs. */
     608    for (unsigned i = 0; i < X86_PG_PAE_PDPE_ENTRIES; i++)
     609    {
     610        if (pVM->pgm.s.aGCPhysGstPaePDsMonitored[i] != NIL_RTGCPHYS)
     611        {
     612            Assert(pVM->pgm.s.enmShadowMode == PGMMODE_PAE || pVM->pgm.s.enmShadowMode == PGMMODE_PAE_NX);
     613            int rc2 = pgmPoolMonitorUnmonitorCR3(pVM->pgm.s.CTX_SUFF(pPool), pVM->pgm.s.aGCPhysGstPaePDsMonitored[i]);
     614            AssertRC(rc2);
     615            if (RT_FAILURE(rc2))
     616                rc = rc2;
     617            pVM->pgm.s.aGCPhysGstPaePDsMonitored[i] = NIL_RTGCPHYS;
     618        }
     619    }
     620#else
     621    /* prot/real/amd64 mode stub */
     622#endif
     623
     624#else
     625
    546626#if PGM_GST_TYPE == PGM_TYPE_32BIT
    547627    if (pVM->pgm.s.GCPhysGstCR3Monitored != NIL_RTGCPHYS)
     
    589669    /* prot/real/amd64 mode stub */
    590670#endif
     671#endif /* VBOX_WITH_PGMPOOL_PAGING_ONLY */
    591672    return rc;
    592673
     
    595676#undef LOG_GROUP
    596677#define LOG_GROUP LOG_GROUP_PGM
    597 
    598 #endif /* VBOX_WITH_PGMPOOL_PAGING_ONLY */
    599678
    600679
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r16904 r16907  
    12351235    bool fReused = false;
    12361236    if (    (   pPage->cModifications < 48   /** @todo #define */ /** @todo need to check that it's not mapping EIP. */ /** @todo adjust this! */
    1237 #ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY
    12381237             || pPage->fCR3Mix
    1239 #endif
    12401238            )
    12411239        &&  !(fReused = pgmPoolMonitorIsReused(pVM, pPage, pRegFrame, &Cpu, pvFault))
     
    19471945            PPGMPOOLPAGE pNewHead = &pPool->aPages[pPage->iMonitoredNext];
    19481946            pNewHead->iMonitoredPrev = NIL_PGMPOOL_IDX;
    1949 #ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY
    19501947            pNewHead->fCR3Mix = pPage->fCR3Mix;
    1951 #endif
    19521948            rc = PGMHandlerPhysicalChangeCallbacks(pVM, pPage->GCPhys & ~(RTGCPHYS)(PAGE_SIZE - 1),
    19531949                                                   pPool->pfnAccessHandlerR3, MMHyperCCToR3(pVM, pNewHead),
     
    20312027 * @param   GCPhysCR3   The (new) CR3 value.
    20322028 */
     2029#ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY
     2030int pgmPoolMonitorMonitorCR3(PPGMPOOL pPool, RTGCPHYS GCPhysCR3)
     2031{
     2032    return VINF_SUCCESS;
     2033}
     2034#else
    20332035int pgmPoolMonitorMonitorCR3(PPGMPOOL pPool, uint16_t idxRoot, RTGCPHYS GCPhysCR3)
    20342036{
     
    20772079    return rc;
    20782080}
     2081#endif /* VBOX_WITH_PGMPOOL_PAGING_ONLY */
    20792082
    20802083
     
    20862089 * @param   idxRoot     The CR3 (root) page index.
    20872090 */
     2091#ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY
     2092int pgmPoolMonitorUnmonitorCR3(PPGMPOOL pPool, RTGCPHYS GCPhysCR3)
     2093{
     2094    return VINF_SUCCESS;
     2095}
     2096#else
    20882097int pgmPoolMonitorUnmonitorCR3(PPGMPOOL pPool, uint16_t idxRoot)
    20892098{
     
    21072116    return rc;
    21082117}
     2118#endif /* VBOX_WITH_PGMPOOL_PAGING_ONLY */
    21092119
    21102120# endif /* PGMPOOL_WITH_MIXED_PT_CR3 */
     
    41154125        pPage->fCached   = false;
    41164126        pPage->fReusedFlushPending = false;
     4127        pPage->fCR3Mix = false;
    41174128#ifdef PGMPOOL_WITH_USER_TRACKING
    41184129        pPage->iUserHead = NIL_PGMPOOL_USER_INDEX;
    4119 #else
    4120         pPage->fCR3Mix = false;
    41214130#endif
    41224131#ifdef PGMPOOL_WITH_CACHE
     
    45024511    pPage->fCached = false;
    45034512    pPage->fReusedFlushPending = false;
     4513    pPage->fCR3Mix = false;
    45044514#ifdef PGMPOOL_WITH_MONITORING
    45054515    pPage->cModifications = 0;
    45064516    pPage->iModifiedNext = NIL_PGMPOOL_IDX;
    45074517    pPage->iModifiedPrev = NIL_PGMPOOL_IDX;
    4508 #else
    4509     pPage->fCR3Mix = false;
    45104518#endif
    45114519#ifdef PGMPOOL_WITH_USER_TRACKING
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