VirtualBox

Ignore:
Timestamp:
Nov 28, 2024 10:38:10 AM (7 weeks ago)
Author:
vboxsync
Message:

VMM/PGM: Introducing VBOX_WITH_ONLY_PGM_NEM_MODE to disable lots unused code on *.arm64 and darwin. jiraref:VBP-1466

File:
1 edited

Legend:

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

    r106670 r107171  
    7272
    7373/*********************************************************************************************************************************
    74 *   Structures and Typedefs                                                                                                      *
    75 *********************************************************************************************************************************/
    76 
    77 
    78 /*********************************************************************************************************************************
    7974*   Internal Functions                                                                                                           *
    8075*********************************************************************************************************************************/
     
    10196{
    10297    AssertFatal(!PDMCritSectIsInitialized(&pVM->pgm.s.CritSectX));
     98#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
    10399    pVM->pgm.s.fNemMode = true;
     100#endif
    104101}
    105102
     
    113110VMMR3_INT_DECL(bool)    PGMR3IsNemModeEnabled(PVM pVM)
    114111{
    115     return pVM->pgm.s.fNemMode;
     112    RT_NOREF(pVM);
     113    return PGM_IS_IN_NEM_MODE(pVM);
    116114}
    117115
     
    126124{
    127125    LogFlow(("PGMR3Init:\n"));
    128     PCFGMNODE pCfgPGM = CFGMR3GetChild(CFGMR3GetRoot(pVM), "/PGM");
    129     int rc;
    130126
    131127    /*
     
    136132    AssertCompileMemberAlignment(PGM, CritSectX, sizeof(uintptr_t));
    137133
    138     /*
    139      * If we're in driveless mode we have to use the simplified memory mode.
    140      */
    141134    bool const fDriverless = SUPR3IsDriverless();
    142     AssertReturn(fDriverless, VERR_NOT_SUPPORTED);
    143     if (!pVM->pgm.s.fNemMode)
    144         pVM->pgm.s.fNemMode = true;
    145135
    146136    /*
     
    148138     */
    149139    /*pVM->pgm.s.fRestoreRomPagesAtReset = false;*/
     140
     141    /* We always use the simplified memory mode on arm. */
     142#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
     143    pVM->pgm.s.fNemMode = true;
     144#endif
    150145
    151146    for (unsigned i = 0; i < RT_ELEMENTS(pVM->pgm.s.aHandyPages); i++)
     
    168163    for (size_t i = 0; i < RT_ELEMENTS(pVM->pgm.s.aPhysHandlerTypes); i++)
    169164    {
     165#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    170166        if (fDriverless)
     167#endif
    171168            pVM->pgm.s.aPhysHandlerTypes[i].hType  = i | (RTRandU64() & ~(uint64_t)PGMPHYSHANDLERTYPE_IDX_MASK);
    172169        pVM->pgm.s.aPhysHandlerTypes[i].enmKind    = PGMPHYSHANDLERKIND_INVALID;
     
    183180#endif
    184181
    185     rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "RamPreAlloc", &pVM->pgm.s.fRamPreAlloc,
     182    /*
     183     * Read the configuration.
     184     */
     185    PCFGMNODE const pCfgPGM = CFGMR3GetChild(CFGMR3GetRoot(pVM), "/PGM");
     186
     187    int rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "RamPreAlloc", &pVM->pgm.s.fRamPreAlloc,
    186188#ifdef VBOX_WITH_PREALLOC_RAM_BY_DEFAULT
    187189                            true
     
    252254     */
    253255    RT_ZERO(pVM->pgm.s.abZeroPg); /* paranoia */
     256#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
    254257    if (fDriverless)
    255258        pVM->pgm.s.HCPhysZeroPg = _4G - GUEST_PAGE_SIZE * 2 /* fake to avoid PGM_PAGE_INIT_ZERO assertion */;
    256259    AssertRelease(pVM->pgm.s.HCPhysZeroPg != NIL_RTHCPHYS);
    257260    AssertRelease(pVM->pgm.s.HCPhysZeroPg != 0);
     261#endif
    258262
    259263    /*
     
    262266     */
    263267    ASMMemFill32(pVM->pgm.s.abMmioPg, sizeof(pVM->pgm.s.abMmioPg), 0xfeedface);
     268#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
    264269    if (fDriverless)
    265270        pVM->pgm.s.HCPhysMmioPg = _4G - GUEST_PAGE_SIZE * 3 /* fake to avoid PGM_PAGE_INIT_ZERO assertion */;
     
    267272    AssertRelease(pVM->pgm.s.HCPhysMmioPg != 0);
    268273    pVM->pgm.s.HCPhysInvMmioPg = pVM->pgm.s.HCPhysMmioPg;
     274#endif
    269275
    270276    /*
     
    282288    AssertLogRelMsgStmt(cAccessHandlers >= 32, ("cAccessHandlers=%#x, min 32\n", cAccessHandlers), cAccessHandlers = 32);
    283289    AssertLogRelMsgStmt(cAccessHandlers <= _64K, ("cAccessHandlers=%#x, max 65536\n", cAccessHandlers), cAccessHandlers = _64K);
     290#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    284291    if (!fDriverless)
    285292    {
     
    291298    }
    292299    else
     300#endif
    293301    {
    294302        uint32_t       cbTreeAndBitmap = 0;
     
    331339
    332340/**
    333  * Ring-3 init finalizing.
     341 * Ring-3 init finalizing (not required here).
    334342 *
    335343 * @returns VBox status code.
     
    338346VMMR3DECL(int) PGMR3InitFinalize(PVM pVM)
    339347{
    340     /*
    341      * Allocate memory if we're supposed to do that.
    342      */
     348    RT_NOREF(pVM);
    343349    int rc = VINF_SUCCESS;
     350#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
    344351    if (pVM->pgm.s.fRamPreAlloc)
    345352        rc = pgmR3PhysRamPreAllocate(pVM);
     353#endif
    346354
    347355    //pgmLogState(pVM);
    348     LogRel(("PGM: PGMR3InitFinalize: 4 MB PSE mask %RGp -> %Rrc\n", pVM->pgm.s.GCPhys4MBPSEMask, rc));
     356    LogRel(("PGM: PGMR3InitFinalize done: %Rrc\n", rc));
    349357    return rc;
    350358}
     
    511519VMMDECL(bool) PGMHasDirtyPages(PVM pVM)
    512520{
     521#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
    513522    return pVM->pgm.s.CTX_SUFF(pPool)->cDirtyPages != 0;
     523#else
     524    RT_NOREF(pVM);
     525    return false;
     526#endif
    514527}
    515528
     
    730743
    731744    CPUMMODE enmCpuMode = CPUMGetGuestMode(pVCpu);
    732     return   enmCpuMode == CPUMMODE_ARMV8_AARCH64
    733            ? PGMMODE_VMSA_V8_64
    734            : PGMMODE_VMSA_V8_32;
     745    return enmCpuMode == CPUMMODE_ARMV8_AARCH64
     746         ? PGMMODE_VMSA_V8_64
     747         : PGMMODE_VMSA_V8_32;
    735748}
    736749
     
    10001013    return pgmGstPtWalk(pVCpu, GCPtr, pWalk, pGstWalk); /** @todo Always do full walk for now. */
    10011014}
     1015
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