儲存庫 vbox 的更動 30836
- 時間撮記:
- 2010-7-14 下午01:50:19 (14 年 以前)
- 位置:
- trunk/src/VBox/VMM
- 檔案:
-
- 修改 2 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/VMM/PGMInternal.h
r30815 r30836 1401 1401 * 1402 1402 * The primary tree (Core) uses the chunk id as key. 1403 * The secondary tree (AgeCore) is used for ageing and uses ageing sequence number as key.1404 1403 */ 1405 1404 typedef struct PGMCHUNKR3MAP … … 1407 1406 /** The key is the chunk id. */ 1408 1407 AVLU32NODECORE Core; 1409 /** The key is the ageing sequence number. */1410 AVLLU32NODECORE AgeCore;1411 1408 /** The current age thingy. */ 1412 1409 uint32_t iAge; … … 2670 2667 R3R0PTRTYPE(PAVLU32NODECORE) pTree; 2671 2668 #endif 2672 /** The chunk age tree, ordered by ageing sequence number. */2673 R3PTRTYPE(PAVLLU32NODECORE) pAgeTree;2674 2669 /** The chunk mapping TLB. */ 2675 2670 PGMCHUNKR3MAPTLB Tlb; -
trunk/src/VBox/VMM/PGMPhys.cpp
r30835 r30836 3206 3206 else /* iAge = 0 */ 3207 3207 pChunk->iAge = 4; 3208 3209 /* reinsert */3210 PVM pVM = (PVM)pvUser;3211 RTAvllU32Remove(&pVM->pgm.s.ChunkR3Map.pAgeTree, pChunk->AgeCore.Key);3212 pChunk->AgeCore.Key = pChunk->iAge;3213 RTAvllU32Insert(&pVM->pgm.s.ChunkR3Map.pAgeTree, &pChunk->AgeCore);3214 3208 return 0; 3215 3209 } … … 3226 3220 { 3227 3221 PVM pVM = (PVM)pvUser; 3228 RTAvllU32Remove(&pVM->pgm.s.ChunkR3Map.pAgeTree, pChunk->AgeCore.Key); 3229 pChunk->AgeCore.Key = pChunk->iAge = pVM->pgm.s.ChunkR3Map.iNow; 3230 RTAvllU32Insert(&pVM->pgm.s.ChunkR3Map.pAgeTree, &pChunk->AgeCore); 3231 } 3232 3222 pChunk->iAge = pVM->pgm.s.ChunkR3Map.iNow; 3223 } 3233 3224 return 0; 3234 3225 } … … 3263 3254 PVM pVM; /**< The VM handle. */ 3264 3255 PPGMCHUNKR3MAP pChunk; /**< The chunk to unmap. */ 3256 int32_t iLastAge; /**< Highest age found so far. */ 3265 3257 } PGMR3PHYSCHUNKUNMAPCB, *PPGMR3PHYSCHUNKUNMAPCB; 3266 3258 … … 3273 3265 { 3274 3266 PPGMCHUNKR3MAP pChunk = (PPGMCHUNKR3MAP)((uint8_t *)pNode - RT_OFFSETOF(PGMCHUNKR3MAP, AgeCore)); 3267 PPGMR3PHYSCHUNKUNMAPCB pArg = (PPGMR3PHYSCHUNKUNMAPCB)pvUser; 3268 3275 3269 if ( pChunk->iAge 3276 && !pChunk->cRefs) 3270 && !pChunk->cRefs 3271 && pArg->iLastAge < pChunk->iAge) 3277 3272 { 3278 3273 /* 3279 3274 * Check that it's not in any of the TLBs. 3280 3275 */ 3281 PVM pVM = ((PPGMR3PHYSCHUNKUNMAPCB)pvUser)->pVM;3276 PVM pVM = pArg->pVM; 3282 3277 for (unsigned i = 0; i < RT_ELEMENTS(pVM->pgm.s.ChunkR3Map.Tlb.aEntries); i++) 3283 3278 if (pVM->pgm.s.ChunkR3Map.Tlb.aEntries[i].pChunk == pChunk) … … 3295 3290 if (pChunk) 3296 3291 { 3297 ((PPGMR3PHYSCHUNKUNMAPCB)pvUser)->pChunk = pChunk;3298 return 1; /* done */3292 pArg->pChunk = pChunk; 3293 pArg->iLastAge = pChunk->iAge; 3299 3294 } 3300 3295 } … … 3326 3321 */ 3327 3322 PGMR3PHYSCHUNKUNMAPCB Args; 3328 Args.pVM = pVM;3329 Args.pChunk = NULL;3330 if (RTAvllU32DoWithAll(&pVM->pgm.s.ChunkR3Map.pAgeTree, true /*fFromLeft*/, pgmR3PhysChunkUnmapCandidateCallback, &Args))3331 {3332 3333 3334 3335 } 3323 Args.pVM = pVM; 3324 Args.pChunk = NULL; 3325 Args.iLastAge = 0; 3326 RTAvlU32DoWithAll(&pVM->pgm.s.ChunkR3Map.pTree, true /*fFromLeft*/, pgmR3PhysChunkUnmapCandidateCallback, &Args); 3327 Assert(Args.pChunk); 3328 if (Args.pChunk) 3329 return Args.pChunk->Core.Key; 3330 3336 3331 return INT32_MAX; 3337 3332 } … … 3370 3365 Req.idChunkUnmap = pgmR3PhysChunkFindUnmapCandidate(pVM); 3371 3366 3372 rc = VMMR3CallR0(pVM, VMMR0_DO_GMM_MAP_UNMAP_CHUNK, 0, &Req.Hdr); 3373 if (RT_SUCCESS(rc)) 3374 { 3375 /* remove the unmapped one. */ 3376 PPGMCHUNKR3MAP pUnmappedChunk = (PPGMCHUNKR3MAP)RTAvlU32Remove(&pVM->pgm.s.ChunkR3Map.pTree, Req.idChunkUnmap); 3377 AssertRelease(pUnmappedChunk); 3378 pUnmappedChunk->pv = NULL; 3379 pUnmappedChunk->Core.Key = UINT32_MAX; 3367 if (Req.idChunkUnmap != INT32_MAX) 3368 { 3369 rc = VMMR3CallR0(pVM, VMMR0_DO_GMM_MAP_UNMAP_CHUNK, 0, &Req.Hdr); 3370 if (RT_SUCCESS(rc)) 3371 { 3372 /* remove the unmapped one. */ 3373 PPGMCHUNKR3MAP pUnmappedChunk = (PPGMCHUNKR3MAP)RTAvlU32Remove(&pVM->pgm.s.ChunkR3Map.pTree, Req.idChunkUnmap); 3374 AssertRelease(pUnmappedChunk); 3375 pUnmappedChunk->pv = NULL; 3376 pUnmappedChunk->Core.Key = UINT32_MAX; 3380 3377 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE 3381 MMR3HeapFree(pUnmappedChunk);3378 MMR3HeapFree(pUnmappedChunk); 3382 3379 #else 3383 MMR3UkHeapFree(pVM, pUnmappedChunk, MM_TAG_PGM_CHUNK_MAPPING);3380 MMR3UkHeapFree(pVM, pUnmappedChunk, MM_TAG_PGM_CHUNK_MAPPING); 3384 3381 #endif 3385 pVM->pgm.s.ChunkR3Map.c--;3386 pVM->pgm.s.cUnmappedChunks++;3387 3388 /* Flush dangling PGM pointers (R3 & R0 ptrs to GC physical addresses) */3389 /* todo: we should not flush chunks which include cr3 mappings. */3390 for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)3391 {3392 PPGMCPU pPGM = &pVM->aCpus[idCpu].pgm.s;3393 3394 pPGM->pGst32BitPdR3 = NULL;3395 pPGM->pGstPaePdptR3 = NULL;3396 pPGM->pGstAmd64Pml4R3 = NULL;3382 pVM->pgm.s.ChunkR3Map.c--; 3383 pVM->pgm.s.cUnmappedChunks++; 3384 3385 /* Flush dangling PGM pointers (R3 & R0 ptrs to GC physical addresses) */ 3386 /* todo: we should not flush chunks which include cr3 mappings. */ 3387 for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++) 3388 { 3389 PPGMCPU pPGM = &pVM->aCpus[idCpu].pgm.s; 3390 3391 pPGM->pGst32BitPdR3 = NULL; 3392 pPGM->pGstPaePdptR3 = NULL; 3393 pPGM->pGstAmd64Pml4R3 = NULL; 3397 3394 #ifndef VBOX_WITH_2X_4GB_ADDR_SPACE 3398 pPGM->pGst32BitPdR0 = NIL_RTR0PTR;3399 pPGM->pGstPaePdptR0 = NIL_RTR0PTR;3400 pPGM->pGstAmd64Pml4R0 = NIL_RTR0PTR;3395 pPGM->pGst32BitPdR0 = NIL_RTR0PTR; 3396 pPGM->pGstPaePdptR0 = NIL_RTR0PTR; 3397 pPGM->pGstAmd64Pml4R0 = NIL_RTR0PTR; 3401 3398 #endif 3402 for (unsigned i = 0; i < RT_ELEMENTS(pPGM->apGstPaePDsR3); i++)3403 {3404 pPGM->apGstPaePDsR3[i] = NULL;3399 for (unsigned i = 0; i < RT_ELEMENTS(pPGM->apGstPaePDsR3); i++) 3400 { 3401 pPGM->apGstPaePDsR3[i] = NULL; 3405 3402 #ifndef VBOX_WITH_2X_4GB_ADDR_SPACE 3406 pPGM->apGstPaePDsR0[i] = NIL_RTR0PTR;3403 pPGM->apGstPaePDsR0[i] = NIL_RTR0PTR; 3407 3404 #endif 3405 } 3406 3407 /* Flush REM TLBs. */ 3408 CPUMSetChangedFlags(&pVM->aCpus[idCpu], CPUM_CHANGED_GLOBAL_TLB_FLUSH); 3408 3409 } 3409 3410 3410 /* Flush REM TLBs. */3411 CPUMSetChangedFlags(&pVM->aCpus[idCpu], CPUM_CHANGED_GLOBAL_TLB_FLUSH);3411 /* Flush REM translation blocks. */ 3412 REMFlushTBs(pVM); 3412 3413 } 3413 3414 /* Flush REM translation blocks. */3415 REMFlushTBs(pVM);3416 3414 } 3417 3415 } … … 3460 3458 AssertReturn(pChunk, VERR_NO_MEMORY); 3461 3459 pChunk->Core.Key = idChunk; 3462 pChunk-> AgeCore.Key= pVM->pgm.s.ChunkR3Map.iNow;3460 pChunk->iAge = pVM->pgm.s.ChunkR3Map.iNow; 3463 3461 3464 3462 /* … … 3486 3484 pVM->pgm.s.ChunkR3Map.c++; 3487 3485 pVM->pgm.s.cMappedChunks++; 3488 3489 fRc = RTAvllU32Insert(&pVM->pgm.s.ChunkR3Map.pAgeTree, &pChunk->AgeCore);3490 AssertRelease(fRc);3491 3486 3492 3487 /* If we're running out of virtual address space, then we should unmap another chunk. */
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器