Changeset 27065 in vbox for trunk/src/VBox
- Timestamp:
- Mar 5, 2010 10:07:55 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 58382
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PGMInternal.h
r27038 r27065 3387 3387 uint16_t pgmPoolTrackPhysExtAddref(PVM pVM, uint16_t u16, uint16_t iShwPT); 3388 3388 void pgmPoolTrackPhysExtDerefGCPhys(PPGMPOOL pPool, PPGMPOOLPAGE pPoolPage, PPGMPAGE pPhysPage); 3389 void pgmPoolTracDerefGCPhysHint(PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTHCPHYS HCPhys, RTGCPHYS GCPhysHint);3390 3389 void pgmPoolMonitorChainChanging(PVMCPU pVCpu, PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTGCPHYS GCPhysFault, CTXTYPE(RTGCPTR, RTHCPTR, RTGCPTR) pvAddress, unsigned cbWrite); 3391 3390 int pgmPoolMonitorChainFlush(PPGMPOOL pPool, PPGMPOOLPAGE pPage); -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r27038 r27065 68 68 void pgmPoolTrackPhysExtFree(PVM pVM, uint16_t iPhysExt); 69 69 void pgmPoolTrackPhysExtFreeList(PVM pVM, uint16_t iPhysExt); 70 static void pgmPoolTracDerefGCPhysHint(PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTHCPHYS HCPhys, RTGCPHYS GCPhysHint); 70 71 71 72 RT_C_DECLS_END … … 2991 2992 STAM_COUNTER_INC(&pPool->StatTrackFlushEntry); 2992 2993 2994 /* Update the counter if we're removing references. */ 2995 if (!u32AndMask) 2996 { 2997 Assert(pPage->cPresent >= cRefs); 2998 Assert(pPool->cPresent >= cRefs); 2999 pPage->cPresent -= cRefs; 3000 pPool->cPresent -= cRefs; 3001 } 3002 2993 3003 for (unsigned i = pPage->iFirstPresent; i < RT_ELEMENTS(pPT->a); i++) 2994 3004 if ((pPT->a[i].u & (X86_PTE_PG_MASK | X86_PTE_P)) == u32) … … 3057 3067 STAM_COUNTER_INC(&pPool->StatTrackFlushEntry); 3058 3068 3069 /* Update the counter if we're removing references. */ 3070 if (!u64AndMask) 3071 { 3072 Assert(pPage->cPresent >= cRefs); 3073 Assert(pPool->cPresent >= cRefs); 3074 pPage->cPresent -= cRefs; 3075 pPool->cPresent -= cRefs; 3076 } 3077 3059 3078 for (unsigned i = pPage->iFirstPresent; i < RT_ELEMENTS(pPT->a); i++) 3060 3079 if ((pPT->a[i].u & (X86_PTE_PAE_PG_MASK | X86_PTE_P)) == u64) … … 3095 3114 pPT->a[i].u = 0; 3096 3115 cRefs--; 3116 3117 /* Update the counter as we're removing references. */ 3118 Assert(pPage->cPresent); 3119 Assert(pPool->cPresent); 3120 pPage->cPresent--; 3121 pPool->cPresent--; 3122 3097 3123 if (!cRefs) 3098 3124 return bRet; … … 3126 3152 pPD->a[i].u = 0; 3127 3153 cRefs--; 3154 3155 /* Update the counter as we're removing references. */ 3156 Assert(pPage->cPresent); 3157 Assert(pPool->cPresent); 3158 pPage->cPresent--; 3159 pPool->cPresent--; 3160 3128 3161 if (!cRefs) 3129 3162 return bRet; … … 3156 3189 pPD->a[i].u = 0; 3157 3190 cRefs--; 3191 3192 /* Update the counter as we're removing references. */ 3193 Assert(pPage->cPresent); 3194 Assert(pPool->cPresent); 3195 pPage->cPresent--; 3196 pPool->cPresent--; 3197 3158 3198 if (!cRefs) 3159 3199 return bRet; … … 3425 3465 //Log4(("pgmPoolTrackFlushGCPhysPTsSlow: idx=%d i=%d pte=%RX32\n", iPage, i, pPT->a[i])); 3426 3466 pPT->a[i].u = 0; 3467 3468 /* Update the counter as we're removing references. */ 3469 Assert(pPage->cPresent); 3470 Assert(pPool->cPresent); 3471 pPage->cPresent--; 3472 pPool->cPresent--; 3427 3473 } 3428 3474 if (!--cPresent) … … 3447 3493 //Log4(("pgmPoolTrackFlushGCPhysPTsSlow: idx=%d i=%d pte=%RX64\n", iPage, i, pPT->a[i])); 3448 3494 pPT->a[i].u = 0; 3495 3496 /* Update the counter as we're removing references. */ 3497 Assert(pPage->cPresent); 3498 Assert(pPool->cPresent); 3499 pPage->cPresent--; 3500 pPool->cPresent--; 3449 3501 } 3450 3502 if (!--cPresent) … … 3453 3505 break; 3454 3506 } 3507 #ifndef IN_RC 3508 case PGMPOOLKIND_EPT_PT_FOR_PHYS: 3509 { 3510 unsigned cPresent = pPage->cPresent; 3511 PEPTPT pPT = (PEPTPT)PGMPOOL_PAGE_2_PTR(pVM, pPage); 3512 for (unsigned i = pPage->iFirstPresent; i < RT_ELEMENTS(pPT->a); i++) 3513 if (pPT->a[i].n.u1Present) 3514 { 3515 if ((pPT->a[i].u & (EPT_PTE_PG_MASK | X86_PTE_P)) == u64) 3516 { 3517 //Log4(("pgmPoolTrackFlushGCPhysPTsSlow: idx=%d i=%d pte=%RX64\n", iPage, i, pPT->a[i])); 3518 pPT->a[i].u = 0; 3519 3520 /* Update the counter as we're removing references. */ 3521 Assert(pPage->cPresent); 3522 Assert(pPool->cPresent); 3523 pPage->cPresent--; 3524 pPool->cPresent--; 3525 } 3526 if (!--cPresent) 3527 break; 3528 } 3529 break; 3530 } 3531 #endif 3455 3532 } 3456 3533 if (!--cLeft) … … 3916 3993 Assert(PGM_PAGE_GET_HCPHYS(&pRam->aPages[iPage])); 3917 3994 #ifdef LOG_ENABLED 3918 RTHCPHYS HCPhysPage = PGM_PAGE_GET_HCPHYS(&pRam->aPages[iPage]);3919 Log2(("pgmPoolTracDerefGCPhys %RHp vs %RHp\n", HCPhysPage, HCPhys));3995 RTHCPHYS HCPhysPage = PGM_PAGE_GET_HCPHYS(&pRam->aPages[iPage]); 3996 Log2(("pgmPoolTracDerefGCPhys %RHp vs %RHp\n", HCPhysPage, HCPhys)); 3920 3997 #endif 3921 3998 if (PGM_PAGE_GET_HCPHYS(&pRam->aPages[iPage]) == HCPhys) 3922 3999 { 4000 Assert(pPage->cPresent); 4001 Assert(pPool->cPresent); 4002 pPage->cPresent--; 4003 pPool->cPresent--; 3923 4004 pgmTrackDerefGCPhys(pPool, pPage, &pRam->aPages[iPage]); 3924 4005 return; … … 3940 4021 * @param GCPhysHint The guest physical address which may corresponding to HCPhys. 3941 4022 */ 3942 void pgmPoolTracDerefGCPhysHint(PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTHCPHYS HCPhys, RTGCPHYS GCPhysHint)4023 static void pgmPoolTracDerefGCPhysHint(PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTHCPHYS HCPhys, RTGCPHYS GCPhysHint) 3943 4024 { 3944 4025 Log4(("pgmPoolTracDerefGCPhysHint %RHp %RGp\n", HCPhys, GCPhysHint)); … … 4007 4088 i, pShwPT->a[i].u & X86_PTE_PG_MASK, pGstPT->a[i].u & X86_PTE_PG_MASK)); 4008 4089 pgmPoolTracDerefGCPhysHint(pPool, pPage, pShwPT->a[i].u & X86_PTE_PG_MASK, pGstPT->a[i].u & X86_PTE_PG_MASK); 4009 if (! --pPage->cPresent)4090 if (!pPage->cPresent) 4010 4091 break; 4011 4092 } … … 4029 4110 i, pShwPT->a[i].u & X86_PTE_PAE_PG_MASK, pGstPT->a[i].u & X86_PTE_PG_MASK)); 4030 4111 pgmPoolTracDerefGCPhysHint(pPool, pPage, pShwPT->a[i].u & X86_PTE_PAE_PG_MASK, pGstPT->a[i].u & X86_PTE_PG_MASK); 4031 if (! --pPage->cPresent)4112 if (!pPage->cPresent) 4032 4113 break; 4033 4114 } … … 4051 4132 i, pShwPT->a[i].u & X86_PTE_PAE_PG_MASK, pGstPT->a[i].u & X86_PTE_PAE_PG_MASK)); 4052 4133 pgmPoolTracDerefGCPhysHint(pPool, pPage, pShwPT->a[i].u & X86_PTE_PAE_PG_MASK, pGstPT->a[i].u & X86_PTE_PAE_PG_MASK); 4053 if (! --pPage->cPresent)4134 if (!pPage->cPresent) 4054 4135 break; 4055 4136 } … … 4073 4154 i, pShwPT->a[i].u & X86_PTE_PG_MASK, GCPhys)); 4074 4155 pgmPoolTracDerefGCPhys(pPool, pPage, pShwPT->a[i].u & X86_PTE_PG_MASK, GCPhys); 4075 if (! --pPage->cPresent)4156 if (!pPage->cPresent) 4076 4157 break; 4077 4158 } … … 4095 4176 i, pShwPT->a[i].u & X86_PTE_PAE_PG_MASK, GCPhys)); 4096 4177 pgmPoolTracDerefGCPhys(pPool, pPage, pShwPT->a[i].u & X86_PTE_PAE_PG_MASK, GCPhys); 4097 if (! --pPage->cPresent)4178 if (!pPage->cPresent) 4098 4179 break; 4099 4180 } … … 4117 4198 i, pShwPT->a[i].u & EPT_PTE_PG_MASK, pPage->GCPhys)); 4118 4199 pgmPoolTracDerefGCPhys(pPool, pPage, pShwPT->a[i].u & EPT_PTE_PG_MASK, GCPhys); 4119 if (! --pPage->cPresent)4200 if (!pPage->cPresent) 4120 4201 break; 4121 4202 } … … 4163 4244 ) 4164 4245 { 4165 PPGMPOOLPAGE pSubPage = (PPGMPOOLPAGE)RTAvloHCPhysGet(&pPool->HCPhysTree, pShwPD->a[i].u & X86_PDE_PAE_PG_MASK); 4166 if (pSubPage) 4167 pgmPoolTrackFreeUser(pPool, pSubPage, pPage->idx, i); 4246 #ifdef PGM_WITH_LARGE_PAGES 4247 if (pShwPD->a[i].b.u1Size) 4248 { 4249 Log4(("pgmPoolTrackDerefPDPae: i=%d pde=%RX64 GCPhys=%RX64\n", 4250 i, pShwPD->a[i].u & X86_PDE2M_PAE_PG_MASK, pPage->GCPhys)); 4251 pgmPoolTracDerefGCPhys(pPool, pPage, pShwPD->a[i].u & X86_PDE2M_PAE_PG_MASK, pPage->GCPhys /* == base of 2 MB page */); 4252 } 4168 4253 else 4169 AssertFatalMsgFailed(("%RX64\n", pShwPD->a[i].u & X86_PDE_PAE_PG_MASK)); 4170 /** @todo 64-bit guests: have to ensure that we're not exhausting the dynamic mappings! */ 4254 #endif 4255 { 4256 PPGMPOOLPAGE pSubPage = (PPGMPOOLPAGE)RTAvloHCPhysGet(&pPool->HCPhysTree, pShwPD->a[i].u & X86_PDE_PAE_PG_MASK); 4257 if (pSubPage) 4258 pgmPoolTrackFreeUser(pPool, pSubPage, pPage->idx, i); 4259 else 4260 AssertFatalMsgFailed(("%RX64\n", pShwPD->a[i].u & X86_PDE_PAE_PG_MASK)); 4261 /** @todo 64-bit guests: have to ensure that we're not exhausting the dynamic mappings! */ 4262 } 4171 4263 } 4172 4264 } … … 4260 4352 if (pShwPD->a[i].n.u1Present) 4261 4353 { 4262 PPGMPOOLPAGE pSubPage = (PPGMPOOLPAGE)RTAvloHCPhysGet(&pPool->HCPhysTree, pShwPD->a[i].u & EPT_PDE_PG_MASK); 4263 if (pSubPage) 4264 pgmPoolTrackFreeUser(pPool, pSubPage, pPage->idx, i); 4354 #ifdef PGM_WITH_LARGE_PAGES 4355 if (pShwPD->a[i].b.u1Size) 4356 { 4357 Log4(("pgmPoolTrackDerefPDEPT: i=%d pde=%RX64 GCPhys=%RX64\n", 4358 i, pShwPD->a[i].u & X86_PDE2M_PAE_PG_MASK, pPage->GCPhys)); 4359 pgmPoolTracDerefGCPhys(pPool, pPage, pShwPD->a[i].u & X86_PDE2M_PAE_PG_MASK, pPage->GCPhys /* == base of 2 MB page */); 4360 } 4265 4361 else 4266 AssertFatalMsgFailed(("%RX64\n", pShwPD->a[i].u & EPT_PDE_PG_MASK)); 4362 #endif 4363 { 4364 PPGMPOOLPAGE pSubPage = (PPGMPOOLPAGE)RTAvloHCPhysGet(&pPool->HCPhysTree, pShwPD->a[i].u & EPT_PDE_PG_MASK); 4365 if (pSubPage) 4366 pgmPoolTrackFreeUser(pPool, pSubPage, pPage->idx, i); 4367 else 4368 AssertFatalMsgFailed(("%RX64\n", pShwPD->a[i].u & EPT_PDE_PG_MASK)); 4369 } 4267 4370 /** @todo 64-bit guests: have to ensure that we're not exhausting the dynamic mappings! */ 4268 4371 }
Note:
See TracChangeset
for help on using the changeset viewer.