VirtualBox

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


Ignore:
Timestamp:
Jun 22, 2010 12:20:38 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
62960
Message:

Deal with large pages in shadow GetPage function.
Correct NX flag calculation

Location:
trunk/src/VBox/VMM/VMMAll
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/PGMAllGst.h

    r28800 r30368  
    9090    Pde.n.u1Write     &= pPml4e->n.u1Write & Pdpe.lm.u1Write;
    9191    Pde.n.u1User      &= pPml4e->n.u1User & Pdpe.lm.u1User;
    92     Pde.n.u1NoExecute &= pPml4e->n.u1NoExecute & Pdpe.lm.u1NoExecute;
     92    Pde.n.u1NoExecute |= pPml4e->n.u1NoExecute | Pdpe.lm.u1NoExecute;
    9393# endif
    9494
     
    128128# if PGM_WITH_NX(PGM_GST_TYPE, PGM_GST_TYPE)
    129129            /* The NX bit is determined by a bitwise OR between the PT and PD */
    130             if ((Pte.u & Pde.u & X86_PTE_PAE_NX) && CPUMIsGuestNXEnabled(pVCpu)) /** @todo the code is ANDing not ORing NX like the comment says... */
     130            if (((Pte.u | Pde.u) & X86_PTE_PAE_NX) && CPUMIsGuestNXEnabled(pVCpu))
    131131                *pfFlags |= X86_PTE_PAE_NX;
    132132# endif
  • trunk/src/VBox/VMM/VMMAll/PGMAllShw.h

    r30364 r30368  
    177177    Pde.n.u1Write     &= Pml4e.n.u1Write & Pdpe.lm.u1Write;
    178178    Pde.n.u1User      &= Pml4e.n.u1User & Pdpe.lm.u1User;
    179     Pde.n.u1NoExecute &= Pml4e.n.u1NoExecute & Pdpe.lm.u1NoExecute;
     179    Pde.n.u1NoExecute |= Pml4e.n.u1NoExecute | Pdpe.lm.u1NoExecute;
    180180
    181181# elif PGM_SHW_TYPE == PGM_TYPE_PAE
     
    202202        return VERR_PAGE_TABLE_NOT_PRESENT;
    203203
    204     /** todo deal with large pages. */
    205     AssertFatal(!Pde.b.u1Size);
     204    /** Deal with large pages. */
     205    if (Pde.b.u1Size)
     206    {
     207        /*
     208         * Store the results.
     209         * RW and US flags depend on the entire page translation hierarchy - except for
     210         * legacy PAE which has a simplified PDPE.
     211         */
     212        if (pfFlags)
     213        {
     214            *pfFlags = (Pde.u & ~SHW_PDE_PG_MASK);
     215# if PGM_WITH_NX(PGM_SHW_TYPE, PGM_SHW_TYPE)
     216            if ((Pde.u & X86_PTE_PAE_NX) && CPUMIsGuestNXEnabled(pVCpu))
     217                *pfFlags |= X86_PTE_PAE_NX;
     218# endif
     219        }
     220
     221        if (pHCPhys)
     222            *pHCPhys = (Pde.u & SHW_PDE_PG_MASK) + (GCPtr & (RT_BIT(SHW_PD_SHIFT) - 1) & X86_PAGE_4K_BASE_MASK);
     223    }
    206224
    207225    /*
     
    248266# if PGM_WITH_NX(PGM_SHW_TYPE, PGM_SHW_TYPE)
    249267        /* The NX bit is determined by a bitwise OR between the PT and PD */
    250         if ((Pte.u & Pde.u & X86_PTE_PAE_NX) && CPUMIsGuestNXEnabled(pVCpu)) /** @todo the code is ANDing not ORing NX like the comment says... */
     268        if (((Pte.u | Pde.u) & X86_PTE_PAE_NX) && CPUMIsGuestNXEnabled(pVCpu))
    251269            *pfFlags |= X86_PTE_PAE_NX;
    252270# endif
Note: See TracChangeset for help on using the changeset viewer.

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