Changeset 19329 in vbox
- Timestamp:
- May 4, 2009 2:59:32 PM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PGMInternal.h
r19195 r19329 2926 2926 #endif 2927 2927 int pgmPoolAlloc(PVM pVM, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, uint16_t iUser, uint32_t iUserTable, PPPGMPOOLPAGE ppPage); 2928 PPGMPOOLPAGE pgmPoolGetPageByHCPhys(PVM pVM, RTHCPHYS HCPhys);2929 2928 void pgmPoolFree(PVM pVM, RTHCPHYS HCPhys, uint16_t iUser, uint32_t iUserTable); 2930 2929 void pgmPoolFreeByPage(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint32_t iUserTable); … … 2969 2968 PX86PDPAE pgmGstLazyMapPaePD(PPGMCPU pPGM, uint32_t iPdpt); 2970 2969 PX86PML4 pgmGstLazyMapPml4(PPGMCPU pPGM); 2970 2971 /* Forward decl */ 2972 DECLINLINE(PPGMPOOLPAGE) pgmPoolGetPage(PPGMPOOL pPool, RTHCPHYS HCPhys); 2971 2973 2972 2974 __END_DECLS … … 4036 4038 4037 4039 /* Fetch the pgm pool shadow descriptor. */ 4038 PPGMPOOLPAGE pShwPde = pgmPoolGetPageByHCPhys(PGMCPU2VM(pPGM), pPdpt->a[iPdpt].u & X86_PDPE_PG_MASK);4040 PPGMPOOLPAGE pShwPde = pgmPoolGetPage(PGMCPU2PGM(pPGM)->CTX_SUFF(pPool), pPdpt->a[iPdpt].u & X86_PDPE_PG_MASK); 4039 4041 AssertReturn(pShwPde, NULL); 4040 4042 … … 4058 4060 4059 4061 /* Fetch the pgm pool shadow descriptor. */ 4060 PPGMPOOLPAGE pShwPde = pgmPoolGetPage ByHCPhys(PGMCPU2VM(pPGM), pPdpt->a[iPdpt].u & X86_PDPE_PG_MASK);4062 PPGMPOOLPAGE pShwPde = pgmPoolGetPage(PGMCPU2PGM(pPGM)->CTX_SUFF(pPool), pPdpt->a[iPdpt].u & X86_PDPE_PG_MASK); 4061 4063 AssertReturn(pShwPde, NULL); 4062 4064 -
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r19141 r19329 959 959 960 960 /* Fetch the pgm pool shadow descriptor. */ 961 PPGMPOOLPAGE pShwPde = pgmPoolGetPage ByHCPhys(PGMCPU2VM(pPGM), pPdpt->a[iPdPt].u & X86_PDPE_PG_MASK);961 PPGMPOOLPAGE pShwPde = pgmPoolGetPage(PGMCPU2PGM(pPGM)->CTX_SUFF(pPool), pPdpt->a[iPdPt].u & X86_PDPE_PG_MASK); 962 962 AssertReturn(pShwPde, VERR_INTERNAL_ERROR); 963 963 -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r19195 r19329 922 922 int rc; 923 923 PVM pVM = pVCpu->CTX_SUFF(pVM); 924 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool); 924 925 925 926 LogFlow(("InvalidatePage %RGv\n", GCPtrPage)); … … 1058 1059 1059 1060 # if PGM_GST_TYPE == PGM_TYPE_AMD64 1060 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);1061 1062 1061 /* Fetch the pgm pool shadow descriptor. */ 1063 PPGMPOOLPAGE pShwPdpt = pgmPoolGetPage ByHCPhys(pVM, pPml4eDst->u & X86_PML4E_PG_MASK);1062 PPGMPOOLPAGE pShwPdpt = pgmPoolGetPage(pPool, pPml4eDst->u & X86_PML4E_PG_MASK); 1064 1063 Assert(pShwPdpt); 1065 1064 1066 1065 /* Fetch the pgm pool shadow descriptor. */ 1067 PPGMPOOLPAGE pShwPde = pgmPoolGetPage ByHCPhys(pVM, pPdptDst->a[iPdpt].u & SHW_PDPE_PG_MASK);1066 PPGMPOOLPAGE pShwPde = pgmPoolGetPage(pPool, pPdptDst->a[iPdpt].u & SHW_PDPE_PG_MASK); 1068 1067 Assert(pShwPde); 1069 1068 … … 1148 1147 } 1149 1148 # endif /* PGM_GST_TYPE == PGM_TYPE_AMD64 */ 1150 1151 1149 1152 1150 /* … … 1195 1193 * 4KB - page. 1196 1194 */ 1197 PPGMPOOLPAGE pShwPage = pgmPoolGetPage ByHCPhys(pVM, PdeDst.u & SHW_PDE_PG_MASK);1195 PPGMPOOLPAGE pShwPage = pgmPoolGetPage(pPool, PdeDst.u & SHW_PDE_PG_MASK); 1198 1196 RTGCPHYS GCPhys = PdeSrc.u & GST_PDE_PG_MASK; 1199 1197 # if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE == PGM_TYPE_32BIT … … 1241 1239 */ 1242 1240 /* Before freeing the page, check if anything really changed. */ 1243 PPGMPOOLPAGE pShwPage = pgmPoolGetPage ByHCPhys(pVM, PdeDst.u & SHW_PDE_PG_MASK);1241 PPGMPOOLPAGE pShwPage = pgmPoolGetPage(pPool, PdeDst.u & SHW_PDE_PG_MASK); 1244 1242 RTGCPHYS GCPhys = GST_GET_PDE_BIG_PG_GCPHYS(PdeSrc); 1245 1243 # if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE == PGM_TYPE_32BIT … … 1597 1595 PGM_BTH_DECL(int, SyncPage)(PVMCPU pVCpu, GSTPDE PdeSrc, RTGCPTR GCPtrPage, unsigned cPages, unsigned uErr) 1598 1596 { 1599 PVM pVM = pVCpu->CTX_SUFF(pVM); 1597 PVM pVM = pVCpu->CTX_SUFF(pVM); 1598 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool); 1600 1599 LogFlow(("SyncPage: GCPtrPage=%RGv cPages=%u uErr=%#x\n", GCPtrPage, cPages, uErr)); 1601 1600 … … 1652 1651 PX86PDEPAE pPdeDst = &pPDDst->a[iPDDst]; 1653 1652 # endif 1654 1655 1653 SHWPDE PdeDst = *pPdeDst; 1656 1654 AssertMsg(PdeDst.n.u1Present, ("%p=%llx\n", pPdeDst, (uint64_t)PdeDst.u)); 1657 PPGMPOOLPAGE pShwPage = pgmPoolGetPage ByHCPhys(pVM, PdeDst.u & SHW_PDE_PG_MASK);1655 PPGMPOOLPAGE pShwPage = pgmPoolGetPage(pPool, PdeDst.u & SHW_PDE_PG_MASK); 1658 1656 1659 1657 # if PGM_GST_TYPE == PGM_TYPE_AMD64 1660 1658 /* Fetch the pgm pool shadow descriptor. */ 1661 PPGMPOOLPAGE pShwPde = pgmPoolGetPage ByHCPhys(pVM, pPdptDst->a[iPdpt].u & X86_PDPE_PG_MASK);1659 PPGMPOOLPAGE pShwPde = pgmPoolGetPage(pPool, pPdptDst->a[iPdpt].u & X86_PDPE_PG_MASK); 1662 1660 Assert(pShwPde); 1663 1661 # endif … … 1900 1898 * Yea, I'm lazy. 1901 1899 */ 1902 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);1903 1900 pgmPoolFreeByPage(pPool, pShwPage, pShwPde->idx, iPDDst); 1904 1901 … … 1953 1950 # endif 1954 1951 AssertMsg(PdeDst.n.u1Present, ("%#llx\n", (uint64_t)PdeDst.u)); 1955 PPGMPOOLPAGE pShwPage = pgmPoolGetPageByHCPhys(pVM, PdeDst.u & SHW_PDE_PG_MASK);1956 PSHWPT pPTDst= (PSHWPT)PGMPOOL_PAGE_2_PTR(pVM, pShwPage);1952 PPGMPOOLPAGE pShwPage = pgmPoolGetPage(pPool, PdeDst.u & SHW_PDE_PG_MASK); 1953 PSHWPT pPTDst = (PSHWPT)PGMPOOL_PAGE_2_PTR(pVM, pShwPage); 1957 1954 1958 1955 Assert(cPages == 1 || !(uErr & X86_TRAP_PF_P)); … … 2068 2065 int rc; 2069 2066 PVM pVM = pVCpu->CTX_SUFF(pVM); 2067 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool); 2070 2068 2071 2069 STAM_PROFILE_START(&pVCpu->pgm.s.CTX_MID_Z(Stat,DirtyBitTracking), a); … … 2249 2247 * Map shadow page table. 2250 2248 */ 2251 PPGMPOOLPAGE pShwPage = pgmPoolGetPage ByHCPhys(pVM, pPdeDst->u & SHW_PDE_PG_MASK);2249 PPGMPOOLPAGE pShwPage = pgmPoolGetPage(pPool, pPdeDst->u & SHW_PDE_PG_MASK); 2252 2250 if (pShwPage) 2253 2251 { … … 2291 2289 && pPdeDst->n.u1Present) 2292 2290 { 2293 PPGMPOOLPAGE pShwPage = pgmPoolGetPage ByHCPhys(pVM, pPdeDst->u & SHW_PDE_PG_MASK);2291 PPGMPOOLPAGE pShwPage = pgmPoolGetPage(pPool, pPdeDst->u & SHW_PDE_PG_MASK); 2294 2292 PSHWPT pPTDst = (PSHWPT)PGMPOOL_PAGE_2_PTR(pVM, pShwPage); 2295 2293 PSHWPTE pPteDst = &pPTDst->a[(GCPtrPage >> SHW_PT_SHIFT) & SHW_PT_MASK]; … … 2367 2365 PGM_BTH_DECL(int, SyncPT)(PVMCPU pVCpu, unsigned iPDSrc, PGSTPD pPDSrc, RTGCPTR GCPtrPage) 2368 2366 { 2369 PVM pVM = pVCpu->CTX_SUFF(pVM); 2367 PVM pVM = pVCpu->CTX_SUFF(pVM); 2368 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool); 2370 2369 2371 2370 STAM_PROFILE_START(&pVCpu->pgm.s.CTX_MID_Z(Stat,SyncPT), a); … … 2421 2420 # if PGM_GST_TYPE == PGM_TYPE_AMD64 2422 2421 /* Fetch the pgm pool shadow descriptor. */ 2423 PPGMPOOLPAGE pShwPde = pgmPoolGetPage ByHCPhys(pVM, pPdptDst->a[iPdpt].u & X86_PDPE_PG_MASK);2422 PPGMPOOLPAGE pShwPde = pgmPoolGetPage(pPool, pPdptDst->a[iPdpt].u & X86_PDPE_PG_MASK); 2424 2423 Assert(pShwPde); 2425 2424 # endif … … 2836 2835 2837 2836 /* Fetch the pgm pool shadow descriptor. */ 2838 PPGMPOOLPAGE pShwPde = pgmPoolGetPage ByHCPhys(pVM, pPdptDst->a[iPdpt].u & X86_PDPE_PG_MASK);2837 PPGMPOOLPAGE pShwPde = pgmPoolGetPage(pPool, pPdptDst->a[iPdpt].u & X86_PDPE_PG_MASK); 2839 2838 Assert(pShwPde); 2840 2839 … … 2855 2854 2856 2855 /* Fetch the pgm pool shadow descriptor. */ 2857 PPGMPOOLPAGE pShwPde = pgmPoolGetPage ByHCPhys(pVM, pPdptDst->a[iPdpt].u & EPT_PDPTE_PG_MASK);2856 PPGMPOOLPAGE pShwPde = pgmPoolGetPage(pPool, pPdptDst->a[iPdpt].u & EPT_PDPTE_PG_MASK); 2858 2857 Assert(pShwPde); 2859 2858 # endif … … 3385 3384 unsigned cErrors = 0; 3386 3385 PVM pVM = pVCpu->CTX_SUFF(pVM); 3386 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool); 3387 3387 3388 3388 #if PGM_GST_TYPE == PGM_TYPE_PAE … … 3455 3455 /** @todo call the other two PGMAssert*() functions. */ 3456 3456 3457 # if PGM_GST_TYPE == PGM_TYPE_AMD64 || PGM_GST_TYPE == PGM_TYPE_PAE3458 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);3459 # endif3460 3461 3457 # if PGM_GST_TYPE == PGM_TYPE_AMD64 3462 3458 unsigned iPml4 = (GCPtr >> X86_PML4_SHIFT) & X86_PML4_MASK; … … 3627 3623 { 3628 3624 HCPhysShw = PdeDst.u & SHW_PDE_PG_MASK; 3629 PPGMPOOLPAGE pPoolPage = pgmPoolGetPage ByHCPhys(pVM, HCPhysShw);3625 PPGMPOOLPAGE pPoolPage = pgmPoolGetPage(pPool, HCPhysShw); 3630 3626 if (!pPoolPage) 3631 3627 { -
trunk/src/VBox/VMM/VMMAll/PGMAllMap.cpp
r19246 r19329 232 232 PGMMODE enmShadowMode = PGMGetShadowMode(pVCpu); 233 233 Assert(enmShadowMode <= PGMMODE_PAE_NX); 234 235 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool); 234 236 235 237 /* … … 310 312 * Mark the page as locked; disallow flushing. 311 313 */ 312 PPGMPOOLPAGE pPoolPagePd = pgmPoolGetPage ByHCPhys(pVM, pShwPdpt->a[iPdPt].u & X86_PDPE_PG_MASK);314 PPGMPOOLPAGE pPoolPagePd = pgmPoolGetPage(pPool, pShwPdpt->a[iPdPt].u & X86_PDPE_PG_MASK); 313 315 AssertFatal(pPoolPagePd); 314 316 if (!pgmPoolIsPageLocked(&pVM->pgm.s, pPoolPagePd)) … … 399 401 # endif 400 402 403 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool); 404 401 405 PX86PDPT pCurrentShwPdpt = NULL; 402 406 if ( PGMGetGuestMode(pVCpu) >= PGMMODE_PAE … … 486 490 || !(pShwPdpt->a[iPdpt].u & PGM_PLXFLAGS_MAPPING)) 487 491 { 488 PPGMPOOLPAGE pPoolPagePd = pgmPoolGetPage ByHCPhys(pVM, pShwPdpt->a[iPdpt].u & X86_PDPE_PG_MASK);492 PPGMPOOLPAGE pPoolPagePd = pgmPoolGetPage(pPool, pShwPdpt->a[iPdpt].u & X86_PDPE_PG_MASK); 489 493 AssertFatal(pPoolPagePd); 490 494 if (pgmPoolIsPageLocked(&pVM->pgm.s, pPoolPagePd)) … … 523 527 uint32_t i = pMap->cPTs; 524 528 PGMMODE enmShadowMode = PGMGetShadowMode(pVCpu); 529 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool); 525 530 526 531 iPDE += i; … … 570 575 iPDE, iPdpt, iPaePDE, pMap->GCPtr, R3STRING(pMap->pszDesc) )); 571 576 572 PCPGMPOOLPAGE pPoolPagePd = pgmPoolGetPage ByHCPhys(pVM, pShwPdpt->a[iPdpt].u & X86_PDPE_PG_MASK);577 PCPGMPOOLPAGE pPoolPagePd = pgmPoolGetPage(pPool, pShwPdpt->a[iPdpt].u & X86_PDPE_PG_MASK); 573 578 AssertFatal(pPoolPagePd); 574 579 AssertMsg(pPoolPagePd->fLocked, (".idx=%d .type=%d\n", pPoolPagePd->idx, pPoolPagePd->enmKind)); -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r19319 r19329 3980 3980 int pgmPoolFlushPage(PPGMPOOL pPool, PPGMPOOLPAGE pPage) 3981 3981 { 3982 PVM pVM = pPool->CTX_SUFF(pVM); 3983 3982 3984 int rc = VINF_SUCCESS; 3983 3985 STAM_PROFILE_START(&pPool->StatFlushPage, f); … … 3995 3997 } 3996 3998 3999 pgmLock(pVM); 4000 3997 4001 /* 3998 4002 * Quietly reject any attempts at flushing the currently active shadow CR3 mapping 3999 4003 */ 4000 if (pgmPoolIsPageLocked(&p Pool->CTX_SUFF(pVM)->pgm.s, pPage))4004 if (pgmPoolIsPageLocked(&pVM->pgm.s, pPage)) 4001 4005 { 4002 4006 AssertMsg( pPage->enmKind == PGMPOOLKIND_64BIT_PML4 … … 4009 4013 || pPage->enmKind == PGMPOOLKIND_PAE_PD2_FOR_32BIT_PD 4010 4014 || pPage->enmKind == PGMPOOLKIND_PAE_PD3_FOR_32BIT_PD, 4011 ("Can't free the shadow CR3! (%RHp vs %RHp kind=%d\n", PGMGetHyperCR3(VMMGetCpu(p Pool->CTX_SUFF(pVM))), pPage->Core.Key, pPage->enmKind));4015 ("Can't free the shadow CR3! (%RHp vs %RHp kind=%d\n", PGMGetHyperCR3(VMMGetCpu(pVM)), pPage->Core.Key, pPage->enmKind)); 4012 4016 Log(("pgmPoolFlushPage: current active shadow CR3, rejected. enmKind=%s idx=%d\n", pgmPoolPoolKindToStr(pPage->enmKind), pPage->idx)); 4017 pgmUnlock(pVM); 4013 4018 return VINF_SUCCESS; 4014 4019 } … … 4016 4021 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 4017 4022 /* Start a subset so we won't run out of mapping space. */ 4018 PVMCPU pVCpu = VMMGetCpu(p Pool->CTX_SUFF(pVM));4023 PVMCPU pVCpu = VMMGetCpu(pVM); 4019 4024 uint32_t iPrevSubset = PGMDynMapPushAutoSubset(pVCpu); 4020 4025 #endif … … 4066 4071 4067 4072 pPool->cUsedPages--; 4073 pgmUnlock(pVM); 4068 4074 STAM_PROFILE_STOP(&pPool->StatFlushPage, f); 4069 4075 return rc; … … 4084 4090 void pgmPoolFreeByPage(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint32_t iUserTable) 4085 4091 { 4092 PVM pVM = pPool->CTX_SUFF(pVM); 4093 4086 4094 STAM_PROFILE_START(&pPool->StatFree, a); 4087 4095 LogFlow(("pgmPoolFreeByPage: pPage=%p:{.Key=%RHp, .idx=%d, enmKind=%s} iUser=%#x iUserTable=%#x\n", 4088 4096 pPage, pPage->Core.Key, pPage->idx, pgmPoolPoolKindToStr(pPage->enmKind), iUser, iUserTable)); 4089 4097 Assert(pPage->idx >= PGMPOOL_IDX_FIRST); 4098 pgmLock(pVM); 4090 4099 #ifdef PGMPOOL_WITH_USER_TRACKING 4091 4100 pgmPoolTrackFreeUser(pPool, pPage, iUser, iUserTable); … … 4095 4104 #endif 4096 4105 pgmPoolFlushPage(pPool, pPage); 4106 pgmUnlock(pVM); 4097 4107 STAM_PROFILE_STOP(&pPool->StatFree, a); 4098 4108 } … … 4301 4311 } 4302 4312 4303 4304 /**4305 * Gets a in-use page in the pool by it's physical address.4306 *4307 * @returns Pointer to the page.4308 * @param pVM The VM handle.4309 * @param HCPhys The HC physical address of the shadow page.4310 * @remark This function will NEVER return NULL. It will assert if HCPhys is invalid.4311 */4312 PPGMPOOLPAGE pgmPoolGetPageByHCPhys(PVM pVM, RTHCPHYS HCPhys)4313 {4314 /** @todo profile this! */4315 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);4316 PPGMPOOLPAGE pPage = pgmPoolGetPage(pPool, HCPhys);4317 #ifndef DEBUG_bird /* extremely noisy */4318 Log5(("pgmPoolGetPageByHCPhys: HCPhys=%RHp -> %p:{.idx=%d .GCPhys=%RGp .enmKind=%s}\n",4319 HCPhys, pPage, pPage->idx, pPage->GCPhys, pgmPoolPoolKindToStr(pPage->enmKind)));4320 #endif4321 return pPage;4322 }4323 4313 4324 4314 #ifdef IN_RING3
Note:
See TracChangeset
for help on using the changeset viewer.