VirtualBox

儲存庫 vbox 的更動 17005


忽略:
時間撮記:
2009-2-23 下午12:10:36 (16 年 以前)
作者:
vboxsync
訊息:

VBOX_WITH_PGMPOOL_PAGING_ONLY: PGMMapCheck added

位置:
trunk
檔案:
修改 3 筆資料

圖例:

未更動
新增
刪除
  • trunk/include/VBox/pgm.h

    r16996 r17005  
    334334VMMDECL(bool)       PGMMapHasConflicts(PVM pVM);
    335335VMMDECL(int)        PGMMapResolveConflicts(PVM pVM);
     336#endif
     337#ifdef VBOX_STRICT
     338VMMDECL(void)       PGMMapCheck(PVM pVM);
    336339#endif
    337340VMMDECL(int)        PGMShwGetPage(PVM pVM, RTGCPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys);
  • trunk/src/VBox/VMM/VMM.cpp

    r16862 r17005  
    10731073    {
    10741074        Assert(CPUMGetHyperCR3(pVM) && CPUMGetHyperCR3(pVM) == PGMGetHyperCR3(pVM));
     1075#ifdef VBOX_STRICT
     1076        PGMMapCheck(pVM);
     1077#endif
    10751078        int rc;
    10761079        do
  • trunk/src/VBox/VMM/VMMAll/PGMAllMap.cpp

    r16924 r17005  
    419419#endif /* !IN_RING0 */
    420420
     421#ifdef VBOX_STRICT
     422/**
     423 * Clears all PDEs involved with the mapping in the shadow page table.
     424 *
     425 * @param   pVM         The VM handle.
     426 * @param   pShwPageCR3 CR3 root page
     427 * @param   pMap        Pointer to the mapping in question.
     428 * @param   iPDE        The index of the 32-bit PDE corresponding to the base of the mapping.
     429 */
     430void pgmMapCheckShadowPDEs(PVM pVM, PPGMPOOLPAGE pShwPageCR3, PPGMMAPPING pMap, unsigned iPDE)
     431{
     432    Log(("pgmMapCheckShadowPDEs pde %x (mappings enabled %d)\n", iPDE, pgmMapAreMappingsEnabled(&pVM->pgm.s)));
     433
     434    if (!pgmMapAreMappingsEnabled(&pVM->pgm.s))
     435        return;
     436
     437#ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY
     438    Assert(pShwPageCR3);
     439#endif
     440
     441    unsigned i = pMap->cPTs;
     442    PGMMODE  enmShadowMode = PGMGetShadowMode(pVM);
     443
     444    iPDE += i;
     445    while (i-- > 0)
     446    {
     447        iPDE--;
     448
     449        switch(enmShadowMode)
     450        {
     451            case PGMMODE_32_BIT:
     452            {
     453#ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY
     454                PX86PD pShw32BitPd = (PX86PD)PGMPOOL_PAGE_2_PTR_BY_PGM(&pVM->pgm.s, pShwPageCR3);
     455#else
     456                PX86PD pShw32BitPd = pgmShwGet32BitPDPtr(&pVM->pgm.s);
     457#endif
     458                AssertFatal(pShw32BitPd);
     459
     460                AssertMsg(pShw32BitPd->a[iPDE].u == (PGM_PDFLAGS_MAPPING | X86_PDE_P | X86_PDE_A | X86_PDE_RW | X86_PDE_US | (uint32_t)pMap->aPTs[i].HCPhysPT),
     461                          ("Expected %x vs %x\n", pShw32BitPd->a[iPDE].u, (PGM_PDFLAGS_MAPPING | X86_PDE_P | X86_PDE_A | X86_PDE_RW | X86_PDE_US | (uint32_t)pMap->aPTs[i].HCPhysPT)));
     462                break;
     463            }
     464
     465            case PGMMODE_PAE:
     466            case PGMMODE_PAE_NX:
     467            {
     468                PX86PDPT  pPdpt = NULL;
     469                PX86PDPAE pShwPaePd = NULL;
     470
     471                const unsigned iPD = iPDE / 256;         /* iPDE * 2 / 512; iPDE is in 4 MB pages */
     472                unsigned iPaePDE = iPDE * 2 % 512;
     473#ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY
     474                pPdpt     = (PX86PDPT)PGMPOOL_PAGE_2_PTR_BY_PGM(&pVM->pgm.s, pShwPageCR3);
     475                pShwPaePd = pgmShwGetPaePDPtr(&pVM->pgm.s, pPdpt, (iPD << X86_PDPT_SHIFT));
     476#else
     477                pPdpt     = pgmShwGetPaePDPTPtr(&pVM->pgm.s);
     478                pShwPaePd = pgmShwGetPaePDPtr(&pVM->pgm.s, (iPD << X86_PDPT_SHIFT));
     479#endif
     480                AssertFatal(pShwPaePd);
     481
     482                AssertMsg(pShwPaePd->a[iPaePDE].u == (PGM_PDFLAGS_MAPPING | X86_PDE_P | X86_PDE_A | X86_PDE_RW | X86_PDE_US | pMap->aPTs[i].HCPhysPaePT0),
     483                         ("Expected %RX64 vs %RX64\n", pShwPaePd->a[iPDE].u, (PGM_PDFLAGS_MAPPING | X86_PDE_P | X86_PDE_A | X86_PDE_RW | X86_PDE_US | (uint32_t)pMap->aPTs[i].HCPhysPT)));
     484
     485                iPaePDE++;
     486                AssertFatal(iPaePDE < 512);
     487
     488                AssertMsg(pShwPaePd->a[iPaePDE].u == (PGM_PDFLAGS_MAPPING | X86_PDE_P | X86_PDE_A | X86_PDE_RW | X86_PDE_US | pMap->aPTs[i].HCPhysPaePT1),
     489                         ("Expected %RX64 vs %RX64\n", pShwPaePd->a[iPDE].u, (PGM_PDFLAGS_MAPPING | X86_PDE_P | X86_PDE_A | X86_PDE_RW | X86_PDE_US | (uint32_t)pMap->aPTs[i].HCPhysPT)));
     490                break;
     491            }
     492
     493            default:
     494                AssertFailed();
     495                break;
     496        }
     497    }
     498}
     499
     500/**
     501 * Check the hypervisor mappings in the active CR3.
     502 *
     503 * @param   pVM         The virtual machine.
     504 */
     505VMMDECL(void) PGMMapCheck(PVM pVM)
     506{
     507#ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY
     508    Log(("PGMMapCheck fixed mappings=%d\n", pVM->pgm.s.fMappingsFixed));
     509
     510    /*
     511     * Can skip this if mappings are safely fixed.
     512     */
     513    if (pVM->pgm.s.fMappingsFixed)
     514        return VINF_SUCCESS;
     515
     516# ifdef IN_RING0
     517    AssertFailed();
     518    return VERR_INTERNAL_ERROR;
     519# else
     520#  ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY
     521    Assert(pVM->pgm.s.CTX_SUFF(pShwPageCR3));
     522#  endif
     523
     524    /*
     525     * Iterate mappings.
     526     */
     527    for (PPGMMAPPING pCur = pVM->pgm.s.CTX_SUFF(pMappings); pCur; pCur = pCur->CTX_SUFF(pNext))
     528    {
     529        unsigned iPDE = pCur->GCPtr >> X86_PD_SHIFT;
     530
     531        pgmMapCheckShadowPDEs(pVM, pVM->pgm.s.CTX_SUFF(pShwPageCR3), pCur, iPDE);
     532    }
     533    return VINF_SUCCESS;
     534# endif /* IN_RING0 */
     535#endif /* VBOX_WITH_PGMPOOL_PAGING_ONLY */
     536}
     537#endif
     538
    421539/**
    422540 * Apply the hypervisor mappings to the active CR3.
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette