VirtualBox

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


Ignore:
Timestamp:
Oct 7, 2020 7:02:36 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
140785
Message:

VMM/PGMPool: Working on eliminating page table bitfield use. bugref:9841 bugref:9746

File:
1 edited

Legend:

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

    r86472 r86475  
    265265                    for (unsigned i = 0; i < 2; i++)
    266266                    {
    267                         if (uShw.pPDPae->a[iShw+i].n.u1Present)
     267                        X86PGPAEUINT const uPde = uShw.pPDPae->a[iShw + i].u;
     268                        if (uPde & X86_PDE_P)
    268269                        {
    269                             LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw=%#x: %RX64 -> freeing it!\n", iShw+i, uShw.pPDPae->a[iShw+i].u));
    270                             pgmPoolFree(pVM,
    271                                         uShw.pPDPae->a[iShw+i].u & X86_PDE_PAE_PG_MASK,
    272                                         pPage->idx,
    273                                         iShw + i);
    274                             ASMAtomicWriteU64(&uShw.pPDPae->a[iShw+i].u, 0);
     270                            LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw=%#x: %RX64 -> freeing it!\n", iShw + i, uPde));
     271                            pgmPoolFree(pVM, uPde & X86_PDE_PAE_PG_MASK, pPage->idx, iShw + i);
     272                            ASMAtomicWriteU64(&uShw.pPDPae->a[iShw + i].u, 0);
    275273                        }
    276274
     
    282280                            if (iShw2 < RT_ELEMENTS(uShw.pPDPae->a))
    283281                            {
    284                                 if (uShw.pPDPae->a[iShw2].n.u1Present)
     282                                X86PGPAEUINT const uPde2 = uShw.pPDPae->a[iShw2].u;
     283                                if (uPde2 & X86_PDE_P)
    285284                                {
    286                                     LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw=%#x: %RX64 -> freeing it!\n", iShw2, uShw.pPDPae->a[iShw2].u));
    287                                     pgmPoolFree(pVM,
    288                                                 uShw.pPDPae->a[iShw2].u & X86_PDE_PAE_PG_MASK,
    289                                                 pPage->idx,
    290                                                 iShw2);
     285                                    LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw=%#x: %RX64 -> freeing it!\n", iShw2, uPde2));
     286                                    pgmPoolFree(pVM, uPde2 & X86_PDE_PAE_PG_MASK, pPage->idx, iShw2);
    291287                                    ASMAtomicWriteU64(&uShw.pPDPae->a[iShw2].u, 0);
    292288                                }
     
    400396                 * table entries -> recheck; probably only applies to the RC case.)
    401397                 */
    402                 if (uShw.pPDPae->a[iShw].n.u1Present)
     398                X86PGPAEUINT const uPde = uShw.pPDPae->a[iShw].u;
     399                if (uPde & X86_PDE_P)
    403400                {
    404                     LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw=%#x: %RX64 -> freeing it!\n", iShw, uShw.pPDPae->a[iShw].u));
    405                     pgmPoolFree(pVM,
    406                                 uShw.pPDPae->a[iShw].u & X86_PDE_PAE_PG_MASK,
    407                                 pPage->idx,
    408                                 iShw);
     401                    LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw=%#x: %RX64 -> freeing it!\n", iShw, uPde));
     402                    pgmPoolFree(pVM, uPde & X86_PDE_PAE_PG_MASK, pPage->idx, iShw);
    409403                    ASMAtomicWriteU64(&uShw.pPDPae->a[iShw].u, 0);
    410404                }
     
    417411                    AssertBreak(iShw2 < RT_ELEMENTS(uShw.pPDPae->a));
    418412
    419                     if (uShw.pPDPae->a[iShw2].n.u1Present)
     413                    X86PGPAEUINT const uPde2 = uShw.pPDPae->a[iShw2].u;
     414                    if (uPde2 & X86_PDE_P)
    420415                    {
    421                         LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw2=%#x: %RX64 -> freeing it!\n", iShw2, uShw.pPDPae->a[iShw2].u));
    422                         pgmPoolFree(pVM,
    423                                     uShw.pPDPae->a[iShw2].u & X86_PDE_PAE_PG_MASK,
    424                                     pPage->idx,
    425                                     iShw2);
     416                        LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw2=%#x: %RX64 -> freeing it!\n", iShw2, uPde2));
     417                        pgmPoolFree(pVM, uPde2 & X86_PDE_PAE_PG_MASK, pPage->idx, iShw2);
    426418                        ASMAtomicWriteU64(&uShw.pPDPae->a[iShw2].u, 0);
    427419                    }
     
    479471                uShw.pv = PGMPOOL_PAGE_2_PTR(pVM, pPage);
    480472                const unsigned iShw = off / sizeof(X86PDEPAE);
     473                X86PGPAEUINT const uPde = uShw.pPDPae->a[iShw].u;
    481474#ifndef PGM_WITHOUT_MAPPINGS
    482                 Assert(!(uShw.pPDPae->a[iShw].u & PGM_PDFLAGS_MAPPING));
     475                Assert(!(uPde & PGM_PDFLAGS_MAPPING));
    483476#endif
    484                 if (uShw.pPDPae->a[iShw].n.u1Present)
     477                if (uPde & X86_PDE_P)
    485478                {
    486                     LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw=%#x: %RX64 -> freeing it!\n", iShw, uShw.pPDPae->a[iShw].u));
    487                     pgmPoolFree(pVM,
    488                                 uShw.pPDPae->a[iShw].u & X86_PDE_PAE_PG_MASK,
    489                                 pPage->idx,
    490                                 iShw);
     479                    LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw=%#x: %RX64 -> freeing it!\n", iShw, uPde));
     480                    pgmPoolFree(pVM, uPde & X86_PDE_PAE_PG_MASK, pPage->idx, iShw);
    491481                    ASMAtomicWriteU64(&uShw.pPDPae->a[iShw].u, 0);
    492482                }
     483
    493484                /* paranoia / a bit assumptive. */
    494485                if (    (off & 7)
     
    497488                    const unsigned iShw2 = (off + cbWrite - 1) / sizeof(X86PDEPAE);
    498489                    AssertBreak(iShw2 < RT_ELEMENTS(uShw.pPDPae->a));
    499 
     490                    X86PGPAEUINT const uPde2 = uShw.pPDPae->a[iShw2].u;
    500491#ifndef PGM_WITHOUT_MAPPINGS
    501                     Assert(!(uShw.pPDPae->a[iShw2].u & PGM_PDFLAGS_MAPPING));
     492                    Assert(!(uPde2 & PGM_PDFLAGS_MAPPING));
    502493#endif
    503                     if (uShw.pPDPae->a[iShw2].n.u1Present)
     494                    if (uPde2 & X86_PDE_P)
    504495                    {
    505                         LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw2=%#x: %RX64 -> freeing it!\n", iShw2, uShw.pPDPae->a[iShw2].u));
    506                         pgmPoolFree(pVM,
    507                                     uShw.pPDPae->a[iShw2].u & X86_PDE_PAE_PG_MASK,
    508                                     pPage->idx,
    509                                     iShw2);
     496                        LogFlow(("pgmPoolMonitorChainChanging: pae pd iShw2=%#x: %RX64 -> freeing it!\n", iShw2, uPde2));
     497                        pgmPoolFree(pVM, uPde2 & X86_PDE_PAE_PG_MASK, pPage->idx, iShw2);
    510498                        ASMAtomicWriteU64(&uShw.pPDPae->a[iShw2].u, 0);
    511499                    }
     
    45224510    for (unsigned i = 0; i < RT_ELEMENTS(pShwPD->a); i++)
    45234511    {
    4524         if (   pShwPD->a[i].n.u1Present
     4512        X86PGPAEUINT const uPde = pShwPD->a[i].u;
    45254513#ifndef PGM_WITHOUT_MAPPINGS
    4526             && !(pShwPD->a[i].u & PGM_PDFLAGS_MAPPING)
     4514        if ((uPde & (X86_PDE_P | PGM_PDFLAGS_MAPPING)) == X86_PDE_P)
     4515#else
     4516        if (uPde & X86_PDE_P)
    45274517#endif
    4528            )
    45294518        {
    45304519#ifdef PGM_WITH_LARGE_PAGES
    4531             if (pShwPD->a[i].b.u1Size)
     4520            if (uPde & X86_PDE_PS)
    45324521            {
    45334522                Log4(("pgmPoolTrackDerefPDPae: i=%d pde=%RX64 GCPhys=%RX64\n",
    4534                       i, pShwPD->a[i].u & X86_PDE2M_PAE_PG_MASK, pPage->GCPhys));
    4535                 pgmPoolTracDerefGCPhys(pPool, pPage, pShwPD->a[i].u & X86_PDE2M_PAE_PG_MASK,
     4523                      i, uPde & X86_PDE2M_PAE_PG_MASK, pPage->GCPhys));
     4524                pgmPoolTracDerefGCPhys(pPool, pPage, uPde & X86_PDE2M_PAE_PG_MASK,
    45364525                                       pPage->GCPhys + i * 2 * _1M /* pPage->GCPhys = base address of the memory described by the PD */,
    45374526                                       i);
     
    45404529#endif
    45414530            {
    4542                 Assert((pShwPD->a[i].u & (X86_PDE_PAE_MBZ_MASK_NX | UINT64_C(0x7ff0000000000000))) == 0);
    4543                 PPGMPOOLPAGE pSubPage = (PPGMPOOLPAGE)RTAvloHCPhysGet(&pPool->HCPhysTree, pShwPD->a[i].u & X86_PDE_PAE_PG_MASK);
     4531                Assert((uPde & (X86_PDE_PAE_MBZ_MASK_NX | UINT64_C(0x7ff0000000000000))) == 0);
     4532                PPGMPOOLPAGE pSubPage = (PPGMPOOLPAGE)RTAvloHCPhysGet(&pPool->HCPhysTree, uPde & X86_PDE_PAE_PG_MASK);
    45444533                if (pSubPage)
    45454534                    pgmPoolTrackFreeUser(pPool, pSubPage, pPage->idx, i);
    45464535                else
    4547                     AssertFatalMsgFailed(("%RX64\n", pShwPD->a[i].u & X86_PDE_PAE_PG_MASK));
     4536                    AssertFatalMsgFailed(("%RX64\n", uPde & X86_PDE_PAE_PG_MASK));
    45484537                /** @todo 64-bit guests: have to ensure that we're not exhausting the dynamic mappings! */
    45494538            }
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