儲存庫 vbox 的更動 16840
- 時間撮記:
- 2009-2-17 下午01:26:14 (16 年 以前)
- 位置:
- trunk/src/VBox/VMM
- 檔案:
-
- 修改 4 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/VMM/PGMInternal.h
r16626 r16840 2979 2979 2980 2980 #ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY 2981 void pgmMapClearShadowPDEs(PVM pVM, PPGM MAPPING pMap, unsigned iOldPDE);2981 void pgmMapClearShadowPDEs(PVM pVM, PPGMPOOLPAGE pShwPageCR3, PPGMMAPPING pMap, unsigned iOldPDE); 2982 2982 void pgmMapSetShadowPDEs(PVM pVM, PPGMMAPPING pMap, unsigned iNewPDE); 2983 int pgmMapDeactivateCR3(PVM pVM, PPGMPOOLPAGE pShwPageCR3); 2983 2984 #endif 2984 2985 … … 4290 4291 } 4291 4292 4293 /** 4294 * Gets the shadow page directory for the specified address, PAE. 4295 * 4296 * @returns Pointer to the shadow PD. 4297 * @param pPGM Pointer to the PGM instance data. 4298 * @param GCPtr The address. 4299 */ 4300 DECLINLINE(PX86PDPAE) pgmShwGetPaePDPtr(PPGM pPGM, PX86PDPT pPdpt, RTGCPTR GCPtr) 4301 { 4302 #ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY 4303 const unsigned iPdpt = (GCPtr >> X86_PDPT_SHIFT) & X86_PDPT_MASK_PAE; 4304 4305 if (!pPdpt->a[iPdpt].n.u1Present) 4306 return NULL; 4307 4308 /* Fetch the pgm pool shadow descriptor. */ 4309 PPGMPOOLPAGE pShwPde = pgmPoolGetPageByHCPhys(PGM2VM(pPGM), pPdpt->a[iPdpt].u & X86_PDPE_PG_MASK); 4310 AssertReturn(pShwPde, NULL); 4311 4312 return (PX86PDPAE)PGMPOOL_PAGE_2_PTR_BY_PGM(pPGM, pShwPde); 4313 #else 4314 AssertFailed(); 4315 return NULL; 4316 #endif 4317 } 4292 4318 4293 4319 /** -
trunk/src/VBox/VMM/PGMMap.cpp
r16413 r16840 929 929 930 930 #ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY 931 pgmMapClearShadowPDEs(pVM, p Map, iOldPDE);931 pgmMapClearShadowPDEs(pVM, pVM->pgm.s.CTX_SUFF(pShwPageCR3), pMap, iOldPDE); 932 932 #endif 933 933 -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r16800 r16840 4633 4633 * Update the shadow root page as well since that's not fixed. 4634 4634 */ 4635 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool); 4636 if (pVM->pgm.s.CTX_SUFF(pShwPageCR3)) 4637 { 4638 /* Remove the hypervisor mappings from the shadow page table. */ 4639 PGMMapDeactivateAll(pVM); 4640 4641 /* It might have been freed already by a pool flush (see e.g. PGMR3MappingsUnfix). */ 4642 /** @todo Coordinate this better with the pool. */ 4643 if (pVM->pgm.s.CTX_SUFF(pShwPageCR3)->enmKind != PGMPOOLKIND_FREE) 4644 pgmPoolFreeByPage(pPool, pVM->pgm.s.CTX_SUFF(pShwPageCR3), pVM->pgm.s.iShwUser, pVM->pgm.s.iShwUserTable); 4645 pVM->pgm.s.pShwPageCR3R3 = 0; 4646 pVM->pgm.s.pShwPageCR3RC = 0; 4647 pVM->pgm.s.pShwPageCR3R0 = 0; 4648 pVM->pgm.s.pShwRootR3 = 0; 4649 # ifndef VBOX_WITH_2X_4GB_ADDR_SPACE 4650 pVM->pgm.s.pShwRootR0 = 0; 4651 # endif 4652 pVM->pgm.s.HCPhysShwCR3 = 0; 4653 pVM->pgm.s.iShwUser = 0; 4654 pVM->pgm.s.iShwUserTable = 0; 4655 } 4635 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool); 4636 PPGMPOOLPAGE pOldShwPageCR3 = pVM->pgm.s.CTX_SUFF(pShwPageCR3); 4637 uint32_t iOldShwUserTable = pVM->pgm.s.iShwUserTable; 4638 uint32_t iOldShwUser = pVM->pgm.s.iShwUser; 4656 4639 4657 4640 Assert(!(GCPhysCR3 >> (PAGE_SHIFT + 32))); 4658 pVM->pgm.s.iShwUser = SHW_POOL_ROOT_IDX; 4659 pVM->pgm.s.iShwUserTable = GCPhysCR3 >> PAGE_SHIFT; 4660 rc = pgmPoolAlloc(pVM, GCPhysCR3 & GST_CR3_PAGE_MASK, BTH_PGMPOOLKIND_ROOT, pVM->pgm.s.iShwUser, pVM->pgm.s.iShwUserTable, &pVM->pgm.s.CTX_SUFF(pShwPageCR3)); 4641 rc = pgmPoolAlloc(pVM, GCPhysCR3 & GST_CR3_PAGE_MASK, BTH_PGMPOOLKIND_ROOT, SHW_POOL_ROOT_IDX, GCPhysCR3 >> PAGE_SHIFT, &pVM->pgm.s.CTX_SUFF(pShwPageCR3)); 4661 4642 if (rc == VERR_PGM_POOL_FLUSHED) 4662 4643 { … … 4666 4647 } 4667 4648 AssertRCReturn(rc, rc); 4649 pVM->pgm.s.iShwUser = SHW_POOL_ROOT_IDX; 4650 pVM->pgm.s.iShwUserTable = GCPhysCR3 >> PAGE_SHIFT; 4668 4651 # ifdef IN_RING0 4669 4652 pVM->pgm.s.pShwPageCR3R3 = MMHyperCCToR3(pVM, pVM->pgm.s.CTX_SUFF(pShwPageCR3)); … … 4683 4666 pVM->pgm.s.HCPhysShwCR3 = pVM->pgm.s.CTX_SUFF(pShwPageCR3)->Core.Key; 4684 4667 4668 # ifndef PGM_WITHOUT_MAPPINGS 4685 4669 /* Apply all hypervisor mappings to the new CR3. */ 4686 4670 rc = PGMMapActivateAll(pVM); 4671 AssertRC(rc); 4672 # endif 4673 /* Clean up the old CR3 root. */ 4674 if (pOldShwPageCR3) 4675 { 4676 # ifndef PGM_WITHOUT_MAPPINGS 4677 /* Remove the hypervisor mappings from the shadow page table. */ 4678 pgmMapDeactivateCR3(pVM, pOldShwPageCR3); 4679 # endif 4680 /* It might have been freed already by a pool flush (see e.g. PGMR3MappingsUnfix). */ 4681 /** @todo Coordinate this better with the pool. */ 4682 if (pOldShwPageCR3->enmKind != PGMPOOLKIND_FREE) 4683 pgmPoolFreeByPage(pPool, pOldShwPageCR3, iOldShwUser, iOldShwUserTable); 4684 } 4685 4687 4686 # endif 4688 4687 #endif /* VBOX_WITH_PGMPOOL_PAGING_ONLY */ … … 4754 4753 #endif 4755 4754 4756 #if def VBOX_WITH_PGMPOOL_PAGING_ONLY4755 #if defined(VBOX_WITH_PGMPOOL_PAGING_ONLY) && !defined(IN_RC) /* In RC we rely on MapCR3 to do the shadow part for us at a safe time */ 4757 4756 /* Update shadow paging info. */ 4758 # if ( ( PGM_SHW_TYPE == PGM_TYPE_32BIT \4757 # if ( ( PGM_SHW_TYPE == PGM_TYPE_32BIT \ 4759 4758 || PGM_SHW_TYPE == PGM_TYPE_PAE \ 4760 4759 || PGM_SHW_TYPE == PGM_TYPE_AMD64) \ … … 4764 4763 Assert(!HWACCMIsNestedPagingActive(pVM)); 4765 4764 4766 /* @todo: dangerous as it's the current CR3! */ 4765 # ifndef PGM_WITHOUT_MAPPINGS 4767 4766 /* Remove the hypervisor mappings from the shadow page table. */ 4768 4767 PGMMapDeactivateAll(pVM); 4768 # endif 4769 4769 4770 4770 pVM->pgm.s.pShwRootR3 = 0; … … 4783 4783 } 4784 4784 # endif 4785 #endif /* VBOX_WITH_PGMPOOL_PAGING_ONLY */4785 #endif /* VBOX_WITH_PGMPOOL_PAGING_ONLY && !IN_RC*/ 4786 4786 4787 4787 return rc; -
trunk/src/VBox/VMM/VMMAll/PGMAllMap.cpp
r16797 r16840 209 209 210 210 211 #ifndef IN_RING0 211 212 /** 212 213 * Sets all PDEs involved with the mapping in the shadow page table. … … 313 314 * 314 315 * @param pVM The VM handle. 316 * @param pShwPageCR3 CR3 root page 315 317 * @param pMap Pointer to the mapping in question. 316 318 * @param iOldPDE The index of the 32-bit PDE corresponding to the base of the mapping. 317 319 */ 318 void pgmMapClearShadowPDEs(PVM pVM, PPGMMAPPING pMap, unsigned iOldPDE) 319 { 320 unsigned i = pMap->cPTs; 321 PGMMODE enmShadowMode = PGMGetShadowMode(pVM); 320 void pgmMapClearShadowPDEs(PVM pVM, PPGMPOOLPAGE pShwPageCR3, PPGMMAPPING pMap, unsigned iOldPDE) 321 { 322 Assert(pShwPageCR3); 322 323 323 324 if (!pgmMapAreMappingsEnabled(&pVM->pgm.s)) … … 329 330 #endif 330 331 332 unsigned i = pMap->cPTs; 333 PGMMODE enmShadowMode = PGMGetShadowMode(pVM); 334 331 335 iOldPDE += i; 332 336 while (i-- > 0) … … 338 342 case PGMMODE_32_BIT: 339 343 { 340 PX86PD pShw32BitPd = pgmShwGet32BitPDPtr(&pVM->pgm.s);344 PX86PD pShw32BitPd = (PX86PD)PGMPOOL_PAGE_2_PTR_BY_PGM(&pVM->pgm.s, pShwPageCR3); 341 345 AssertFatal(pShw32BitPd); 342 346 … … 353 357 const unsigned iPD = iOldPDE / 256; /* iOldPDE * 2 / 512; iOldPDE is in 4 MB pages */ 354 358 unsigned iPDE = iOldPDE * 2 % 512; 355 pPdpt = pgmShwGetPaePDPTPtr(&pVM->pgm.s);356 pShwPaePd = pgmShwGetPaePDPtr(&pVM->pgm.s, (iPD << X86_PDPT_SHIFT));359 pPdpt = (PX86PDPT)PGMPOOL_PAGE_2_PTR_BY_PGM(&pVM->pgm.s, pShwPageCR3); 360 pShwPaePd = pgmShwGetPaePDPtr(&pVM->pgm.s, pPdpt, (iPD << X86_PDPT_SHIFT)); 357 361 AssertFatal(pShwPaePd); 358 362 … … 374 378 } 375 379 } 380 #endif /* !IN_RING0 */ 376 381 377 382 /** … … 389 394 return VINF_SUCCESS; 390 395 391 #ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY 396 #ifdef IN_RING0 397 AssertFailed(); 398 return VERR_INTERNAL_ERROR; 399 #else 400 # ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY 392 401 Assert(pVM->pgm.s.CTX_SUFF(pShwPageCR3)); 393 # endif402 # endif 394 403 395 404 /* … … 402 411 pgmMapSetShadowPDEs(pVM, pCur, iPDE); 403 412 } 404 405 413 return VINF_SUCCESS; 414 #endif /* IN_RING0 */ 406 415 } 407 416 … … 420 429 return VINF_SUCCESS; 421 430 422 #ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY 431 #ifdef IN_RING0 432 AssertFailed(); 433 return VERR_INTERNAL_ERROR; 434 #else 435 # ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY 423 436 Assert(pVM->pgm.s.CTX_SUFF(pShwPageCR3)); 424 # endif437 # endif 425 438 426 439 /* … … 431 444 unsigned iPDE = pCur->GCPtr >> X86_PD_SHIFT; 432 445 433 pgmMapClearShadowPDEs(pVM, p Cur, iPDE);446 pgmMapClearShadowPDEs(pVM, pVM->pgm.s.CTX_SUFF(pShwPageCR3), pCur, iPDE); 434 447 } 435 448 return VINF_SUCCESS; 436 } 449 #endif /* IN_RING0 */ 450 } 451 452 453 /** 454 * Remove the hypervisor mappings from the specified CR3 455 * 456 * @returns VBox status. 457 * @param pVM The virtual machine. 458 * @param pShwPageCR3 CR3 root page 459 */ 460 int pgmMapDeactivateCR3(PVM pVM, PPGMPOOLPAGE pShwPageCR3) 461 { 462 /* 463 * Can skip this if mappings are safely fixed. 464 */ 465 if (pVM->pgm.s.fMappingsFixed) 466 return VINF_SUCCESS; 467 468 #ifdef IN_RING0 469 AssertFailed(); 470 return VERR_INTERNAL_ERROR; 471 #else 472 # ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY 473 Assert(pVM->pgm.s.CTX_SUFF(pShwPageCR3)); 474 # endif 475 476 /* 477 * Iterate mappings. 478 */ 479 for (PPGMMAPPING pCur = pVM->pgm.s.CTX_SUFF(pMappings); pCur; pCur = pCur->CTX_SUFF(pNext)) 480 { 481 unsigned iPDE = pCur->GCPtr >> X86_PD_SHIFT; 482 483 pgmMapClearShadowPDEs(pVM, pShwPageCR3, pCur, iPDE); 484 } 485 return VINF_SUCCESS; 486 #endif /* IN_RING0 */ 487 }
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器