VirtualBox

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


Ignore:
Timestamp:
May 10, 2010 12:45:32 PM (15 years ago)
Author:
vboxsync
Message:

Clear/reset page properties correctly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PGMPhys.cpp

    r29297 r29301  
    15931593        /* Force a PGM pool flush as guest ram references have been changed. */
    15941594        /** todo; not entirely SMP safe; assuming for now the guest takes care of this internally (not touch mapped mmio while changing the mapping). */
    1595         for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
    1596         {
    1597             PVMCPU pVCpu = &pVM->aCpus[idCpu];
    1598 
    1599             pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_CLEAR_PGM_POOL;
    1600             VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
    1601         }
     1595        PVMCPU pVCpu = VMMGetCpu(pVM);
     1596        pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_CLEAR_PGM_POOL;
     1597        VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
    16021598    }
    16031599    else
     
    17721768    /* Force a PGM pool flush as guest ram references have been changed. */
    17731769    /** todo; not entirely SMP safe; assuming for now the guest takes care of this internally (not touch mapped mmio while changing the mapping). */
    1774     for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
    1775     {
    1776         PVMCPU pVCpu = &pVM->aCpus[idCpu];
    1777 
    1778         pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_CLEAR_PGM_POOL;
    1779         VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
    1780     }
     1770    PVMCPU pVCpu = VMMGetCpu(pVM);
     1771    pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_CLEAR_PGM_POOL;
     1772    VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
    17811773
    17821774    PGMPhysInvalidatePageMapTLB(pVM);
     
    21532145            PGM_PAGE_SET_TYPE(pPageDst, PGMPAGETYPE_MMIO2);
    21542146            PGM_PAGE_SET_STATE(pPageDst, PGM_PAGE_STATE_ALLOCATED);
     2147            PGM_PAGE_SET_PDE_TYPE(pPageDst, PGM_PAGE_PDE_TYPE_DONTCARE);
     2148            PGM_PAGE_SET_PTE_INDEX(pPageDst, 0);
    21552149
    21562150            pVM->pgm.s.cZeroPages--;
     
    21722166        /* Force a PGM pool flush as guest ram references have been changed. */
    21732167        /** todo; not entirely SMP safe; assuming for now the guest takes care of this internally (not touch mapped mmio while changing the mapping). */
    2174         for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
    2175         {
    2176             PVMCPU pVCpu = &pVM->aCpus[idCpu];
    2177 
    2178             pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_CLEAR_PGM_POOL;
    2179             VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
    2180         }
     2168        PVMCPU pVCpu = VMMGetCpu(pVM);
     2169        pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_CLEAR_PGM_POOL;
     2170        VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
    21812171
    21822172        pgmUnlock(pVM);
     
    22412231            pRam = pRam->pNextR3;
    22422232
    2243         RTHCPHYS const HCPhysZeroPg = pVM->pgm.s.HCPhysZeroPg;
    2244         Assert(HCPhysZeroPg != 0 && HCPhysZeroPg != NIL_RTHCPHYS);
    22452233        PPGMPAGE pPageDst = &pRam->aPages[(pCur->RamRange.GCPhys - pRam->GCPhys) >> PAGE_SHIFT];
    22462234        uint32_t cPagesLeft = pCur->RamRange.cb >> PAGE_SHIFT;
    22472235        while (cPagesLeft-- > 0)
    22482236        {
    2249             PGM_PAGE_SET_HCPHYS(pPageDst, HCPhysZeroPg);
    2250             PGM_PAGE_SET_TYPE(pPageDst, PGMPAGETYPE_RAM);
    2251             PGM_PAGE_SET_STATE(pPageDst, PGM_PAGE_STATE_ZERO);
    2252             PGM_PAGE_SET_PAGEID(pPageDst, NIL_GMM_PAGEID);
    2253             PGM_PAGE_SET_PDE_TYPE(pPageDst, PGM_PAGE_PDE_TYPE_DONTCARE);
    2254 
     2237            PGM_PAGE_INIT_ZERO(pPageDst, pVM, PGMPAGETYPE_RAM);
    22552238            pVM->pgm.s.cZeroPages++;
    22562239            pPageDst++;
     
    22802263    /* Force a PGM pool flush as guest ram references have been changed. */
    22812264    /** todo; not entirely SMP safe; assuming for now the guest takes care of this internally (not touch mapped mmio while changing the mapping). */
    2282     for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
    2283     {
    2284         PVMCPU pVCpu = &pVM->aCpus[idCpu];
    2285 
    2286         pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_CLEAR_PGM_POOL;
    2287         VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
    2288     }
     2265    PVMCPU pVCpu = VMMGetCpu(pVM);
     2266    pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_CLEAR_PGM_POOL;
     2267    VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
    22892268
    22902269    PGMPhysInvalidatePageMapTLB(pVM);
     
    26142593                    PGM_PAGE_SET_STATE(pPage,  PGM_PAGE_STATE_ALLOCATED);
    26152594                    PGM_PAGE_SET_PAGEID(pPage, pReq->aPages[iPage].idPage);
     2595                    PGM_PAGE_SET_PDE_TYPE(pPage, PGM_PAGE_PDE_TYPE_DONTCARE);
     2596                    PGM_PAGE_SET_PTE_INDEX(pPage, 0);
    26162597
    26172598                    pRomPage->Virgin = *pPage;
     
    34283409                PGM_PAGE_SET_STATE(pPage, PGM_PAGE_STATE_ALLOCATED);
    34293410                PGM_PAGE_SET_PDE_TYPE(pPage, PGM_PAGE_PDE_TYPE_PDE);
     3411                PGM_PAGE_SET_PTE_INDEX(pPage, 0);
    34303412
    34313413                /* Somewhat dirty assumption that page ids are increasing. */
     
    36463628    PGM_PAGE_SET_PAGEID(pPage, NIL_GMM_PAGEID);
    36473629    PGM_PAGE_SET_PDE_TYPE(pPage, PGM_PAGE_PDE_TYPE_DONTCARE);
     3630    PGM_PAGE_SET_PTE_INDEX(pPage, 0);
    36483631
    36493632    /* Flush physical page map TLB entry. */
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