VirtualBox

Changeset 92285 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Nov 9, 2021 11:20:42 AM (3 years ago)
Author:
vboxsync
Message:

VMM/PGMAll.cpp: Corrected table address calculations for PGMPOOLKIND_EPT_PD_FOR_PHYS, PGMPOOLKIND_64BIT_PD_FOR_PHYS and PGMPOOLKIND_PAE_PD_PHYS. bugref:10142

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r92190 r92285  
    14551455        {
    14561456            /* AMD-V nested paging or real/protected mode without paging. */
    1457             GCPdPt  = (RTGCPTR64)iPdPt << X86_PDPT_SHIFT;
     1457            GCPdPt  = GCPtr & ~(RT_BIT_64(X86_PDPT_SHIFT) - 1);
    14581458            enmKind = PGMPOOLKIND_PAE_PD_PHYS;
    14591459        }
    1460         else
    1461         {
    1462             if (CPUMGetGuestCR4(pVCpu) & X86_CR4_PAE)
     1460        else if (CPUMGetGuestCR4(pVCpu) & X86_CR4_PAE)
     1461        {
     1462            if (!(uGstPdpe & X86_PDPE_P))
    14631463            {
    1464                 if (!(uGstPdpe & X86_PDPE_P))
    1465                 {
    1466                     /* PD not present; guest must reload CR3 to change it.
    1467                      * No need to monitor anything in this case. */
    1468                     Assert(VM_IS_RAW_MODE_ENABLED(pVM));
    1469                     GCPdPt  = uGstPdpe & X86_PDPE_PG_MASK;
    1470                     enmKind = PGMPOOLKIND_PAE_PD_PHYS;
    1471                     Assert(uGstPdpe & X86_PDPE_P); /* caller should do this already */
    1472                 }
    1473                 else
    1474                 {
    1475                     GCPdPt  = uGstPdpe & X86_PDPE_PG_MASK;
    1476                     enmKind = PGMPOOLKIND_PAE_PD_FOR_PAE_PD;
    1477                 }
     1464                /* PD not present; guest must reload CR3 to change it.
     1465                 * No need to monitor anything in this case. */
     1466                Assert(VM_IS_RAW_MODE_ENABLED(pVM));
     1467                GCPdPt  = uGstPdpe & X86_PDPE_PG_MASK;
     1468                enmKind = PGMPOOLKIND_PAE_PD_PHYS;
     1469                Assert(uGstPdpe & X86_PDPE_P); /* caller should do this already */
    14781470            }
    14791471            else
    14801472            {
    1481                 GCPdPt  = CPUMGetGuestCR3(pVCpu);
    1482                 enmKind = (PGMPOOLKIND)(PGMPOOLKIND_PAE_PD0_FOR_32BIT_PD + iPdPt);
     1473                GCPdPt  = uGstPdpe & X86_PDPE_PG_MASK;
     1474                enmKind = PGMPOOLKIND_PAE_PD_FOR_PAE_PD;
    14831475            }
     1476        }
     1477        else
     1478        {
     1479            GCPdPt  = CPUMGetGuestCR3(pVCpu);
     1480            enmKind = (PGMPOOLKIND)(PGMPOOLKIND_PAE_PD0_FOR_32BIT_PD + iPdPt);
    14841481        }
    14851482
     
    16431640        {
    16441641            /* AMD-V nested paging or real/protected mode without paging */
    1645             GCPdPt  = (RTGCPTR64)iPdPt << X86_PDPT_SHIFT;
     1642            GCPdPt  = GCPtr & ~(RT_BIT_64(iPdPt << X86_PDPT_SHIFT) - 1);
    16461643            enmKind = PGMPOOLKIND_64BIT_PD_FOR_PHYS;
    16471644        }
     
    17401737     * PML4 level.
    17411738     */
    1742 
    17431739    PEPTPML4 pPml4 = (PEPTPML4)PGMPOOL_PAGE_2_PTR_V2(pVM, pVCpu, pVCpu->pgm.s.CTX_SUFF(pShwPageCR3));
    17441740    Assert(pPml4);
     
    17541750        {
    17551751            RTGCPTR64 GCPml4 = (RTGCPTR64)iPml4 << EPT_PML4_SHIFT;
    1756 
    17571752            rc = pgmPoolAlloc(pVM, GCPml4, PGMPOOLKIND_EPT_PDPT_FOR_PHYS, PGMPOOLACCESS_DONTCARE, PGM_A20_IS_ENABLED(pVCpu),
    17581753                              pVCpu->pgm.s.CTX_SUFF(pShwPageCR3)->idx, iPml4, false /*fLockPage*/,
     
    17931788    if (!(Pdpe.u & (EPT_E_PG_MASK | EPT_E_READ)))
    17941789    {
    1795         RTGCPTR64 GCPdPt = (RTGCPTR64)iPdPt << EPT_PDPT_SHIFT;
     1790        RTGCPTR64 const GCPdPt = GCPtr & ~(RT_BIT_64(EPT_PDPT_SHIFT) - 1);
    17961791        rc = pgmPoolAlloc(pVM, GCPdPt, PGMPOOLKIND_EPT_PD_FOR_PHYS, PGMPOOLACCESS_DONTCARE, PGM_A20_IS_ENABLED(pVCpu),
    17971792                          pShwPage->idx, iPdPt, false /*fLockPage*/,
Note: See TracChangeset for help on using the changeset viewer.

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