VirtualBox

Changeset 31080 in vbox


Ignore:
Timestamp:
Jul 24, 2010 5:25:32 PM (15 years ago)
Author:
vboxsync
Message:

PGM: Micro optimizations.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PGM.cpp

    r31066 r31080  
    23452345    pgmR3PoolReset(pVM);
    23462346
     2347    /*
     2348     * Re-init various other members and clear the FFs that PGM owns.
     2349     */
    23472350    for (VMCPUID i = 0; i < pVM->cCpus; i++)
    23482351    {
    2349         PVMCPU  pVCpu = &pVM->aCpus[i];
    2350 
    2351         /*
    2352          * Re-init other members.
    2353          */
     2352        PVMCPU pVCpu = &pVM->aCpus[i];
     2353
    23542354        pVCpu->pgm.s.fA20Enabled = true;
    2355 
    2356         /*
    2357          * Clear the FFs PGM owns.
    2358          */
     2355        pVCpu->pgm.s.fGst32BitPageSizeExtension = false;
     2356        PGMNotifyNxeChanged(pVCpu, false);
     2357
    23592358        VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
    23602359        VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL);
     
    23622361
    23632362    /*
    2364      * Reset (zero) RAM pages.
     2363     * Reset (zero) RAM and shadow ROM pages.
    23652364     */
    23662365    rc = pgmR3PhysRamReset(pVM);
    23672366    if (RT_SUCCESS(rc))
    2368     {
    2369         /*
    2370          * Reset (zero) shadow ROM pages.
    2371          */
    23722367        rc = pgmR3PhysRomReset(pVM);
    2373     }
     2368
    23742369
    23752370    pgmUnlock(pVM);
  • trunk/src/VBox/VMM/PGMGstDefs.h

    r31069 r31080  
    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)               pgmGstIsPageSizeExtActive(pVCpu)
     129# define GST_IS_PSE_ACTIVE(pVCpu)               pgmGst32BitIsPageSizeExtActive(pVCpu)
    130130# define GST_IS_NX_ACTIVE(pVCpu)                (false)
    131131# define BTH_IS_NP_ACTIVE(pVM)                  (false)
  • trunk/src/VBox/VMM/PGMInline.h

    r31069 r31080  
    558558 * Checks if the no-execute (NX) feature is active (EFER.NXE=1).
    559559 *
    560  * This is inlined so that we can perform consistency checks in debug builds.
     560 * Only used when the guest is in PAE or long mode.  This is inlined so that we
     561 * can perform consistency checks in debug builds.
    561562 *
    562563 * @returns true if it is, false if it isn't.
     
    565566DECL_FORCE_INLINE(bool) pgmGstIsNoExecuteActive(PVMCPU pVCpu)
    566567{
    567     /** @todo shadow this variable */
    568     return CPUMIsGuestNXEnabled(pVCpu);
     568    Assert(pVCpu->pgm.s.fNoExecuteEnabled == CPUMIsGuestNXEnabled(pVCpu));
     569    Assert(CPUMIsGuestInPAEMode(pVCpu) || CPUMIsGuestInLongMode(pVCpu));
     570    return pVCpu->pgm.s.fNoExecuteEnabled;
    569571}
    570572
     
    573575 * Checks if the page size extension (PSE) is currently enabled (CR4.PSE=1).
    574576 *
    575  * This is inlined so that we can perform consistency checks in debug builds.
     577 * Only used when the guest is in paged 32-bit mode.  This is inlined so that
     578 * we can perform consistency checks in debug builds.
    576579 *
    577580 * @returns true if it is, false if it isn't.
    578581 * @param   pVCpu       The current CPU.
    579582 */
    580 DECL_FORCE_INLINE(bool) pgmGstIsPageSizeExtActive(PVMCPU pVCpu)
    581 {
    582     /** @todo ( (pVCpu)->pgm.s.fGst32BitPageSizeExtension ) */
    583     return CPUMIsGuestPageSizeExtEnabled(pVCpu);
     583DECL_FORCE_INLINE(bool) pgmGst32BitIsPageSizeExtActive(PVMCPU pVCpu)
     584{
     585    Assert(pVCpu->pgm.s.fGst32BitPageSizeExtension == CPUMIsGuestPageSizeExtEnabled(pVCpu));
     586    Assert(!CPUMIsGuestInPAEMode(pVCpu));
     587    Assert(!CPUMIsGuestInLongMode(pVCpu));
     588    return pVCpu->pgm.s.fGst32BitPageSizeExtension;
    584589}
    585590
  • trunk/src/VBox/VMM/PGMInternal.h

    r31066 r31080  
    31193119    /** A20 gate state - boolean! */
    31203120    bool                            fA20Enabled;
    3121     /** Mirror of the EFER.NXE bit. */
     3121    /** Mirror of the EFER.NXE bit.  Managed by PGMNotifyNxeChanged. */
    31223122    bool                            fNoExecuteEnabled;
    31233123    /** Unused bits. */
  • trunk/src/VBox/VMM/PGMSavedState.cpp

    r30948 r31080  
    30523052                AssertLogRelRCReturn(rc, rc);
    30533053
    3054                 /* Restore pVM->pgm.s.GCPhysCR3. */
     3054                /* Update pVM->pgm.s.GCPhysCR3. */
    30553055                Assert(pVCpu->pgm.s.GCPhysCR3 == NIL_RTGCPHYS);
    30563056                RTGCPHYS GCPhysCR3 = CPUMGetGuestCR3(pVCpu);
     
    30633063                    GCPhysCR3 = (GCPhysCR3 & X86_CR3_PAGE_MASK);
    30643064                pVCpu->pgm.s.GCPhysCR3 = GCPhysCR3;
     3065
     3066                /* Update the PSE, NX flags and validity masks. */
     3067                pVCpu->pgm.s.fGst32BitPageSizeExtension = CPUMIsGuestPageSizeExtEnabled(pVCpu);
     3068                PGMNotifyNxeChanged(pVCpu, CPUMIsGuestNXEnabled(pVCpu));
    30653069            }
    30663070
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r31067 r31080  
    20062006
    20072007/**
    2008  * Called whenever CR0 or CR4 in a way which may change
    2009  * the paging mode.
     2008 * Called whenever CR0 or CR4 in a way which may affect the paging mode.
    20102009 *
    20112010 * @returns VBox status code, with the following informational code for
     
    20342033        enmGuestMode = PGMMODE_PROTECTED;
    20352034    else if (!(cr4 & X86_CR4_PAE))
     2035    {
     2036        bool const fPse = !!(cr4 & X86_CR4_PSE);
     2037        if (pVCpu->pgm.s.fGst32BitPageSizeExtension != fPse)
     2038            Log(("PGMChangeMode: CR4.PSE %d -> %d\n", pVCpu->pgm.s.fGst32BitPageSizeExtension, fPse));
     2039        pVCpu->pgm.s.fGst32BitPageSizeExtension = fPse;
    20362040        enmGuestMode = PGMMODE_32_BIT;
     2041    }
    20372042    else if (!(efer & MSR_K6_EFER_LME))
    20382043    {
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