VirtualBox

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


Ignore:
Timestamp:
Feb 8, 2010 3:07:04 PM (15 years ago)
Author:
vboxsync
Message:

Introducing PGMR3PhysFreeRamPages

File:
1 edited

Legend:

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

    r26259 r26330  
    758758        GCPhys += PAGE_SIZE;
    759759        pPageDst++;
     760    }
     761
     762    if (cPendingPages)
     763    {
     764        rc = GMMR3FreePagesPerform(pVM, pReq, cPendingPages);
     765        AssertLogRelRCReturn(rc, rc);
     766    }
     767    GMMR3FreePagesCleanup(pReq);
     768
     769    return rc;
     770}
     771
     772/**
     773 * Frees a range of ram pages, replacing them with ZERO pages
     774 *
     775 * @returns VBox status code.
     776 * @param   pVM         The VM handle.
     777 * @param   cPages      Number of pages to free
     778 * @param   paPhysPage  Array of guest physical addresses
     779 */
     780VMMR3DECL(int) PGMR3PhysFreeRamPages(PVM pVM, unsigned cPages, RTGCPHYS *paPhysPage)
     781{
     782    uint32_t            cPendingPages = 0;
     783    PGMMFREEPAGESREQ    pReq;
     784    int rc = GMMR3FreePagesPrepare(pVM, &pReq, PGMPHYS_FREE_PAGE_BATCH_SIZE, GMMACCOUNT_BASE);
     785    AssertLogRelRCReturn(rc, rc);
     786
     787    /* Itegerate the pages. */
     788    for (unsigned i = 0; i < cPages; i++)
     789    {
     790        PPGMPAGE pPage = pgmPhysGetPage(&pVM->pgm.s, paPhysPage[i]);
     791        if (    pPage == NULL
     792            ||  pPage->uTypeY != PGMPAGETYPE_RAM)
     793        {
     794            Log(("PGMR3PhysFreePageRange: invalid physical page %RGp pPage->u3Type=%d\n", paPhysPage[i], (pPage) ? pPage->uTypeY : 0));
     795            break;
     796        }
     797
     798        rc = pgmPhysFreePage(pVM, pReq, &cPendingPages, pPage, paPhysPage[i]);
     799        AssertLogRelRCReturn(rc, rc); /* We're done for if this goes wrong. */
    760800    }
    761801
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