Changeset 20795 in vbox for trunk/src/VBox
- Timestamp:
- Jun 22, 2009 6:40:42 PM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PGMInternal.h
r20764 r20795 3311 3311 3312 3312 STAM_PROFILE_START(&pPGMCPU->StatR0DynMapGCPageInl, a); 3313 Assert (!(GCPhys & PAGE_OFFSET_MASK));3313 AssertMsg(!(GCPhys & PAGE_OFFSET_MASK), ("%RGp\n", GCPhys)); 3314 3314 3315 3315 /* … … 3348 3348 STAM_COUNTER_INC(&pPGMCPU->StatR0DynMapGCPageInlMisses); 3349 3349 pgmR0DynMapHCPageCommon(pVM, pSet, HCPhys, ppv); 3350 } 3351 3352 STAM_PROFILE_STOP(&pPGMCPU->StatR0DynMapGCPageInl, a); 3353 return VINF_SUCCESS; 3354 } 3355 3356 3357 /** 3358 * Inlined version of the ring-0 version of PGMDynMapGCPageOff that optimizes 3359 * access to pages already in the set. 3360 * 3361 * @returns See PGMDynMapGCPage. 3362 * @param pPGM Pointer to the PVM instance data. 3363 * @param HCPhys The physical address of the page. 3364 * @param ppv Where to store the mapping address. 3365 */ 3366 DECLINLINE(int) pgmR0DynMapGCPageOffInlined(PPGM pPGM, RTGCPHYS GCPhys, void **ppv) 3367 { 3368 PVM pVM = PGM2VM(pPGM); 3369 PPGMCPU pPGMCPU = (PPGMCPU)((uint8_t *)VMMGetCpu(pVM) + pPGM->offVCpuPGM); /* very pretty ;-) */ 3370 3371 STAM_PROFILE_START(&pPGMCPU->StatR0DynMapGCPageInl, a); 3372 3373 /* 3374 * Get the ram range. 3375 */ 3376 PPGMRAMRANGE pRam = pPGM->CTX_SUFF(pRamRanges); 3377 RTGCPHYS off = GCPhys - pRam->GCPhys; 3378 if (RT_UNLIKELY(off >= pRam->cb 3379 /** @todo || page state stuff */)) 3380 { 3381 /* This case is not counted into StatR0DynMapGCPageInl. */ 3382 STAM_COUNTER_INC(&pPGMCPU->StatR0DynMapGCPageInlRamMisses); 3383 return PGMDynMapGCPageOff(pVM, GCPhys, ppv); 3384 } 3385 3386 RTHCPHYS HCPhys = PGM_PAGE_GET_HCPHYS(&pRam->aPages[off >> PAGE_SHIFT]); 3387 STAM_COUNTER_INC(&pPGMCPU->StatR0DynMapGCPageInlRamHits); 3388 3389 /* 3390 * pgmR0DynMapHCPageInlined with out stats. 3391 */ 3392 PPGMMAPSET pSet = &pPGMCPU->AutoSet; 3393 Assert(!(HCPhys & PAGE_OFFSET_MASK)); 3394 Assert(pSet->cEntries <= RT_ELEMENTS(pSet->aEntries)); 3395 3396 unsigned iHash = PGMMAPSET_HASH(HCPhys); 3397 unsigned iEntry = pSet->aiHashTable[iHash]; 3398 if ( iEntry < pSet->cEntries 3399 && pSet->aEntries[iEntry].HCPhys == HCPhys) 3400 { 3401 *ppv = (void *)((uintptr_t)pSet->aEntries[iEntry].pvPage | (PAGE_OFFSET_MASK & (uintptr_t)GCPhys)); 3402 STAM_COUNTER_INC(&pPGMCPU->StatR0DynMapGCPageInlHits); 3403 } 3404 else 3405 { 3406 STAM_COUNTER_INC(&pPGMCPU->StatR0DynMapGCPageInlMisses); 3407 pgmR0DynMapHCPageCommon(pVM, pSet, HCPhys, ppv); 3408 *ppv = (void *)((uintptr_t)*ppv | (PAGE_OFFSET_MASK & (uintptr_t)GCPhys)); 3350 3409 } 3351 3410 … … 3568 3627 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 3569 3628 PX86PDPT pGuestPDPT = NULL; 3570 int rc = pgmR0DynMapGCPage Inlined(PGMCPU2PGM(pPGM), pPGM->GCPhysCR3, (void **)&pGuestPDPT);3629 int rc = pgmR0DynMapGCPageOffInlined(PGMCPU2PGM(pPGM), pPGM->GCPhysCR3, (void **)&pGuestPDPT); 3571 3630 AssertRCReturn(rc, NULL); 3572 3631 #else … … 3595 3654 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 3596 3655 PX86PDPT pGuestPDPT = 0; 3597 int rc = pgmR0DynMapGCPage Inlined(PGMCPU2PGM(pPGM), pPGM->GCPhysCR3, (void **)&pGuestPDPT);3656 int rc = pgmR0DynMapGCPageOffInlined(PGMCPU2PGM(pPGM), pPGM->GCPhysCR3, (void **)&pGuestPDPT); 3598 3657 AssertRCReturn(rc, 0); 3599 3658 #else -
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r20767 r20795 1368 1368 1369 1369 RTHCPTR HCPtrGuestCR3; 1370 int rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, pPGM->GCPhysCR3 & X86_CR3_PAE_PAGE_MASK, (void **)&HCPtrGuestCR3); 1370 int rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, pPGM->GCPhysCR3 & X86_CR3_PAE_PAGE_MASK, (void **)&HCPtrGuestCR3); /** @todo r=bird: This GCPhysR3 masking isn't necessary. */ 1371 1371 AssertRCReturn(rc, NULL); 1372 1372 … … 1464 1464 1465 1465 RTHCPTR HCPtrGuestCR3; 1466 int rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, pPGM->GCPhysCR3 & X86_CR3_AMD64_PAGE_MASK, (void **)&HCPtrGuestCR3); 1466 int rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, pPGM->GCPhysCR3 & X86_CR3_AMD64_PAGE_MASK, (void **)&HCPtrGuestCR3); /** @todo r=bird: This GCPhysCR3 masking isn't necessary. */ 1467 1467 AssertRCReturn(rc, NULL); 1468 1468 -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r20783 r20795 453 453 pCur = NULL; /* might be invalid by now. */ 454 454 # endif 455 455 456 456 } 457 457 else … … 4242 4242 int rc = VINF_SUCCESS; 4243 4243 # else 4244 int rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, GCPhysCR3 & GST_CR3_PAGE_MASK, (void **)&HCPtrGuestCR3); 4244 int rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, GCPhysCR3 & GST_CR3_PAGE_MASK, (void **)&HCPtrGuestCR3); /** @todo r=bird: This GCPhysCR3 masking isn't necessary. */ 4245 4245 # endif 4246 4246 pgmUnlock(pVM);
Note:
See TracChangeset
for help on using the changeset viewer.