VirtualBox

Changeset 92192 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Nov 3, 2021 2:44:45 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
148021
Message:

VMM/MM,DevPcArch: Split the base RAM allocation into conventional (< 640KB) and extended (>= 1MB) ranges, leaving the UMA w/o RAM range backing. This will fit better with NEM, esp. on linux. bugref:10122

File:
1 edited

Legend:

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

    r91018 r92192  
    377377     * Make the initial memory reservation with GMM.
    378378     */
    379     uint64_t cBasePages = (cbRam >> PAGE_SHIFT) + pVM->mm.s.cBasePages;
     379    uint32_t const cbUma      = _1M - 640*_1K;
     380    uint64_t       cBasePages = ((cbRam - cbUma) >> PAGE_SHIFT) + pVM->mm.s.cBasePages;
    380381    rc = GMMR3InitialReservation(pVM,
    381382                                 RT_MAX(cBasePages + pVM->mm.s.cHandyPages, 1),
     
    407408     */
    408409    pVM->mm.s.cbRamHole = cbRamHole;
    409     if (cbRam > offRamHole)
    410     {
    411         pVM->mm.s.cbRamBelow4GB = offRamHole;
    412         rc = PGMR3PhysRegisterRam(pVM, 0, offRamHole, "Base RAM");
    413         if (RT_SUCCESS(rc))
     410
     411    /* First the conventional memory: */
     412    rc = PGMR3PhysRegisterRam(pVM, 0, RT_MIN(cbRam, 640*_1K), "Conventional RAM");
     413    if (RT_SUCCESS(rc))
     414    {
     415        /* The extended memory from 1MiB up to 4GiB: */
     416        if (cbRam > offRamHole)
    414417        {
    415             pVM->mm.s.cbRamAbove4GB = cbRam - offRamHole;
    416             rc = PGMR3PhysRegisterRam(pVM, _4G, cbRam - offRamHole, "Above 4GB Base RAM");
     418            pVM->mm.s.cbRamBelow4GB = offRamHole;
     419            rc = PGMR3PhysRegisterRam(pVM, _1M, offRamHole - _1M, "Extended RAM");
     420            if (RT_SUCCESS(rc))
     421            {
     422                /* Then all the memory above 4GiB: */
     423                pVM->mm.s.cbRamAbove4GB = cbRam - offRamHole;
     424                rc = PGMR3PhysRegisterRam(pVM, _4G, cbRam - offRamHole, "Above 4GB Base RAM");
     425            }
    417426        }
    418     }
    419     else
    420     {
    421         pVM->mm.s.cbRamBelow4GB = cbRam;
    422         pVM->mm.s.cbRamAbove4GB = 0;
    423         rc = PGMR3PhysRegisterRam(pVM, 0, cbRam, "Base RAM");
     427        else
     428        {
     429            pVM->mm.s.cbRamBelow4GB = cbRam;
     430            pVM->mm.s.cbRamAbove4GB = 0;
     431            if (cbRam > _1M)
     432                rc = PGMR3PhysRegisterRam(pVM, _1M, cbRam - _1M, "Extended RAM");
     433        }
    424434    }
    425435
     
    608618    uint64_t cOld = pVM->mm.s.cBasePages;
    609619    pVM->mm.s.cBasePages += cAddBasePages;
    610     LogFlow(("MMR3IncreaseBaseReservation: +%RU64 (%RU64 -> %RU64\n", cAddBasePages, cOld, pVM->mm.s.cBasePages));
     620    LogFlow(("MMR3IncreaseBaseReservation: +%RU64 (%RU64 -> %RU64)\n", cAddBasePages, cOld, pVM->mm.s.cBasePages));
    611621    int rc = mmR3UpdateReservation(pVM);
    612622    if (RT_FAILURE(rc))
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