- Timestamp:
- Jul 15, 2010 5:19:32 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 63689
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/GMMR0.cpp
r30790 r30860 489 489 490 490 /** Shared module tree (global). */ 491 /** todo seperate trees for distinctly different guest OSes. */491 /** @todo seperate trees for distinctly different guest OSes. */ 492 492 PAVLGCPTRNODECORE pGlobalSharedModuleTree; 493 493 … … 867 867 * pages will be 'left behind'.) 868 868 */ 869 /* todo this might be kind of expensive with a lot of VMs and memory hanging around... */ 869 /** @todo this might be kind of expensive with a lot of VMs and 870 * memory hanging around... */ 870 871 uint64_t cPrivatePages = pGVM->gmm.s.cPrivatePages; /* save */ 871 872 RTAvlU32DoWithAll(&pGMM->pChunks, true /* fFromLeft */, gmmR0CleanupVMScanChunk, pGVM); … … 3460 3461 /* Grab the lock. */ 3461 3462 rc = RTSemFastMutexRequest(pGMM->Mtx); 3462 AssertRCReturn(rc, rc); 3463 3464 /* 3465 * Add a new chunk with our hGVM. 3466 */ 3467 rc = gmmR0RegisterChunk(pGMM, &pGMM->Private, MemObj, pGVM->hSelf, GMMCHUNKTYPE_NON_CONTINUOUS); 3468 RTSemFastMutexRelease(pGMM->Mtx); 3463 AssertRC(rc); 3464 if (RT_SUCCESS(rc)) 3465 { 3466 /* 3467 * Add a new chunk with our hGVM. 3468 */ 3469 rc = gmmR0RegisterChunk(pGMM, &pGMM->Private, MemObj, pGVM->hSelf, GMMCHUNKTYPE_NON_CONTINUOUS); 3470 RTSemFastMutexRelease(pGMM->Mtx); 3471 } 3469 3472 3470 3473 if (RT_FAILURE(rc)) … … 3494 3497 if ( pInfo 3495 3498 && pInfo->enmGuestOS == pModule->enmGuestOS 3496 /** todo replace with RTStrNCmp */3499 /** @todo replace with RTStrNCmp */ 3497 3500 && !strcmp(pModule->szName, pInfo->pszModuleName) 3498 3501 && !strcmp(pModule->szVersion, pInfo->pszVersion)) … … 3617 3620 pGlobalModule->cbModule = cbModule; 3618 3621 /* Input limit already safe; no need to check again. */ 3619 /** todo replace with RTStrCopy */3622 /** @todo replace with RTStrCopy */ 3620 3623 strcpy(pGlobalModule->szName, pszModuleName); 3621 3624 strcpy(pGlobalModule->szVersion, pszVersion); … … 3649 3652 3650 3653 /* Make sure the name and version are identical. */ 3651 /** todo replace with RTStrNCmp */3654 /** @todo replace with RTStrNCmp */ 3652 3655 if ( !strcmp(pGlobalModule->szName, pszModuleName) 3653 3656 && !strcmp(pGlobalModule->szVersion, pszVersion)) … … 3743 3746 { 3744 3747 PGMMSHAREDMODULEPERVM pRecVM = (PGMMSHAREDMODULEPERVM)RTAvlGCPtrGet(&pGVM->gmm.s.pSharedModuleTree, GCBaseAddr); 3745 if (!pRecVM) 3746 { 3747 rc = VERR_PGM_SHARED_MODULE_NOT_FOUND; 3748 goto end; 3749 } 3750 /* Remove reference to global shared module. */ 3751 if (!pRecVM->fCollision) 3752 { 3753 PGMMSHAREDMODULE pRec = pRecVM->pGlobalModule; 3754 Assert(pRec); 3755 3756 if (pRec) /* paranoia */ 3748 if (pRecVM) 3749 { 3750 /* Remove reference to global shared module. */ 3751 if (!pRecVM->fCollision) 3757 3752 { 3758 Assert(pRec->cUsers); 3759 pRec->cUsers--; 3760 if (pRec->cUsers == 0) 3753 PGMMSHAREDMODULE pRec = pRecVM->pGlobalModule; 3754 Assert(pRec); 3755 3756 if (pRec) /* paranoia */ 3761 3757 { 3762 /* Free the ranges, but leave the pages intact as there might still be references; they will be cleared by the COW mechanism. */ 3763 for (unsigned i = 0; i < pRec->cRegions; i++) 3764 if (pRec->aRegions[i].paHCPhysPageID) 3765 RTMemFree(pRec->aRegions[i].paHCPhysPageID); 3766 3767 /* Remove from the tree and free memory. */ 3768 RTAvlGCPtrRemove(&pGMM->pGlobalSharedModuleTree, GCBaseAddr); 3769 RTMemFree(pRec); 3758 Assert(pRec->cUsers); 3759 pRec->cUsers--; 3760 if (pRec->cUsers == 0) 3761 { 3762 /* Free the ranges, but leave the pages intact as there might still be references; they will be cleared by the COW mechanism. */ 3763 for (unsigned i = 0; i < pRec->cRegions; i++) 3764 if (pRec->aRegions[i].paHCPhysPageID) 3765 RTMemFree(pRec->aRegions[i].paHCPhysPageID); 3766 3767 /* Remove from the tree and free memory. */ 3768 RTAvlGCPtrRemove(&pGMM->pGlobalSharedModuleTree, GCBaseAddr); 3769 RTMemFree(pRec); 3770 } 3770 3771 } 3772 else 3773 rc = VERR_PGM_SHARED_MODULE_REGISTRATION_INCONSISTENCY; 3771 3774 } 3772 3775 else 3773 rc = VERR_PGM_SHARED_MODULE_REGISTRATION_INCONSISTENCY; 3776 Assert(!pRecVM->pGlobalModule); 3777 3778 /* Remove from the tree and free memory. */ 3779 RTAvlGCPtrRemove(&pGVM->gmm.s.pSharedModuleTree, GCBaseAddr); 3780 RTMemFree(pRecVM); 3774 3781 } 3775 3782 else 3776 Assert(!pRecVM->pGlobalModule); 3777 3778 /* Remove from the tree and free memory. */ 3779 RTAvlGCPtrRemove(&pGVM->gmm.s.pSharedModuleTree, GCBaseAddr); 3780 RTMemFree(pRecVM); 3783 rc = VERR_PGM_SHARED_MODULE_NOT_FOUND; 3781 3784 3782 3785 GMM_CHECK_SANITY_UPON_LEAVING(pGMM); … … 3785 3788 rc = VERR_INTERNAL_ERROR_5; 3786 3789 3787 end:3788 3790 RTSemFastMutexRelease(pGMM->Mtx); 3789 3791 return rc; … … 3904 3906 { 3905 3907 /* Page was freed at some point; invalidate this entry. */ 3906 /** todo this isn't really bullet proof. */3908 /** @todo this isn't really bullet proof. */ 3907 3909 Log(("Old shared page was freed -> create a new one\n")); 3908 3910 pGlobalRegion->paHCPhysPageID[idxPage] = NIL_GMM_PAGEID; … … 3948 3950 pbSharedPage = pbChunk + ((pGlobalRegion->paHCPhysPageID[idxPage] & GMM_PAGEID_IDX_MASK) << PAGE_SHIFT); 3949 3951 3950 /** todo write ASMMemComparePage. */3952 /** @todo write ASMMemComparePage. */ 3951 3953 if (memcmp(pbSharedPage, pbLocalPage, PAGE_SIZE)) 3952 3954 {
Note:
See TracChangeset
for help on using the changeset viewer.