Changeset 82975 in vbox for trunk/src/VBox/VMM/VMMR0
- Timestamp:
- Feb 4, 2020 12:35:27 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 135984
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/GMMR0.cpp
r82968 r82975 5354 5354 5355 5355 /** 5356 * RTAvlU32DoWithAll callback. 5357 * 5358 * @returns 0 5359 * @param pNode The node to search. 5360 * @param pvUser Pointer to the input argument packet. 5361 */ 5362 static DECLCALLBACK(int) gmmR0FindDupPageInChunk(PAVLU32NODECORE pNode, void *pvUser) 5363 { 5364 PGMMCHUNK pChunk = (PGMMCHUNK)pNode; 5365 GMMFINDDUPPAGEINFO *pArgs = (GMMFINDDUPPAGEINFO *)pvUser; 5366 PGVM pGVM = pArgs->pGVM; 5367 PGMM pGMM = pArgs->pGMM; 5368 uint8_t *pbChunk; 5369 5356 * Worker for GMMR0FindDuplicatePageReq. 5357 * 5358 * @returns true if duplicate, false if not. 5359 */ 5360 static bool gmmR0FindDupPageInChunk(PGMM pGMM, PGVM pGVM, PGMMCHUNK pChunk, uint8_t const *pbSourcePage) 5361 { 5362 bool fFoundDuplicate = false; 5370 5363 /* Only take chunks not mapped into this VM process; not entirely correct. */ 5364 uint8_t *pbChunk; 5371 5365 if (!gmmR0IsChunkMapped(pGMM, pGVM, pChunk, (PRTR3PTR)&pbChunk)) 5372 5366 { … … 5377 5371 * Look for duplicate pages 5378 5372 */ 5379 u nsignediPage = (GMM_CHUNK_SIZE >> PAGE_SHIFT);5373 uintptr_t iPage = (GMM_CHUNK_SIZE >> PAGE_SHIFT); 5380 5374 while (iPage-- > 0) 5381 5375 { … … 5383 5377 { 5384 5378 uint8_t *pbDestPage = pbChunk + (iPage << PAGE_SHIFT); 5385 5386 if (!memcmp(pArgs->pSourcePage, pbDestPage, PAGE_SIZE)) 5379 if (!memcmp(pbSourcePage, pbDestPage, PAGE_SIZE)) 5387 5380 { 5388 pArgs->fFoundDuplicate = true;5381 fFoundDuplicate = true; 5389 5382 break; 5390 5383 } … … 5394 5387 } 5395 5388 } 5396 return pArgs->fFoundDuplicate; /* (stops search if true) */5389 return fFoundDuplicate; 5397 5390 } 5398 5391 … … 5436 5429 if (pPage) 5437 5430 { 5431 /* 5432 * Walk the chunks 5433 */ 5438 5434 GMMFINDDUPPAGEINFO Args; 5439 5435 Args.pGVM = pGVM; … … 5441 5437 Args.pSourcePage = pbSourcePage; 5442 5438 Args.fFoundDuplicate = false; 5443 RTAvlU32DoWithAll(&pGMM->pChunks, true /* fFromLeft */, gmmR0FindDupPageInChunk, &Args); 5444 5445 pReq->fDuplicate = Args.fFoundDuplicate; 5439 5440 PGMMCHUNK pChunk; 5441 pReq->fDuplicate = false; 5442 RTListForEach(&pGMM->ChunkList, pChunk, GMMCHUNK, ListNode) 5443 { 5444 if (gmmR0FindDupPageInChunk(pGMM, pGVM, pChunk, pbSourcePage)) 5445 { 5446 pReq->fDuplicate = true; 5447 break; 5448 } 5449 } 5446 5450 } 5447 5451 else
Note:
See TracChangeset
for help on using the changeset viewer.