VirtualBox

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


Ignore:
Timestamp:
Nov 15, 2021 1:21:17 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
148281
Message:

VMM/MM: Split the extended memory range to get better large page alignment when in simplified memory mode (NEM). bugref:10122

File:
1 edited

Legend:

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

    r92192 r92425  
    407407     * Setup the base ram (PGM).
    408408     */
    409     pVM->mm.s.cbRamHole = cbRamHole;
     409    pVM->mm.s.cbRamHole     = cbRamHole;
     410    pVM->mm.s.cbRamBelow4GB = cbRam > offRamHole ? offRamHole         : cbRam;
     411    pVM->mm.s.cbRamAbove4GB = cbRam > offRamHole ? cbRam - offRamHole : 0;
    410412
    411413    /* First the conventional memory: */
    412414    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)
     415    if (RT_SUCCESS(rc) && cbRam >= _1M)
     416    {
     417        /* The extended memory from 1MiB to 2MiB to align better with large pages in NEM mode: */
     418        rc = PGMR3PhysRegisterRam(pVM, _1M, RT_MIN(_1M, cbRam - _1M), "Extended RAM, 1-2MB");
     419        if (cbRam > _2M)
    417420        {
    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;
     421            /* The extended memory from 2MiB up to 4GiB: */
     422            rc = PGMR3PhysRegisterRam(pVM, _2M, pVM->mm.s.cbRamBelow4GB - _2M, "Extended RAM, >2MB");
     423
     424            /* Then all the memory above 4GiB: */
     425            if (RT_SUCCESS(rc) && pVM->mm.s.cbRamAbove4GB > 0)
    424426                rc = PGMR3PhysRegisterRam(pVM, _4G, cbRam - offRamHole, "Above 4GB Base RAM");
    425             }
    426         }
    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");
    433427        }
    434428    }
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