VirtualBox

Changeset 92717 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 2, 2021 9:43:46 PM (3 years ago)
Author:
vboxsync
Message:

VMM/PGM: Driverless requires the simplified memory mode. Must also fake host physical address for the MMIO and ZERO pages, or we'll end up asserting elsewhere in PGM for to good reason. bugref:10138

File:
1 edited

Legend:

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

    r92703 r92717  
    750750{
    751751    LogFlow(("PGMR3Init:\n"));
    752     bool const fDriverless = SUPR3IsDriverless();
    753752    PCFGMNODE pCfgPGM = CFGMR3GetChild(CFGMR3GetRoot(pVM), "/PGM");
    754753    int rc;
     
    760759    AssertCompile(sizeof(pVM->apCpusR3[0]->pgm.s) <= sizeof(pVM->apCpusR3[0]->pgm.padding));
    761760    AssertCompileMemberAlignment(PGM, CritSectX, sizeof(uintptr_t));
     761
     762    /*
     763     * If we're in driveless mode we have to use the simplified memory mode.
     764     */
     765    bool const fDriverless = SUPR3IsDriverless();
     766    if (fDriverless)
     767    {
     768#ifdef VBOX_WITH_PGM_NEM_MODE
     769        if (!pVM->pgm.s.fNemMode)
     770            pVM->pgm.s.fNemMode = true;
     771#else
     772        return VMR3SetError(pVM->pUVM, VERR_SUP_DRIVERLESS, RT_SRC_POS,
     773                            "Driverless requires that VBox is built with VBOX_WITH_PGM_NEM_MODE defined");
     774#endif
     775    }
    762776
    763777    /*
     
    924938        {
    925939            pVM->pgm.s.pvZeroPgR0 = MMHyperR3ToR0(pVM, pVM->pgm.s.pvZeroPgR3);
    926             pVM->pgm.s.HCPhysZeroPg = MMR3HyperHCVirt2HCPhys(pVM, pVM->pgm.s.pvZeroPgR3);
    927             AssertRelease(pVM->pgm.s.HCPhysZeroPg != NIL_RTHCPHYS || fDriverless);
     940            pVM->pgm.s.HCPhysZeroPg = !fDriverless ? MMR3HyperHCVirt2HCPhys(pVM, pVM->pgm.s.pvZeroPgR3)
     941                                    : _4G - PAGE_SIZE * 2 /* fake to avoid PGM_PAGE_INIT_ZERO assertion */;
     942            AssertRelease(pVM->pgm.s.HCPhysZeroPg != NIL_RTHCPHYS);
    928943        }
    929944    }
     
    939954        {
    940955            ASMMemFill32(pVM->pgm.s.pvMmioPgR3, PAGE_SIZE, 0xfeedface);
    941             pVM->pgm.s.HCPhysMmioPg = MMR3HyperHCVirt2HCPhys(pVM, pVM->pgm.s.pvMmioPgR3);
    942             AssertRelease(pVM->pgm.s.HCPhysMmioPg != NIL_RTHCPHYS || fDriverless);
     956            pVM->pgm.s.HCPhysMmioPg = !fDriverless ? MMR3HyperHCVirt2HCPhys(pVM, pVM->pgm.s.pvMmioPgR3)
     957                                    : _4G - PAGE_SIZE * 3 /* fake to avoid PGM_PAGE_INIT_ZERO assertion */;
     958            AssertRelease(pVM->pgm.s.HCPhysMmioPg != NIL_RTHCPHYS);
    943959            pVM->pgm.s.HCPhysInvMmioPg = pVM->pgm.s.HCPhysMmioPg;
    944960        }
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