VirtualBox

Changeset 93593 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 3, 2022 9:05:05 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
149730
Message:

VMM: Embedded the zero and mmio-dummy pages into the VM structure and realigned it for a 16384 page size. bugref:9898

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

Legend:

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

    r93554 r93593  
    13921392            AssertMsgReturn(PGM_PAGE_GET_HCPHYS(pPage)== pVM->pgm.s.HCPhysZeroPg, ("pPage=%R[pgmpage]\n", pPage),
    13931393                            VERR_PGM_PHYS_PAGE_MAP_IPE_4);
    1394             *ppv = pVM->pgm.s.CTXALLSUFF(pvZeroPg);
     1394            *ppv = pVM->pgm.s.abZeroPg;
    13951395        }
    13961396        else
    1397             *ppv = pVM->pgm.s.CTXALLSUFF(pvZeroPg);
     1397            *ppv = pVM->pgm.s.abZeroPg;
    13981398        *ppMap = NULL;
    13991399        return VINF_SUCCESS;
     
    16221622        pTlbe->pMap = NULL;
    16231623# endif
    1624         pTlbe->pv = pVM->pgm.s.CTXALLSUFF(pvZeroPg);
     1624        pTlbe->pv = pVM->pgm.s.abZeroPg;
    16251625    }
    16261626# ifdef PGM_WITH_PHYS_TLB
  • trunk/src/VBox/VMM/VMMR3/PGM.cpp

    r93554 r93593  
    930930
    931931    /*
    932      * Allocate the zero page.
    933      */
    934     if (RT_SUCCESS(rc))
    935     {
    936         rc = MMHyperAlloc(pVM, RT_MAX(GUEST_PAGE_SIZE, HOST_PAGE_SIZE), GUEST_PAGE_SIZE, MM_TAG_PGM, &pVM->pgm.s.pvZeroPgR3);
    937         if (RT_SUCCESS(rc))
    938         {
    939             pVM->pgm.s.pvZeroPgR0 = MMHyperR3ToR0(pVM, pVM->pgm.s.pvZeroPgR3);
    940             pVM->pgm.s.HCPhysZeroPg = !fDriverless ? MMR3HyperHCVirt2HCPhys(pVM, pVM->pgm.s.pvZeroPgR3)
    941                                     : _4G - GUEST_PAGE_SIZE * 2 /* fake to avoid PGM_PAGE_INIT_ZERO assertion */;
    942             AssertRelease(pVM->pgm.s.HCPhysZeroPg != NIL_RTHCPHYS);
    943         }
    944     }
    945 
    946     /*
    947      * Allocate the invalid MMIO page.
     932     * Setup the zero page.
     933     */
     934    RT_ZERO(pVM->pgm.s.abZeroPg);
     935    pVM->pgm.s.HCPhysZeroPg = !fDriverless ? MMR3HyperHCVirt2HCPhys(pVM, pVM->pgm.s.abZeroPg)
     936                            : _4G - GUEST_PAGE_SIZE * 2 /* fake to avoid PGM_PAGE_INIT_ZERO assertion */;
     937    AssertRelease(pVM->pgm.s.HCPhysZeroPg != NIL_RTHCPHYS);
     938
     939    /*
     940     * Setup the invalid MMIO page.
    948941     * (The invalid bits in HCPhysInvMmioPg are set later on init complete.)
    949942     */
    950     if (RT_SUCCESS(rc))
    951     {
    952         rc = MMHyperAlloc(pVM, RT_MAX(GUEST_PAGE_SIZE, HOST_PAGE_SIZE), GUEST_PAGE_SIZE,
    953                           MM_TAG_PGM, &pVM->pgm.s.pvMmioPgR3);
    954         if (RT_SUCCESS(rc))
    955         {
    956             ASMMemFill32(pVM->pgm.s.pvMmioPgR3, RT_MAX(GUEST_PAGE_SIZE, HOST_PAGE_SIZE), 0xfeedface);
    957             pVM->pgm.s.HCPhysMmioPg = !fDriverless ? MMR3HyperHCVirt2HCPhys(pVM, pVM->pgm.s.pvMmioPgR3)
    958                                     : _4G - GUEST_PAGE_SIZE * 3 /* fake to avoid PGM_PAGE_INIT_ZERO assertion */;
    959             AssertRelease(pVM->pgm.s.HCPhysMmioPg != NIL_RTHCPHYS);
    960             pVM->pgm.s.HCPhysInvMmioPg = pVM->pgm.s.HCPhysMmioPg;
    961         }
    962     }
     943    ASMMemFill32(pVM->pgm.s.abMmioPg, sizeof(pVM->pgm.s.abMmioPg), 0xfeedface);
     944    pVM->pgm.s.HCPhysMmioPg = !fDriverless ? MMR3HyperHCVirt2HCPhys(pVM, pVM->pgm.s.abMmioPg)
     945                            : _4G - GUEST_PAGE_SIZE * 3 /* fake to avoid PGM_PAGE_INIT_ZERO assertion */;
     946    AssertRelease(pVM->pgm.s.HCPhysMmioPg != NIL_RTHCPHYS);
     947    pVM->pgm.s.HCPhysInvMmioPg = pVM->pgm.s.HCPhysMmioPg;
    963948
    964949    /*
     
    17731758
    17741759    /*
    1775      * The Zero page.
    1776      */
    1777     pVM->pgm.s.pvZeroPgR0 = MMHyperR3ToR0(pVM, pVM->pgm.s.pvZeroPgR3);
    1778     AssertRelease(pVM->pgm.s.pvZeroPgR0 != NIL_RTR0PTR || SUPR3IsDriverless());
    1779 
    1780     /*
    17811760     * The page pool.
    17821761     */
  • trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp

    r93554 r93593  
    14271427    {
    14281428        uint8_t u2State = PGM_PAGE_GET_NEM_STATE(pPage);
    1429         NEMHCNotifyPhysPageChanged(pVM, GCPhys, HCPhysPrev, pVM->pgm.s.HCPhysZeroPg, pVM->pgm.s.pvZeroPgR3,
     1429        NEMHCNotifyPhysPageChanged(pVM, GCPhys, HCPhysPrev, pVM->pgm.s.HCPhysZeroPg, pVM->pgm.s.abZeroPg,
    14301430                                   pgmPhysPageCalcNemProtection(pPage, enmNewType), enmNewType, &u2State);
    14311431        PGM_PAGE_SET_NEM_STATE(pPage, u2State);
  • trunk/src/VBox/VMM/include/PGMInternal.h

    r93554 r93593  
    28062806typedef struct PGM
    28072807{
     2808    /** The zero page. */
     2809    uint8_t                         abZeroPg[RT_MAX(HOST_PAGE_SIZE, GUEST_PAGE_SIZE)];
     2810    /** The MMIO placeholder page. */
     2811    uint8_t                         abMmioPg[RT_MAX(HOST_PAGE_SIZE, GUEST_PAGE_SIZE)];
     2812
     2813    /** @name   The zero page (abPagePg).
     2814     * @{ */
     2815    /** The host physical address of the zero page. */
     2816    RTHCPHYS                        HCPhysZeroPg;
     2817    /** @}*/
     2818
     2819    /** @name   The Invalid MMIO page (abMmioPg).
     2820     * This page is filled with 0xfeedface.
     2821     * @{ */
     2822    /** The host physical address of the invalid MMIO page. */
     2823    RTHCPHYS                        HCPhysMmioPg;
     2824    /** The host pysical address of the invalid MMIO page plus all invalid
     2825     * physical address bits set.  This is used to trigger X86_TRAP_PF_RSVD.
     2826     * @remarks Check fLessThan52PhysicalAddressBits before use. */
     2827    RTHCPHYS                        HCPhysInvMmioPg;
     2828    /** @} */
     2829
    28082830    /** @cfgm{/RamPreAlloc, boolean, false}
    28092831     * Indicates whether the base RAM should all be allocated before starting
     
    29242946    uint32_t                        cDeprecatedPageLocks;
    29252947    /** Alignment padding. */
    2926     uint32_t                        au32Alignment2[1];
     2948    uint32_t                        au32Alignment2[1+2];
    29272949
    29282950    /** PGM critical section.
     
    29602982    /** The page mapping TLB for ring-0. */
    29612983    PGMPAGER0MAPTLB                 PhysTlbR0;
    2962 
    2963     /** @name   The zero page.
    2964      * @{ */
    2965     /** The host physical address of the zero page. */
    2966     RTHCPHYS                        HCPhysZeroPg;
    2967     /** The ring-3 mapping of the zero page. */
    2968     RTR3PTR                         pvZeroPgR3;
    2969     /** The ring-0 mapping of the zero page. */
    2970     RTR0PTR                         pvZeroPgR0;
    2971     /** @}*/
    2972 
    2973     /** @name   The Invalid MMIO page.
    2974      * This page is filled with 0xfeedface.
    2975      * @{ */
    2976     /** The host physical address of the invalid MMIO page. */
    2977     RTHCPHYS                        HCPhysMmioPg;
    2978     /** The host pysical address of the invalid MMIO page plus all invalid
    2979      * physical address bits set.  This is used to trigger X86_TRAP_PF_RSVD.
    2980      * @remarks Check fLessThan52PhysicalAddressBits before use. */
    2981     RTHCPHYS                        HCPhysInvMmioPg;
    2982     /** The ring-3 mapping of the invalid MMIO page. */
    2983     RTR3PTR                         pvMmioPgR3;
    2984 #if HC_ARCH_BITS == 32
    2985     RTR3PTR                         R3PtrAlignment4;
    2986 #endif
    2987     /** @} */
    2988 
    29892984
    29902985    /** The number of handy pages. */
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