VirtualBox

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


Ignore:
Timestamp:
Apr 17, 2008 9:55:26 AM (17 years ago)
Author:
vboxsync
Message:

PAE monitoring fixes

File:
1 edited

Legend:

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

    r8079 r8086  
    519519    int rc = VINF_SUCCESS;
    520520
    521 #if PGM_GST_TYPE == PGM_TYPE_32BIT \
    522  || PGM_GST_TYPE == PGM_TYPE_PAE \
    523  || PGM_GST_TYPE == PGM_TYPE_AMD64
    524 
    525521    /*
    526522     * Register/Modify write phys handler for guest's CR3 if it changed.
    527523     */
     524#if PGM_GST_TYPE == PGM_TYPE_32BIT
     525
    528526    if (pVM->pgm.s.GCPhysGstCR3Monitored != GCPhysCR3)
    529527    {
     
    555553    }
    556554
    557 #if PGM_GST_TYPE == PGM_TYPE_PAE
     555#elif PGM_GST_TYPE == PGM_TYPE_PAE
    558556    /* Monitor the PDPT page */
     557    /*
     558     * Register/Modify write phys handler for guest's CR3 if it changed.
     559     */
    559560# ifndef PGMPOOL_WITH_MIXED_PT_CR3
    560561    AssertFailed();
    561 # else
    562     rc = pgmPoolMonitorMonitorCR3(pVM->pgm.s.CTXSUFF(pPool), PGMPOOL_IDX_PDPT, GCPhysCR3);
    563562# endif
     563    if (pVM->pgm.s.GCPhysGstCR3Monitored != GCPhysCR3)
     564    {
     565        rc = pgmPoolMonitorMonitorCR3(pVM->pgm.s.CTXSUFF(pPool), PGMPOOL_IDX_PDPT, GCPhysCR3);
     566        if (VBOX_FAILURE(rc))
     567        {
     568            AssertMsgFailed(("PGMHandlerPhysicalModify/PGMR3HandlerPhysicalRegister failed, rc=%Rrc GCPhysGstCR3Monitored=%RGp GCPhysCR3=%RGp\n",
     569                             rc, pVM->pgm.s.GCPhysGstCR3Monitored, GCPhysCR3));
     570            return rc;
     571        }
     572        pVM->pgm.s.GCPhysGstCR3Monitored = GCPhysCR3;
     573    }
    564574    /*
    565575     * Do the 4 PDs.
     
    570580        {
    571581            RTGCPHYS GCPhys = CTXSUFF(pVM->pgm.s.pGstPaePDPT)->a[i].u & X86_PDPE_PG_MASK;
    572 # ifndef PGMPOOL_WITH_MIXED_PT_CR3
    573582            if (pVM->pgm.s.aGCPhysGstPaePDsMonitored[i] != GCPhys)
    574583            {
    575                 if (pVM->pgm.s.aGCPhysGstPaePDsMonitored[i] != NIL_RTGCPHYS)
    576                     rc = PGMHandlerPhysicalModify(pVM, pVM->pgm.s.aGCPhysGstPaePDsMonitored[i], GCPhys, GCPhys + PAGE_SIZE - 1);
    577                 else
    578                     rc = PGMHandlerPhysicalRegisterEx(pVM, PGMPHYSHANDLERTYPE_PHYSICAL_WRITE, GCPhys, GCPhys + PAGE_SIZE - 1,
    579                                                       pVM->pgm.s.pfnR3GstPAEWriteHandlerCR3, 0,
    580                                                       pVM->pgm.s.pfnR0GstPAEWriteHandlerCR3, 0,
    581                                                       pVM->pgm.s.pfnGCGstPAEWriteHandlerCR3, 0,
    582                                                       pVM->pgm.s.pszR3GstPAEWriteHandlerCR3);
    583                 if (VBOX_SUCCESS(rc))
    584                     pVM->pgm.s.aGCPhysGstPaePDsMonitored[i] = GCPhys;
     584                Assert(pVM->pgm.s.enmShadowMode == PGMMODE_PAE || pVM->pgm.s.enmShadowMode == PGMMODE_PAE_NX);
     585
     586                rc = pgmPoolMonitorMonitorCR3(pVM->pgm.s.CTXSUFF(pPool), PGMPOOL_IDX_PAE_PD_0 + i, GCPhys);
    585587            }
    586 # else  /* PGMPOOL_WITH_MIXED_PT_CR3 */
    587             Assert(   pVM->pgm.s.enmShadowMode == PGMMODE_PAE
    588                    || pVM->pgm.s.enmShadowMode == PGMMODE_PAE_NX);
    589 
    590             rc = pgmPoolMonitorMonitorCR3(pVM->pgm.s.CTXSUFF(pPool), PGMPOOL_IDX_PAE_PD_0 + i, GCPhys);
    591 # endif /* PGMPOOL_WITH_MIXED_PT_CR3 */
     588
    592589            if (VBOX_FAILURE(rc))
    593590            {
     
    600597        else if (pVM->pgm.s.aGCPhysGstPaePDsMonitored[i] != NIL_RTGCPHYS)
    601598        {
    602             rc = PGMHandlerPhysicalDeregister(pVM, pVM->pgm.s.aGCPhysGstPaePDsMonitored[i]);
     599            rc = pgmPoolMonitorUnmonitorCR3(pVM->pgm.s.CTXSUFF(pPool), PGMPOOL_IDX_PAE_PD_0 + i);
    603600            AssertRC(rc);
    604601            pVM->pgm.s.aGCPhysGstPaePDsMonitored[i] = NIL_RTGCPHYS;
    605602        }
    606603    }
    607 #endif /* PGM_GST_TYPE == PGM_TYPE_PAE */
    608 
     604
     605#elif PGM_GST_TYPE == PGM_TYPE_AMD64
     606    AssertFailed();
    609607#else
    610608    /* prot/real mode stub */
     
    623621{
    624622    int rc = VINF_SUCCESS;
    625 
    626 #if PGM_GST_TYPE == PGM_TYPE_32BIT \
    627  || PGM_GST_TYPE == PGM_TYPE_PAE \
    628  || PGM_GST_TYPE == PGM_TYPE_AMD64
    629623
    630624    /*
     
    634628     * before we enter GC again.
    635629     */
     630#if PGM_GST_TYPE == PGM_TYPE_32BIT
    636631    if (pVM->pgm.s.GCPhysGstCR3Monitored != NIL_RTGCPHYS)
    637632    {
     
    650645    }
    651646
    652 # if PGM_GST_TYPE == PGM_TYPE_PAE
     647#elif PGM_GST_TYPE == PGM_TYPE_PAE
    653648    /* The PDPT page */
    654649# ifndef PGMPOOL_WITH_MIXED_PT_CR3
    655650    AssertFailed();
    656 # else
    657     rc = pgmPoolMonitorUnmonitorCR3(pVM->pgm.s.CTXSUFF(pPool), PGMPOOL_IDX_PDPT);
    658     AssertRC(rc);
    659651# endif
     652
     653    if (pVM->pgm.s.GCPhysGstCR3Monitored != NIL_RTGCPHYS)
     654    {
     655        rc = pgmPoolMonitorUnmonitorCR3(pVM->pgm.s.CTXSUFF(pPool), PGMPOOL_IDX_PDPT);
     656        AssertRC(rc);
     657    }
    660658
    661659    /* The 4 PDs. */
    662660    for (unsigned i = 0; i < X86_PG_PAE_PDPE_ENTRIES; i++)
     661    {
    663662        if (pVM->pgm.s.aGCPhysGstPaePDsMonitored[i] != NIL_RTGCPHYS)
    664663        {
    665 # ifndef PGMPOOL_WITH_MIXED_PT_CR3
    666             int rc2 = PGMHandlerPhysicalDeregister(pVM, pVM->pgm.s.aGCPhysGstPaePDsMonitored[i]);
    667 # else /* PGMPOOL_WITH_MIXED_PT_CR3 */
    668664            Assert(pVM->pgm.s.enmShadowMode == PGMMODE_PAE || pVM->pgm.s.enmShadowMode == PGMMODE_PAE_NX);
    669665            int rc2 = pgmPoolMonitorUnmonitorCR3(pVM->pgm.s.CTXSUFF(pPool), PGMPOOL_IDX_PAE_PD_0 + i);
    670 # endif /* PGMPOOL_WITH_MIXED_PT_CR3 */
    671666            AssertRC(rc2);
    672667            if (VBOX_FAILURE(rc2))
     
    674669            pVM->pgm.s.aGCPhysGstPaePDsMonitored[i] = NIL_RTGCPHYS;
    675670        }
    676 # endif
    677 
     671    }
     672#elif PGM_GST_TYPE == PGM_TYPE_AMD64
     673    AssertFailed();
    678674#else
    679675    /* prot/real mode stub */
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