VirtualBox

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


Ignore:
Timestamp:
May 5, 2010 4:12:10 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
61150
Message:

More updates

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

Legend:

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

    r29024 r29091  
    33993399    if (GMM_CHECK_SANITY_UPON_ENTERING(pGMM))
    34003400    {
     3401        bool fNewModule = false;
     3402
    34013403        /* Check if this module is already locally registered. */
    34023404        PGMMSHAREDMODULEPERVM pRecVM = (PGMMSHAREDMODULEPERVM)RTAvlGCPtrGet(&pGVM->gmm.s.pSharedModuleTree, GCBaseAddr);
     
    34153417            bool ret = RTAvlGCPtrInsert(&pGVM->gmm.s.pSharedModuleTree, &pRecVM->Core);
    34163418            Assert(ret);
     3419
     3420            fNewModule = true;
    34173421        }
    34183422        else
     
    34233427        if (!pRec)
    34243428        {
    3425             Assert(rc != VINF_PGM_SHARED_MODULE_ALREADY_REGISTERED);
     3429            Assert(fNewModule);
    34263430            Assert(!pRecVM->fCollision);
    34273431
     
    34663470                pRecVM->pSharedModule = pRec;
    34673471                pRecVM->fCollision    = false;
    3468                 pRec->cUsers++;
     3472                if (fNewModule)
     3473                    pRec->cUsers++;
    34693474                rc = VINF_SUCCESS;
    34703475            }
  • trunk/src/VBox/VMM/VMMR0/PGMR0.cpp

    r28800 r29091  
    300300}
    301301
     302#ifdef VBOX_WITH_PAGE_SHARING
     303/**
     304 * Check a registered module for shared page changes
     305 *
     306 * @returns The following VBox status codes.
     307 *
     308 * @param   pVM         The VM handle.
     309 * @param   pVCpu       The VMCPU handle.
     310 * @param   pReq        Module request packet
     311 */
     312VMMR0DECL(int) PGMR0SharedModuleCheck(PVM pVM, PVMCPU pVCpu, PGMMREGISTERSHAREDMODULEREQ pReq)
     313{
     314    int rc = VINF_SUCCESS;
     315
     316    /*
     317     * Validate input.
     318     */
     319    AssertPtrReturn(pReq, VERR_INVALID_POINTER);
     320    AssertMsgReturn(pReq->Hdr.cbReq >= sizeof(*pReq) && pReq->Hdr.cbReq == RT_UOFFSETOF(GMMREGISTERSHAREDMODULEREQ, aRegions[pReq->cRegions]), ("%#x != %#x\n", pReq->Hdr.cbReq, sizeof(*pReq)), VERR_INVALID_PARAMETER);
     321
     322    pgmLock(pVM);
     323
     324    /* Check every region of the shared module. */
     325    for (unsigned i = 0; i < pReq->cRegions; i++)
     326    {
     327        Assert((pReq->aRegions[i].cbRegion & 0xfff) == 0);
     328        Assert((pReq->aRegions[i].GCRegionAddr & 0xfff) == 0);
     329
     330        RTGCPTR GCRegion  = pReq->aRegions[i].GCRegionAddr;
     331        uint32_t cbRegion = pReq->aRegions[i].cbRegion & ~0xfff;
     332
     333        while (cbRegion)
     334        {
     335            RTGCPHYS GCPhys;
     336            uint64_t fFlags;
     337
     338            rc = PGMGstGetPage(pVCpu, GCRegion, &GCPhys, &fFlags);
     339            if (    rc == VINF_SUCCESS
     340                &&  !(fFlags & X86_PTE_RW))
     341            {
     342                PPGMPAGE pPage = pgmPhysGetPage(&pVM->pgm.s, GCPhys);
     343                if (    pPage
     344                    &&  !PGM_PAGE_IS_SHARED(pPage))
     345                {
     346                }
     347            }
     348
     349            GCRegion += PAGE_SIZE;
     350            cbRegion -= PAGE_SIZE;
     351        }
     352    }
     353
     354    pgmUnlock(pVM);
     355    return rc;
     356}
     357#endif
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r28974 r29091  
    877877            return PGMR0PhysAllocateLargeHandyPage(pVM, &pVM->aCpus[idCpu]);
    878878
     879#ifdef VBOX_WITH_PAGE_SHARING
     880        case VMMR0_DO_PGM_CHECK_SHARED_MODULE:
     881        {
     882            if (idCpu == NIL_VMCPUID)
     883                return VERR_INVALID_CPU_ID;
     884
     885            PVMCPU pVCpu = &pVM->aCpus[idCpu];
     886
     887            /* Select a valid VCPU context. */
     888            ASMAtomicWriteU32(&pVCpu->idHostCpu, RTMpCpuId());
     889
     890            int rc = PGMR0SharedModuleCheck(pVM, pVCpu, (PGMMREGISTERSHAREDMODULEREQ)pReqHdr);
     891
     892            /* Clear the VCPU context. */
     893            ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
     894            return rc;
     895        }
     896#endif
     897
    879898        /*
    880899         * GMM wrappers.
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