VirtualBox

Changeset 29222 in vbox for trunk/src


Ignore:
Timestamp:
May 7, 2010 3:34:29 PM (15 years ago)
Author:
vboxsync
Message:

Shared paging updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/GMMR0.cpp

    r29217 r29222  
    214214    struct GMMPAGESHARED
    215215    {
    216         /** The guest page frame number. (Max addressable: 2 ^ 44 - 16) */
     216        /** The host page frame number. (Max addressable: 2 ^ 44 - 16) */
    217217        uint32_t    pfn;
    218218        /** The reference count (64K VMs). */
    219219        uint32_t    cRefs : 16;
    220220        /** Reserved. Checksum or something? Two hGVMs for forking? */
    221         uint32_t    u30Reserved : 14;
     221        uint32_t    u14Reserved : 14;
    222222        /** The page state. */
    223223        uint32_t    u2State : 2;
     
    26252625 * @param   pGMM        Pointer to the GMM instance.
    26262626 * @param   pGVM        Pointer to the GVM instance.
     2627 * @param   HCPhys      Host physical address
    26272628 * @param   idPage      The Page ID
    26282629 * @param   pPage       The page structure.
    26292630 */
    2630 DECLINLINE(void) gmmR0ConvertToSharedPage(PGMM pGMM, PGVM pGVM, uint32_t idPage, PGMMPAGE pPage)
     2631DECLINLINE(void) gmmR0ConvertToSharedPage(PGMM pGMM, PGVM pGVM, RTHCPHYS HCPhys, uint32_t idPage, PGMMPAGE pPage)
    26312632{
    26322633    PGMMCHUNK pChunk = gmmR0GetChunk(pGMM, idPage >> GMM_CHUNKID_SHIFT);
     
    26442645
    26452646    /* Modify the page structure. */
    2646     pPage->Shared.pfn     = pPage->Private.pfn;     /* same location */
     2647    pPage->Shared.pfn     = (uint32_t)(HCPhys >> PAGE_SHIFT);
    26472648    pPage->Shared.cRefs   = 1;
    26482649    pPage->Common.u2State = GMM_PAGE_STATE_SHARED;
     
    37003701 *
    37013702 * Performs the following tasks:
    3702  * - if a shared page is new, then it changes the GMM page type to shared and returns it in the paHCPhysPageID array
    3703  * - if a shared page already exists, then it checks if the VM page is identical and if so frees the VM page and returns the shared page in the paHCPhysPageID array
     3703 * - if a shared page is new, then it changes the GMM page type to shared and returns it in the paPageDesc array
     3704 * - if a shared page already exists, then it checks if the VM page is identical and if so frees the VM page and returns the shared page in the paPageDesc array
    37043705 *
    37053706 * @returns VBox status code.
     
    37083709 * @param   pReq                Module description
    37093710 * @param   idxRegion           Region index
    3710  * @param   cPages              Number of entries in the paHCPhysAndPageID array
     3711 * @param   cPages              Number of entries in the paPageDesc array
    37113712 * @param   paPageDesc          Page descriptor array (in/out)
    37123713 */
     
    37693770            {
    37703771                /* We've seen this shared page for the first time? */
    3771                 if (pGlobalRegion->paHCPhysPageID[i] == NIL_GMM_PAGEID)
     3772                if (pGlobalRegion->paHCPhysPageID == NIL_GMM_PAGEID)
    37723773                {
    37733774                    /* Easy case: just change the internal page type. */
     
    37793780                        goto end;
    37803781                    }
    3781                     Log(("New shared page guest %RGp host %RHp\n", paPageDesc[i].GCPhys, (pPage->Private.pfn << 12)));
     3782                    Log(("New shared page guest %RGp host %RHp\n", paPageDesc[i].GCPhys, paPageDesc[i].HCPhys));
    37823783
    37833784                    Assert(paPageDesc[i].HCPhys == (pPage->Private.pfn << 12));
    37843785
    3785                     gmmR0ConvertToSharedPage(pGMM, pGVM, paPageDesc[i].uHCPhysPageId, pPage);
     3786                    gmmR0ConvertToSharedPage(pGMM, pGVM, paPageDesc[i].HCPhys, paPageDesc[i].uHCPhysPageId, pPage);
    37863787
    37873788                    /* Keep track of these references. */
     
    38063807                    Assert(pPage->Common.u2State == GMM_PAGE_STATE_SHARED);
    38073808
    3808                     Log(("Replace existing page guest %RGp host %RHp -> %RHp\n", paPageDesc[i].GCPhys, paPageDesc[i].HCPhys, (pPage->Private.pfn << 12)));
     3809                    Log(("Replace existing page guest %RGp host %RHp -> %RHp\n", paPageDesc[i].GCPhys, paPageDesc[i].HCPhys, pPage->Shared.pfn << PAGE_SHIFT));
    38093810
    38103811                    /* Calculate the virtual address of the local page. */
     
    38603861
    38613862                    /* Pass along the new physical address & page id. */
    3862                     paPageDesc[i].HCPhys        = (pPage->Private.pfn << 12);
     3863                    paPageDesc[i].HCPhys        = pPage->Shared.pfn << PAGE_SHIFT;
    38633864                    paPageDesc[i].uHCPhysPageId = pGlobalRegion->paHCPhysPageID[i];
    38643865                }
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