VirtualBox

Changeset 19329 in vbox


Ignore:
Timestamp:
May 4, 2009 2:59:32 PM (16 years ago)
Author:
vboxsync
Message:

Removed pgmPoolGetPageByHCPhys.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PGMInternal.h

    r19195 r19329  
    29262926#endif
    29272927int             pgmPoolAlloc(PVM pVM, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, uint16_t iUser, uint32_t iUserTable, PPPGMPOOLPAGE ppPage);
    2928 PPGMPOOLPAGE    pgmPoolGetPageByHCPhys(PVM pVM, RTHCPHYS HCPhys);
    29292928void            pgmPoolFree(PVM pVM, RTHCPHYS HCPhys, uint16_t iUser, uint32_t iUserTable);
    29302929void            pgmPoolFreeByPage(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint32_t iUserTable);
     
    29692968PX86PDPAE       pgmGstLazyMapPaePD(PPGMCPU pPGM, uint32_t iPdpt);
    29702969PX86PML4        pgmGstLazyMapPml4(PPGMCPU pPGM);
     2970
     2971/* Forward decl */
     2972DECLINLINE(PPGMPOOLPAGE) pgmPoolGetPage(PPGMPOOL pPool, RTHCPHYS HCPhys);
    29712973
    29722974__END_DECLS
     
    40364038
    40374039    /* Fetch the pgm pool shadow descriptor. */
    4038     PPGMPOOLPAGE    pShwPde = pgmPoolGetPageByHCPhys(PGMCPU2VM(pPGM), pPdpt->a[iPdpt].u & X86_PDPE_PG_MASK);
     4040    PPGMPOOLPAGE pShwPde = pgmPoolGetPage(PGMCPU2PGM(pPGM)->CTX_SUFF(pPool), pPdpt->a[iPdpt].u & X86_PDPE_PG_MASK);
    40394041    AssertReturn(pShwPde, NULL);
    40404042
     
    40584060
    40594061    /* Fetch the pgm pool shadow descriptor. */
    4060     PPGMPOOLPAGE    pShwPde = pgmPoolGetPageByHCPhys(PGMCPU2VM(pPGM), pPdpt->a[iPdpt].u & X86_PDPE_PG_MASK);
     4062    PPGMPOOLPAGE    pShwPde = pgmPoolGetPage(PGMCPU2PGM(pPGM)->CTX_SUFF(pPool), pPdpt->a[iPdpt].u & X86_PDPE_PG_MASK);
    40614063    AssertReturn(pShwPde, NULL);
    40624064
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r19141 r19329  
    959959
    960960    /* Fetch the pgm pool shadow descriptor. */
    961     PPGMPOOLPAGE pShwPde = pgmPoolGetPageByHCPhys(PGMCPU2VM(pPGM), pPdpt->a[iPdPt].u & X86_PDPE_PG_MASK);
     961    PPGMPOOLPAGE pShwPde = pgmPoolGetPage(PGMCPU2PGM(pPGM)->CTX_SUFF(pPool), pPdpt->a[iPdPt].u & X86_PDPE_PG_MASK);
    962962    AssertReturn(pShwPde, VERR_INTERNAL_ERROR);
    963963
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r19195 r19329  
    922922    int rc;
    923923    PVM pVM = pVCpu->CTX_SUFF(pVM);
     924    PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
    924925
    925926    LogFlow(("InvalidatePage %RGv\n", GCPtrPage));
     
    10581059
    10591060# if PGM_GST_TYPE == PGM_TYPE_AMD64
    1060     PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
    1061 
    10621061    /* Fetch the pgm pool shadow descriptor. */
    1063     PPGMPOOLPAGE pShwPdpt = pgmPoolGetPageByHCPhys(pVM, pPml4eDst->u & X86_PML4E_PG_MASK);
     1062    PPGMPOOLPAGE pShwPdpt = pgmPoolGetPage(pPool, pPml4eDst->u & X86_PML4E_PG_MASK);
    10641063    Assert(pShwPdpt);
    10651064
    10661065    /* Fetch the pgm pool shadow descriptor. */
    1067     PPGMPOOLPAGE pShwPde = pgmPoolGetPageByHCPhys(pVM, pPdptDst->a[iPdpt].u & SHW_PDPE_PG_MASK);
     1066    PPGMPOOLPAGE pShwPde = pgmPoolGetPage(pPool, pPdptDst->a[iPdpt].u & SHW_PDPE_PG_MASK);
    10681067    Assert(pShwPde);
    10691068
     
    11481147    }
    11491148# endif /* PGM_GST_TYPE == PGM_TYPE_AMD64 */
    1150 
    11511149
    11521150    /*
     
    11951193             * 4KB - page.
    11961194             */
    1197             PPGMPOOLPAGE    pShwPage = pgmPoolGetPageByHCPhys(pVM, PdeDst.u & SHW_PDE_PG_MASK);
     1195            PPGMPOOLPAGE    pShwPage = pgmPoolGetPage(pPool, PdeDst.u & SHW_PDE_PG_MASK);
    11981196            RTGCPHYS        GCPhys   = PdeSrc.u & GST_PDE_PG_MASK;
    11991197# if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE == PGM_TYPE_32BIT
     
    12411239             */
    12421240            /* Before freeing the page, check if anything really changed. */
    1243             PPGMPOOLPAGE    pShwPage = pgmPoolGetPageByHCPhys(pVM, PdeDst.u & SHW_PDE_PG_MASK);
     1241            PPGMPOOLPAGE    pShwPage = pgmPoolGetPage(pPool, PdeDst.u & SHW_PDE_PG_MASK);
    12441242            RTGCPHYS        GCPhys   = GST_GET_PDE_BIG_PG_GCPHYS(PdeSrc);
    12451243# if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE == PGM_TYPE_32BIT
     
    15971595PGM_BTH_DECL(int, SyncPage)(PVMCPU pVCpu, GSTPDE PdeSrc, RTGCPTR GCPtrPage, unsigned cPages, unsigned uErr)
    15981596{
    1599     PVM pVM = pVCpu->CTX_SUFF(pVM);
     1597    PVM      pVM = pVCpu->CTX_SUFF(pVM);
     1598    PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
    16001599    LogFlow(("SyncPage: GCPtrPage=%RGv cPages=%u uErr=%#x\n", GCPtrPage, cPages, uErr));
    16011600
     
    16521651    PX86PDEPAE      pPdeDst = &pPDDst->a[iPDDst];
    16531652# endif
    1654 
    16551653    SHWPDE          PdeDst   = *pPdeDst;
    16561654    AssertMsg(PdeDst.n.u1Present, ("%p=%llx\n", pPdeDst, (uint64_t)PdeDst.u));
    1657     PPGMPOOLPAGE    pShwPage = pgmPoolGetPageByHCPhys(pVM, PdeDst.u & SHW_PDE_PG_MASK);
     1655    PPGMPOOLPAGE    pShwPage = pgmPoolGetPage(pPool, PdeDst.u & SHW_PDE_PG_MASK);
    16581656
    16591657# if PGM_GST_TYPE == PGM_TYPE_AMD64
    16601658    /* Fetch the pgm pool shadow descriptor. */
    1661     PPGMPOOLPAGE    pShwPde  = pgmPoolGetPageByHCPhys(pVM, pPdptDst->a[iPdpt].u & X86_PDPE_PG_MASK);
     1659    PPGMPOOLPAGE    pShwPde  = pgmPoolGetPage(pPool, pPdptDst->a[iPdpt].u & X86_PDPE_PG_MASK);
    16621660    Assert(pShwPde);
    16631661# endif
     
    19001898     * Yea, I'm lazy.
    19011899     */
    1902     PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
    19031900    pgmPoolFreeByPage(pPool, pShwPage, pShwPde->idx, iPDDst);
    19041901
     
    19531950# endif
    19541951    AssertMsg(PdeDst.n.u1Present, ("%#llx\n", (uint64_t)PdeDst.u));
    1955     PPGMPOOLPAGE    pShwPage = pgmPoolGetPageByHCPhys(pVM, PdeDst.u & SHW_PDE_PG_MASK);
    1956     PSHWPT pPTDst = (PSHWPT)PGMPOOL_PAGE_2_PTR(pVM, pShwPage);
     1952    PPGMPOOLPAGE  pShwPage = pgmPoolGetPage(pPool, PdeDst.u & SHW_PDE_PG_MASK);
     1953    PSHWPT        pPTDst  = (PSHWPT)PGMPOOL_PAGE_2_PTR(pVM, pShwPage);
    19571954
    19581955    Assert(cPages == 1 || !(uErr & X86_TRAP_PF_P));
     
    20682065    int rc;
    20692066    PVM pVM = pVCpu->CTX_SUFF(pVM);
     2067    PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
    20702068
    20712069    STAM_PROFILE_START(&pVCpu->pgm.s.CTX_MID_Z(Stat,DirtyBitTracking), a);
     
    22492247                 * Map shadow page table.
    22502248                 */
    2251                 PPGMPOOLPAGE    pShwPage = pgmPoolGetPageByHCPhys(pVM, pPdeDst->u & SHW_PDE_PG_MASK);
     2249                PPGMPOOLPAGE    pShwPage = pgmPoolGetPage(pPool, pPdeDst->u & SHW_PDE_PG_MASK);
    22522250                if (pShwPage)
    22532251                {
     
    22912289                 && pPdeDst->n.u1Present)
    22922290        {
    2293             PPGMPOOLPAGE    pShwPage = pgmPoolGetPageByHCPhys(pVM, pPdeDst->u & SHW_PDE_PG_MASK);
     2291            PPGMPOOLPAGE    pShwPage = pgmPoolGetPage(pPool, pPdeDst->u & SHW_PDE_PG_MASK);
    22942292            PSHWPT          pPTDst   = (PSHWPT)PGMPOOL_PAGE_2_PTR(pVM, pShwPage);
    22952293            PSHWPTE         pPteDst  = &pPTDst->a[(GCPtrPage >> SHW_PT_SHIFT) & SHW_PT_MASK];
     
    23672365PGM_BTH_DECL(int, SyncPT)(PVMCPU pVCpu, unsigned iPDSrc, PGSTPD pPDSrc, RTGCPTR GCPtrPage)
    23682366{
    2369     PVM pVM = pVCpu->CTX_SUFF(pVM);
     2367    PVM      pVM   = pVCpu->CTX_SUFF(pVM);
     2368    PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
    23702369
    23712370    STAM_PROFILE_START(&pVCpu->pgm.s.CTX_MID_Z(Stat,SyncPT), a);
     
    24212420# if PGM_GST_TYPE == PGM_TYPE_AMD64
    24222421    /* Fetch the pgm pool shadow descriptor. */
    2423     PPGMPOOLPAGE pShwPde = pgmPoolGetPageByHCPhys(pVM, pPdptDst->a[iPdpt].u & X86_PDPE_PG_MASK);
     2422    PPGMPOOLPAGE pShwPde = pgmPoolGetPage(pPool, pPdptDst->a[iPdpt].u & X86_PDPE_PG_MASK);
    24242423    Assert(pShwPde);
    24252424# endif
     
    28362835
    28372836    /* Fetch the pgm pool shadow descriptor. */
    2838     PPGMPOOLPAGE    pShwPde = pgmPoolGetPageByHCPhys(pVM, pPdptDst->a[iPdpt].u & X86_PDPE_PG_MASK);
     2837    PPGMPOOLPAGE    pShwPde = pgmPoolGetPage(pPool, pPdptDst->a[iPdpt].u & X86_PDPE_PG_MASK);
    28392838    Assert(pShwPde);
    28402839
     
    28552854
    28562855    /* Fetch the pgm pool shadow descriptor. */
    2857     PPGMPOOLPAGE pShwPde = pgmPoolGetPageByHCPhys(pVM, pPdptDst->a[iPdpt].u & EPT_PDPTE_PG_MASK);
     2856    PPGMPOOLPAGE pShwPde = pgmPoolGetPage(pPool, pPdptDst->a[iPdpt].u & EPT_PDPTE_PG_MASK);
    28582857    Assert(pShwPde);
    28592858# endif
     
    33853384    unsigned cErrors = 0;
    33863385    PVM      pVM     = pVCpu->CTX_SUFF(pVM);
     3386    PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
    33873387
    33883388#if PGM_GST_TYPE == PGM_TYPE_PAE
     
    34553455/** @todo call the other two PGMAssert*() functions. */
    34563456
    3457 # if PGM_GST_TYPE == PGM_TYPE_AMD64 || PGM_GST_TYPE == PGM_TYPE_PAE
    3458     PPGMPOOL        pPool       = pVM->pgm.s.CTX_SUFF(pPool);
    3459 # endif
    3460 
    34613457# if PGM_GST_TYPE == PGM_TYPE_AMD64
    34623458    unsigned iPml4 = (GCPtr >> X86_PML4_SHIFT) & X86_PML4_MASK;
     
    36273623                {
    36283624                    HCPhysShw = PdeDst.u & SHW_PDE_PG_MASK;
    3629                     PPGMPOOLPAGE pPoolPage = pgmPoolGetPageByHCPhys(pVM, HCPhysShw);
     3625                    PPGMPOOLPAGE pPoolPage = pgmPoolGetPage(pPool, HCPhysShw);
    36303626                    if (!pPoolPage)
    36313627                    {
  • trunk/src/VBox/VMM/VMMAll/PGMAllMap.cpp

    r19246 r19329  
    232232    PGMMODE enmShadowMode = PGMGetShadowMode(pVCpu);
    233233    Assert(enmShadowMode <= PGMMODE_PAE_NX);
     234
     235    PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
    234236
    235237    /*
     
    310312                 * Mark the page as locked; disallow flushing.
    311313                 */
    312                 PPGMPOOLPAGE    pPoolPagePd = pgmPoolGetPageByHCPhys(pVM, pShwPdpt->a[iPdPt].u & X86_PDPE_PG_MASK);
     314                PPGMPOOLPAGE    pPoolPagePd = pgmPoolGetPage(pPool, pShwPdpt->a[iPdPt].u & X86_PDPE_PG_MASK);
    313315                AssertFatal(pPoolPagePd);
    314316                if (!pgmPoolIsPageLocked(&pVM->pgm.s, pPoolPagePd))
     
    399401# endif
    400402
     403    PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
     404
    401405    PX86PDPT pCurrentShwPdpt = NULL;
    402406    if (    PGMGetGuestMode(pVCpu) >= PGMMODE_PAE
     
    486490                    ||  !(pShwPdpt->a[iPdpt].u & PGM_PLXFLAGS_MAPPING))
    487491                {
    488                     PPGMPOOLPAGE pPoolPagePd = pgmPoolGetPageByHCPhys(pVM, pShwPdpt->a[iPdpt].u & X86_PDPE_PG_MASK);
     492                    PPGMPOOLPAGE pPoolPagePd = pgmPoolGetPage(pPool, pShwPdpt->a[iPdpt].u & X86_PDPE_PG_MASK);
    489493                    AssertFatal(pPoolPagePd);
    490494                    if (pgmPoolIsPageLocked(&pVM->pgm.s, pPoolPagePd))
     
    523527    uint32_t i = pMap->cPTs;
    524528    PGMMODE  enmShadowMode = PGMGetShadowMode(pVCpu);
     529    PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
    525530
    526531    iPDE += i;
     
    570575                           iPDE, iPdpt, iPaePDE, pMap->GCPtr, R3STRING(pMap->pszDesc) ));
    571576
    572                 PCPGMPOOLPAGE   pPoolPagePd = pgmPoolGetPageByHCPhys(pVM, pShwPdpt->a[iPdpt].u & X86_PDPE_PG_MASK);
     577                PCPGMPOOLPAGE   pPoolPagePd = pgmPoolGetPage(pPool, pShwPdpt->a[iPdpt].u & X86_PDPE_PG_MASK);
    573578                AssertFatal(pPoolPagePd);
    574579                AssertMsg(pPoolPagePd->fLocked, (".idx=%d .type=%d\n", pPoolPagePd->idx, pPoolPagePd->enmKind));
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r19319 r19329  
    39803980int pgmPoolFlushPage(PPGMPOOL pPool, PPGMPOOLPAGE pPage)
    39813981{
     3982    PVM pVM = pPool->CTX_SUFF(pVM);
     3983
    39823984    int rc = VINF_SUCCESS;
    39833985    STAM_PROFILE_START(&pPool->StatFlushPage, f);
     
    39953997    }
    39963998
     3999    pgmLock(pVM);
     4000
    39974001    /*
    39984002     * Quietly reject any attempts at flushing the currently active shadow CR3 mapping
    39994003     */
    4000     if (pgmPoolIsPageLocked(&pPool->CTX_SUFF(pVM)->pgm.s, pPage))
     4004    if (pgmPoolIsPageLocked(&pVM->pgm.s, pPage))
    40014005    {
    40024006        AssertMsg(   pPage->enmKind == PGMPOOLKIND_64BIT_PML4
     
    40094013                  || pPage->enmKind == PGMPOOLKIND_PAE_PD2_FOR_32BIT_PD
    40104014                  || pPage->enmKind == PGMPOOLKIND_PAE_PD3_FOR_32BIT_PD,
    4011                   ("Can't free the shadow CR3! (%RHp vs %RHp kind=%d\n", PGMGetHyperCR3(VMMGetCpu(pPool->CTX_SUFF(pVM))), pPage->Core.Key, pPage->enmKind));
     4015                  ("Can't free the shadow CR3! (%RHp vs %RHp kind=%d\n", PGMGetHyperCR3(VMMGetCpu(pVM)), pPage->Core.Key, pPage->enmKind));
    40124016        Log(("pgmPoolFlushPage: current active shadow CR3, rejected. enmKind=%s idx=%d\n", pgmPoolPoolKindToStr(pPage->enmKind), pPage->idx));
     4017        pgmUnlock(pVM);
    40134018        return VINF_SUCCESS;
    40144019    }
     
    40164021#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    40174022    /* Start a subset so we won't run out of mapping space. */
    4018     PVMCPU pVCpu = VMMGetCpu(pPool->CTX_SUFF(pVM));
     4023    PVMCPU pVCpu = VMMGetCpu(pVM);
    40194024    uint32_t iPrevSubset = PGMDynMapPushAutoSubset(pVCpu);
    40204025#endif
     
    40664071
    40674072    pPool->cUsedPages--;
     4073    pgmUnlock(pVM);
    40684074    STAM_PROFILE_STOP(&pPool->StatFlushPage, f);
    40694075    return rc;
     
    40844090void pgmPoolFreeByPage(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint32_t iUserTable)
    40854091{
     4092    PVM pVM = pPool->CTX_SUFF(pVM);
     4093
    40864094    STAM_PROFILE_START(&pPool->StatFree, a);
    40874095    LogFlow(("pgmPoolFreeByPage: pPage=%p:{.Key=%RHp, .idx=%d, enmKind=%s} iUser=%#x iUserTable=%#x\n",
    40884096             pPage, pPage->Core.Key, pPage->idx, pgmPoolPoolKindToStr(pPage->enmKind), iUser, iUserTable));
    40894097    Assert(pPage->idx >= PGMPOOL_IDX_FIRST);
     4098    pgmLock(pVM);
    40904099#ifdef PGMPOOL_WITH_USER_TRACKING
    40914100    pgmPoolTrackFreeUser(pPool, pPage, iUser, iUserTable);
     
    40954104#endif
    40964105        pgmPoolFlushPage(pPool, pPage);
     4106    pgmUnlock(pVM);
    40974107    STAM_PROFILE_STOP(&pPool->StatFree, a);
    40984108}
     
    43014311}
    43024312
    4303 
    4304 /**
    4305  * Gets a in-use page in the pool by it's physical address.
    4306  *
    4307  * @returns Pointer to the page.
    4308  * @param   pVM     The VM handle.
    4309  * @param   HCPhys  The HC physical address of the shadow page.
    4310  * @remark  This function will NEVER return NULL. It will assert if HCPhys is invalid.
    4311  */
    4312 PPGMPOOLPAGE pgmPoolGetPageByHCPhys(PVM pVM, RTHCPHYS HCPhys)
    4313 {
    4314     /** @todo profile this! */
    4315     PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
    4316     PPGMPOOLPAGE pPage = pgmPoolGetPage(pPool, HCPhys);
    4317 #ifndef DEBUG_bird /* extremely noisy */
    4318     Log5(("pgmPoolGetPageByHCPhys: HCPhys=%RHp -> %p:{.idx=%d .GCPhys=%RGp .enmKind=%s}\n",
    4319           HCPhys, pPage, pPage->idx, pPage->GCPhys, pgmPoolPoolKindToStr(pPage->enmKind)));
    4320 #endif
    4321     return pPage;
    4322 }
    43234313
    43244314#ifdef IN_RING3
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