VirtualBox

Changeset 31069 in vbox


Ignore:
Timestamp:
Jul 23, 2010 3:49:30 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
64004
Message:

PGM: Prep for shadowing EFER.NXE and CR4.PSE to avoid function calls.

Location:
trunk/src/VBox/VMM
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PGMGstDefs.h

    r31066 r31069  
    8282#  define PGSTPDE                               PSHWPDE
    8383#  define GST_PTE_PG_MASK                       SHW_PTE_PG_MASK
    84 #  define GST_IS_NX_ACTIVE(pVCpu)               (CPUMIsGuestNXEnabled(pVCpu)) /** @todo shadow this variable */
     84#  define GST_IS_NX_ACTIVE(pVCpu)               (pgmGstIsNoExecuteActive(pVCpu))
    8585#  if PGM_GST_TYPE == PGM_TYPE_PROT             /* (comment at top of PGMAllBth.h) */
    8686#   define BTH_IS_NP_ACTIVE(pVM)                (pVM->pgm.s.fNestedPaging)
     
    127127//# define GST_IS_BIG_PDPE_VALID(pVCpu, Pdpe)     (false)
    128128//# define GST_IS_PML4E_VALID(pVCpu, Pml4e)       (false)
    129 # define GST_IS_PSE_ACTIVE(pVCpu)               (CPUMIsGuestPageSizeExtEnabled(pVCpu)) /** @todo ( (pVCpu)->pgm.s.fGst32BitPageSizeExtension ) */
     129# define GST_IS_PSE_ACTIVE(pVCpu)               pgmGstIsPageSizeExtActive(pVCpu)
    130130# define GST_IS_NX_ACTIVE(pVCpu)                (false)
    131131# define BTH_IS_NP_ACTIVE(pVM)                  (false)
     
    186186# define GST_PT_MASK                            X86_PT_PAE_MASK
    187187# define GST_IS_PSE_ACTIVE(pVCpu)               (true)
    188 # define GST_IS_NX_ACTIVE(pVCpu)                (CPUMIsGuestNXEnabled(pVCpu)) /** @todo shadow this variable */
     188# define GST_IS_NX_ACTIVE(pVCpu)                (pgmGstIsNoExecuteActive(pVCpu))
    189189# define BTH_IS_NP_ACTIVE(pVM)                  (false)
    190190#endif
    191191
     192
  • trunk/src/VBox/VMM/PGMInline.h

    r30895 r31069  
    553553
    554554#endif /* !IN_RC */
     555
     556
     557/**
     558 * Checks if the no-execute (NX) feature is active (EFER.NXE=1).
     559 *
     560 * This is inlined so that we can perform consistency checks in debug builds.
     561 *
     562 * @returns true if it is, false if it isn't.
     563 * @param   pVCpu       The current CPU.
     564 */
     565DECL_FORCE_INLINE(bool) pgmGstIsNoExecuteActive(PVMCPU pVCpu)
     566{
     567    /** @todo shadow this variable */
     568    return CPUMIsGuestNXEnabled(pVCpu);
     569}
     570
     571
     572/**
     573 * Checks if the page size extension (PSE) is currently enabled (CR4.PSE=1).
     574 *
     575 * This is inlined so that we can perform consistency checks in debug builds.
     576 *
     577 * @returns true if it is, false if it isn't.
     578 * @param   pVCpu       The current CPU.
     579 */
     580DECL_FORCE_INLINE(bool) pgmGstIsPageSizeExtActive(PVMCPU pVCpu)
     581{
     582    /** @todo ( (pVCpu)->pgm.s.fGst32BitPageSizeExtension ) */
     583    return CPUMIsGuestPageSizeExtEnabled(pVCpu);
     584}
     585
    555586
    556587/**
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r31067 r31069  
    406406#  if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)
    407407        if (    PdeSrc.b.u1Size
    408 #   if PGM_GST_TYPE == PGM_TYPE_32BIT
    409             &&  CPUMIsGuestPageSizeExtEnabled(pVCpu)
    410 #   endif
    411             )
     408            &&  GST_IS_PSE_ACTIVE(pVCpu))
    412409            GCPhys = GST_GET_PDE_BIG_PG_GCPHYS(pVM, PdeSrc)
    413410                    | ((RTGCPHYS)pvFault & (GST_BIG_PAGE_OFFSET_MASK ^ PAGE_OFFSET_MASK));
     
    11381135        PdeSrc.u = 0;
    11391136# endif /* PGM_GST_TYPE != PGM_TYPE_32BIT */
    1140 
    1141 # if PGM_GST_TYPE == PGM_TYPE_32BIT
    1142     const bool      fIsBigPage  = PdeSrc.b.u1Size && CPUMIsGuestPageSizeExtEnabled(pVCpu);
    1143 # else
    1144     const bool      fIsBigPage  = PdeSrc.b.u1Size;
    1145 # endif
     1137    const bool      fIsBigPage  = PdeSrc.b.u1Size && GST_IS_PSE_ACTIVE(pVCpu);
    11461138
    11471139# ifdef IN_RING3
     
    17611753     * Check that the page is present and that the shadow PDE isn't out of sync.
    17621754     */
    1763 # if PGM_GST_TYPE == PGM_TYPE_32BIT
    1764     const bool      fBigPage  = PdeSrc.b.u1Size && CPUMIsGuestPageSizeExtEnabled(pVCpu);
    1765 # else
    1766     const bool      fBigPage  = PdeSrc.b.u1Size;
    1767 # endif
     1755    const bool      fBigPage  = PdeSrc.b.u1Size && GST_IS_PSE_ACTIVE(pVCpu);
    17681756    const bool      fPdeValid = !fBigPage ? GST_IS_PDE_VALID(pVCpu, PdeSrc) : GST_IS_BIG_PDE_VALID(pVCpu, PdeSrc);
    17691757    RTGCPHYS        GCPhys;
     
    17901778        &&  (PdeSrc.n.u1Write == PdeDst.n.u1Write || !PdeDst.n.u1Write)
    17911779# if PGM_WITH_NX(PGM_GST_TYPE, PGM_SHW_TYPE)
    1792         &&  (PdeSrc.n.u1NoExecute == PdeDst.n.u1NoExecute || !CPUMIsGuestNXEnabled(pVCpu))
     1780        &&  (PdeSrc.n.u1NoExecute == PdeDst.n.u1NoExecute || !GST_IS_NX_ACTIVE(pVCpu))
    17931781# endif
    17941782       )
     
    22612249    bool        fWriteFault          = !!(uErr & X86_TRAP_PF_RW);
    22622250# if PGM_WITH_NX(PGM_GST_TYPE, PGM_SHW_TYPE)
    2263     bool        fMaybeNXEFault       =   (uErr & X86_TRAP_PF_ID) && CPUMIsGuestNXEnabled(pVCpu);
     2251    bool        fMaybeNXEFault       =   (uErr & X86_TRAP_PF_ID) && GST_IS_NX_ACTIVE(pVCpu);
    22642252# endif
    22652253    bool        fMaybeWriteProtFault = fWriteFault && (fUserLevelFault || CPUMIsGuestR0WriteProtEnabled(pVCpu));
     
    23372325    if (!pPdeSrc->n.u1Present)
    23382326        return PGM_BTH_NAME(CheckPageFaultReturnNP)(pVCpu, uErr, GCPtrPage, 2);
    2339 # if PGM_GST_TYPE == PGM_TYPE_32BIT
    2340     bool const fBigPage = pPdeSrc->b.u1Size && CPUMIsGuestPageSizeExtEnabled(pVCpu);
    2341 # else
    2342     bool const fBigPage = pPdeSrc->b.u1Size;
    2343 # endif
     2327    bool const fBigPage = pPdeSrc->b.u1Size && GST_IS_PSE_ACTIVE(pVCpu);
    23442328    if (!fBigPage ? !GST_IS_PDE_VALID(pVCpu, *pPdeSrc) : !GST_IS_BIG_PDE_VALID(pVCpu, *pPdeSrc))
    23452329        return PGM_BTH_NAME(CheckPageFaultReturnRSVD)(pVCpu, uErr, GCPtrPage, 2);
     
    24552439PGM_BTH_DECL(int, CheckDirtyPageFault)(PVMCPU pVCpu, uint32_t uErr, PSHWPDE pPdeDst, PGSTPDE pPdeSrc, RTGCPTR GCPtrPage)
    24562440{
    2457 # if PGM_GST_TYPE == PGM_TYPE_32BIT
    2458     const bool  fBigPagesSupported = CPUMIsGuestPageSizeExtEnabled(pVCpu);
    2459 # else
    2460     const bool  fBigPagesSupported = true;
    2461 # endif
    24622441    PVM         pVM   = pVCpu->CTX_SUFF(pVM);
    24632442    PPGMPOOL    pPool = pVM->pgm.s.CTX_SUFF(pPool);
     
    24682447     * Handle big page.
    24692448     */
    2470     if (pPdeSrc->b.u1Size && fBigPagesSupported)
     2449    if (pPdeSrc->b.u1Size && GST_IS_PSE_ACTIVE(pVCpu))
    24712450    {
    24722451        if (    pPdeDst->n.u1Present
     
    27542733         */
    27552734        PSHWPT          pPTDst;
    2756 # if PGM_GST_TYPE == PGM_TYPE_32BIT
    2757         const bool      fPageTable = !PdeSrc.b.u1Size || !CPUMIsGuestPageSizeExtEnabled(pVCpu);
    2758 # else
    2759         const bool      fPageTable = !PdeSrc.b.u1Size;
    2760 # endif
     2735        const bool      fPageTable = !PdeSrc.b.u1Size || !GST_IS_PSE_ACTIVE(pVCpu);
    27612736        PPGMPOOLPAGE    pShwPage;
    27622737        RTGCPHYS        GCPhys;
     
    27742749            PGMPOOLACCESS enmAccess;
    27752750# if PGM_WITH_NX(PGM_GST_TYPE, PGM_SHW_TYPE)
    2776             const bool fNoExecute = PdeSrc.n.u1NoExecute && CPUMIsGuestNXEnabled(pVCpu);
     2751            const bool fNoExecute = PdeSrc.n.u1NoExecute && GST_IS_NX_ACTIVE(pVCpu);
    27772752# else
    27782753            const bool fNoExecute = false;
     
    37793754    || PGM_GST_TYPE == PGM_TYPE_AMD64
    37803755
    3781 # if PGM_GST_TYPE == PGM_TYPE_32BIT
    3782     bool            fBigPagesSupported = CPUMIsGuestPageSizeExtEnabled(pVCpu);
    3783 # else
    3784     bool            fBigPagesSupported = true;
    3785 # endif
     3756    bool            fBigPagesSupported = GST_IS_PSE_ACTIVE(pVCpu);
    37863757    PPGMCPU         pPGM = &pVCpu->pgm.s;
    37873758    RTGCPHYS        GCPhysGst;              /* page address derived from the guest page tables. */
  • trunk/src/VBox/VMM/VMMAll/PGMAllShw.h

    r30369 r31069  
    213213        {
    214214            *pfFlags = (Pde.u & ~SHW_PDE_PG_MASK);
    215 # if PGM_WITH_NX(PGM_SHW_TYPE, PGM_SHW_TYPE)
     215# if PGM_WITH_NX(PGM_SHW_TYPE, PGM_SHW_TYPE)    /** @todo why do we have to check the guest state here? */
    216216            if ((Pde.u & X86_PTE_PAE_NX) && CPUMIsGuestNXEnabled(pVCpu))
    217217                *pfFlags |= X86_PTE_PAE_NX;
     
    266266        *pfFlags = (Pte.u & ~SHW_PTE_PG_MASK)
    267267                 & ((Pde.u & (X86_PTE_RW | X86_PTE_US)) | ~(uint64_t)(X86_PTE_RW | X86_PTE_US));
    268 # if PGM_WITH_NX(PGM_SHW_TYPE, PGM_SHW_TYPE)
     268# if PGM_WITH_NX(PGM_SHW_TYPE, PGM_SHW_TYPE) /** @todo why do we have to check the guest state here? */
    269269        /* The NX bit is determined by a bitwise OR between the PT and PD */
    270270        if (((Pte.u | Pde.u) & X86_PTE_PAE_NX) && CPUMIsGuestNXEnabled(pVCpu))
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