VirtualBox

Changeset 43045 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Aug 28, 2012 2:21:43 PM (12 years ago)
Author:
vboxsync
Message:

PGM: Employ the 4 unused PGMPHYSPAGE bits for checksumming shared pages in strict builds.

Location:
trunk/src/VBox/VMM/VMMR0
Files:
2 edited

Legend:

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

    r42976 r43045  
    32883288    Assert(pGMM->cAllocatedPages > 0);
    32893289    Assert(!pPage->Shared.cRefs);
    3290 #if defined(VBOX_WITH_PAGE_SHARING) && defined(VBOX_STRICT) && HC_ARCH_BITS == 64
    3291     if (pPage->Shared.u14Checksum)
    3292     {
    3293         uint32_t uChecksum = gmmR0StrictPageChecksum(pGMM, pGVM, idPage);
    3294         uChecksum &= UINT32_C(0x00003fff);
    3295         AssertMsg(!uChecksum || uChecksum == pPage->Shared.u14Checksum,
    3296                   ("%#x vs %#x - idPage=%#x\n", uChecksum, pPage->Shared.u14Checksum, idPage));
    3297     }
    3298 #endif
    32993290
    33003291    pChunk->cShared--;
     
    34043395            {
    34053396                Assert(pGVM->gmm.s.Stats.cSharedPages);
     3397                Assert(pPage->Shared.cRefs);
     3398#if defined(VBOX_WITH_PAGE_SHARING) && defined(VBOX_STRICT) && HC_ARCH_BITS == 64
     3399                if (pPage->Shared.u14Checksum)
     3400                {
     3401                    uint32_t uChecksum = gmmR0StrictPageChecksum(pGMM, pGVM, idPage);
     3402                    uChecksum &= UINT32_C(0x00003fff);
     3403                    AssertMsg(!uChecksum || uChecksum == pPage->Shared.u14Checksum,
     3404                              ("%#x vs %#x - idPage=%#x\n", uChecksum, pPage->Shared.u14Checksum, idPage));
     3405                }
     3406#endif
    34063407                pGVM->gmm.s.Stats.cSharedPages--;
    3407                 Assert(pPage->Shared.cRefs);
    34083408                if (!--pPage->Shared.cRefs)
    34093409                    gmmR0FreeSharedPage(pGMM, pGVM, idPage, pPage);
     
    47064706 * @param   pPage       The page structure.
    47074707 */
    4708 DECLINLINE(void) gmmR0ConvertToSharedPage(PGMM pGMM, PGVM pGVM, RTHCPHYS HCPhys, uint32_t idPage, PGMMPAGE pPage)
     4708DECLINLINE(void) gmmR0ConvertToSharedPage(PGMM pGMM, PGVM pGVM, RTHCPHYS HCPhys, uint32_t idPage, PGMMPAGE pPage,
     4709                                          PGMMSHAREDPAGEDESC pPageDesc)
    47094710{
    47104711    PGMMCHUNK pChunk = gmmR0GetChunk(pGMM, idPage >> GMM_CHUNKID_SHIFT);
     
    47254726    pPage->Shared.cRefs       = 1;
    47264727#ifdef VBOX_STRICT
    4727     pPage->Shared.u14Checksum = gmmR0StrictPageChecksum(pGMM, pGVM, idPage);
     4728    pPageDesc->u32StrictChecksum = gmmR0StrictPageChecksum(pGMM, pGVM, idPage);
     4729    pPage->Shared.u14Checksum = pPageDesc->u32StrictChecksum;
    47284730#else
    47294731    pPage->Shared.u14Checksum = 0;
     
    47454747    AssertMsg(pPageDesc->GCPhys == (pPage->Private.pfn << 12), ("desc %RGp gmm %RGp\n", pPageDesc->HCPhys, (pPage->Private.pfn << 12)));
    47464748
    4747     gmmR0ConvertToSharedPage(pGMM, pGVM, pPageDesc->HCPhys, pPageDesc->idPage, pPage);
     4749    gmmR0ConvertToSharedPage(pGMM, pGVM, pPageDesc->HCPhys, pPageDesc->idPage, pPage, pPageDesc);
    47484750
    47494751    /* Keep track of these references. */
     
    47794781    PGMM    pGMM;
    47804782    GMM_GET_VALID_INSTANCE(pGMM, VERR_GMM_INSTANCE);
     4783    pPageDesc->u32StrictChecksum = 0;
    47814784
    47824785    AssertMsgReturn(idxRegion < pModule->cRegions,
     
    48734876    }
    48744877    uint8_t *pbSharedPage = pbChunk + ((pGlobalRegion->paidPages[idxPage] & GMM_PAGEID_IDX_MASK) << PAGE_SHIFT);
     4878
    48754879#ifdef VBOX_STRICT
    4876     if (pPage->Shared.u14Checksum)
    4877     {
    4878         uint32_t uChecksum = RTCrc32(pbSharedPage, PAGE_SIZE) & UINT32_C(0x00003fff);
    4879         AssertMsg(!uChecksum || uChecksum == pPage->Shared.u14Checksum,
    4880                   ("%#x vs %#x - idPage=%# - %s %s\n", uChecksum, pPage->Shared.u14Checksum,
    4881                    pGlobalRegion->paidPages[idxPage], pModule->szName, pModule->szVersion));
    4882     }
     4880    pPageDesc->u32StrictChecksum = RTCrc32(pbSharedPage, PAGE_SIZE);
     4881    uint32_t uChecksum = pPageDesc->u32StrictChecksum & UINT32_C(0x00003fff);
     4882    AssertMsg(!uChecksum || uChecksum == pPage->Shared.u14Checksum || !pPage->Shared.u14Checksum,
     4883              ("%#x vs %#x - idPage=%# - %s %s\n", uChecksum, pPage->Shared.u14Checksum,
     4884               pGlobalRegion->paidPages[idxPage], pModule->szName, pModule->szVersion));
    48834885#endif
    48844886
     
    49484950    RTAvlGCPtrDestroy(&pGVM->gmm.s.pSharedModuleTree, gmmR0CleanupSharedModule, &Args);
    49494951
    4950     Assert(pGVM->gmm.s.Stats.cShareableModules == 0);
     4952    AssertMsg(pGVM->gmm.s.Stats.cShareableModules == 0, ("%d\n", pGVM->gmm.s.Stats.cShareableModules));
    49514953    pGVM->gmm.s.Stats.cShareableModules = 0;
    49524954
  • trunk/src/VBox/VMM/VMMR0/PGMR0SharedPage.cpp

    r43042 r43045  
    130130                        pVM->pgm.s.cPrivatePages--;
    131131                        PGM_PAGE_SET_STATE(pVM, pPage, PGM_PAGE_STATE_SHARED);
     132
     133# ifdef VBOX_STRICT /* check sum hack */
     134                        pPage->s.u2Unused0 = PageDesc.u32StrictChecksum        & 3;
     135                        pPage->s.u2Unused1 = (PageDesc.u32StrictChecksum >> 8) & 3;
     136# endif
    132137                    }
    133138                }
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