- Timestamp:
- Nov 11, 2021 10:44:05 PM (3 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/PGMR0.cpp
r92381 r92383 365 365 while (cLeft-- > 0) 366 366 { 367 PPGMPAGE pPage; 368 int rc2 = pgmPhysGetPageEx(pGVM, GCPhys, &pPage); 369 AssertRCReturn(rc2, rc2); 370 AssertReturn(PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_RAM, VERR_PGM_PHYS_NOT_RAM); 371 AssertReturn(PGM_PAGE_IS_ZERO(pPage), VERR_PGM_UNEXPECTED_PAGE_STATE); 367 PPGMPAGE const pPage = pgmPhysGetPage(pGVM, GCPhys); 368 AssertReturn(pPage && PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_RAM && PGM_PAGE_IS_ZERO(pPage), VERR_PGM_UNEXPECTED_PAGE_STATE); 372 369 373 370 /* Make sure there are no zero mappings. */ 374 371 uint16_t const u16Tracking = PGM_PAGE_GET_TRACKING(pPage); 375 372 if (u16Tracking == 0) 376 { /* likely */ }373 Assert(PGM_PAGE_GET_PTE_INDEX(pPage) == 0); 377 374 else 378 375 { … … 382 379 if (rc3 != VINF_SUCCESS && rc == VINF_SUCCESS) 383 380 rc = rc3; /** @todo not perfect... */ 381 PGM_PAGE_SET_PTE_INDEX(pGVM, pPage, 0); 382 PGM_PAGE_SET_TRACKING(pGVM, pPage, 0); 384 383 } 385 384 386 385 /* Setup the new page. */ 387 STAM_COUNTER_INC(&pGVM->pgm.s.Stats.StatRZPageReplaceZero);388 pGVM->pgm.s.cZeroPages--;389 pGVM->pgm.s.cPrivatePages++;390 386 PGM_PAGE_SET_HCPHYS(pGVM, pPage, HCPhys); 391 PGM_PAGE_SET_PAGEID(pGVM, pPage, idPage);392 387 PGM_PAGE_SET_STATE(pGVM, pPage, PGM_PAGE_STATE_ALLOCATED); 393 388 PGM_PAGE_SET_PDE_TYPE(pGVM, pPage, PGM_PAGE_PDE_TYPE_PDE); 394 PGM_PAGE_SET_PTE_INDEX(pGVM, pPage, 0); 395 PGM_PAGE_SET_TRACKING(pGVM, pPage, 0); 389 PGM_PAGE_SET_PAGEID(pGVM, pPage, idPage); 396 390 Log3(("PGMR0PhysAllocateLargePage: GCPhys=%RGp: idPage=%#x HCPhys=%RGp (old tracking=%#x)\n", 397 391 GCPhys, idPage, HCPhys, u16Tracking)); … … 403 397 } 404 398 399 STAM_COUNTER_ADD(&pGVM->pgm.s.Stats.StatRZPageReplaceZero, _2M / PAGE_SIZE); 400 pGVM->pgm.s.cZeroPages -= _2M / PAGE_SIZE; 401 pGVM->pgm.s.cPrivatePages += _2M / PAGE_SIZE; 402 405 403 /* 406 404 * Flush all TLBs. 407 405 */ 408 406 if (!fFlushTLBs) 409 { /* likely */ }407 { /* likely as we shouldn't normally map zero pages */ } 410 408 else 411 409 { … … 418 416 419 417 STAM_PROFILE_STOP(&pGVM->pgm.s.Stats.StatLargePageSetup, b); 420 /** @todo returning info statuses here might not be a great idea... */ 421 #if 0 418 #if 0 /** @todo returning info statuses here might not be a great idea... */ 422 419 LogFlow(("PGMR0PhysAllocateLargePage: returns %Rrc\n", VBOXSTRICTRC_VAL(rc) )); 423 420 return VBOXSTRICTRC_TODO(rc); -
trunk/src/VBox/VMM/include/PGMInline.h
r91904 r92383 103 103 PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)]; 104 104 RTGCPHYS off; 105 if ( !pRam 106 || (off = GCPhys - pRam->GCPhys) >= pRam->cb) 107 return pgmPhysGetPageSlow(pVM, GCPhys); 108 STAM_COUNTER_INC(&pVM->pgm.s.Stats.CTX_MID_Z(Stat,RamRangeTlbHits)); 109 return &pRam->aPages[off >> PAGE_SHIFT]; 105 if ( pRam 106 && (off = GCPhys - pRam->GCPhys) < pRam->cb) 107 { 108 STAM_COUNTER_INC(&pVM->pgm.s.Stats.CTX_MID_Z(Stat,RamRangeTlbHits)); 109 return &pRam->aPages[off >> PAGE_SHIFT]; 110 } 111 return pgmPhysGetPageSlow(pVM, GCPhys); 110 112 } 111 113
Note:
See TracChangeset
for help on using the changeset viewer.