VirtualBox

Changeset 6535 in vbox


Ignore:
Timestamp:
Jan 28, 2008 7:16:04 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
27562
Message:

MM::cbRAMSize -> MM:cbRamRegistered. Drop MM:pvRamBaseHC. Drop VBOX_WITH_PREALLOC_RAM_BY_DEFAULT.

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

Legend:

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

    r6532 r6535  
    187187{
    188188    LogFlow(("MMR3InitPaging:\n"));
    189     bool        fPreAlloc;
     189
     190    /*
     191     * Query the CFGM values.
     192     */
     193    bool fPreAlloc;
    190194    int rc = CFGMR3QueryBool(CFGMR3GetRoot(pVM), "RamPreAlloc", &fPreAlloc);
    191195    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    192 #ifdef VBOX_WITH_PREALLOC_RAM_BY_DEFAULT
    193         fPreAlloc = true;
    194 #else
    195196        fPreAlloc = false;
    196 #endif
    197197    else
    198198        AssertMsgRCReturn(rc, ("Configuration error: Failed to query integer \"RamPreAlloc\", rc=%Vrc.\n", rc), rc);
    199199
    200     uint64_t    cbRam;
     200    uint64_t cbRam;
    201201    rc = CFGMR3QueryU64(CFGMR3GetRoot(pVM), "RamSize", &cbRam);
    202202    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    203203        cbRam = 0;
    204     if (VBOX_SUCCESS(rc) || rc == VERR_CFGM_VALUE_NOT_FOUND)
     204    if (    RT_SUCCESS(rc)
     205        ||  rc == VERR_CFGM_VALUE_NOT_FOUND)
    205206    {
    206207        if (cbRam < PAGE_SIZE)
     
    209210            return VINF_SUCCESS;
    210211        }
     212
     213        /*
     214         * Register the memory.
     215         */
    211216        Log(("MM: %llu bytes of RAM%s\n", cbRam, fPreAlloc ? " (PreAlloc)" : ""));
    212         pVM->mm.s.pvRamBaseHC = 0; /** @todo obsolete */
    213         pVM->mm.s.cbRamBase   = cbRam & PAGE_BASE_GC_MASK;
    214         rc = MMR3PhysRegister(pVM, pVM->mm.s.pvRamBaseHC, 0, pVM->mm.s.cbRamBase, MM_RAM_FLAGS_DYNAMIC_ALLOC, "Main Memory");
    215         if (VBOX_SUCCESS(rc))
     217        pVM->mm.s.cbRamBase = cbRam & X86_PTE_PAE_PG_MASK;
     218        rc = MMR3PhysRegister(pVM, NULL, 0, pVM->mm.s.cbRamBase, MM_RAM_FLAGS_DYNAMIC_ALLOC, "Main Memory");
     219        if (RT_SUCCESS(rc))
    216220        {
    217             /* Allocate the first chunk, as we'll map ROM ranges there. */
     221            /*
     222             * Allocate the first chunk, as we'll map ROM ranges there.
     223             * If requested, allocated the rest too.
     224             */
    218225            rc = PGM3PhysGrowRange(pVM, (RTGCPHYS)0);
    219             if (VBOX_SUCCESS(rc))
    220             {
    221                 /* Should we preallocate the entire guest RAM? */
    222                 if (fPreAlloc)
    223                 {
    224                     for (RTGCPHYS GCPhys = PGM_DYNAMIC_CHUNK_SIZE; GCPhys < cbRam; GCPhys += PGM_DYNAMIC_CHUNK_SIZE)
    225                     {
    226                         rc = PGM3PhysGrowRange(pVM, GCPhys);
    227                         if (VBOX_FAILURE(rc))
    228                             return rc;
    229                     }
    230                 }
    231                 return rc;
    232             }
     226            if (RT_SUCCESS(rc) && fPreAlloc)
     227                for (RTGCPHYS GCPhys = PGM_DYNAMIC_CHUNK_SIZE;
     228                     GCPhys < cbRam && RT_SUCCESS(rc);
     229                     GCPhys += PGM_DYNAMIC_CHUNK_SIZE)
     230                    rc = PGM3PhysGrowRange(pVM, GCPhys);
    233231        }
    234232    }
     
    347345
    348346    /* (PGM saves the physical memory.) */
    349     SSMR3PutUInt(pSSM, pVM->mm.s.cbRAMSize);
     347    SSMR3PutUInt(pSSM, pVM->mm.s.cbRamRegistered);
    350348    return SSMR3PutUInt(pSSM, pVM->mm.s.cbRamBase);
    351349}
     
    374372
    375373    /*
    376      * Check the cbRAMSize and cbRamBase values.
     374     * Check the cbRamRegistered and cbRamBase values.
    377375     */
    378376    RTUINT  cb;
     
    380378    if (VBOX_FAILURE(rc))
    381379        return rc;
    382     if (cb != pVM->mm.s.cbRAMSize)
    383     {
    384         Log(("mmR3Load: Memory configuration has changed. cbRAMSize=%#x save %#x\n", pVM->mm.s.cbRAMSize, cb));
     380    if (cb != pVM->mm.s.cbRamRegistered)
     381    {
     382        Log(("mmR3Load: Memory configuration has changed. cbRamRegistered=%#x save %#x\n", pVM->mm.s.cbRamRegistered, cb));
    385383        return VERR_SSM_LOAD_MEMORY_SIZE_MISMATCH;
    386384    }
  • trunk/src/VBox/VMM/MMInternal.h

    r6529 r6535  
    662662    /** Size of the currently allocated guest RAM.
    663663     * Mark that this is the actual size, not the end address. */
    664     RTUINT                      cbRAMSize;
     664    RTUINT                      cbRamRegistered;
    665665    /** Size of the base RAM in bytes. */
    666666    RTUINT                      cbRamBase;
    667     /** Pointer to the base RAM. */
    668     R3PTRTYPE(void *)           pvRamBaseHC;
    669667    /** The head of the ROM ranges. */
    670668    R3PTRTYPE(PMMROMRANGE)      pRomHead;
  • trunk/src/VBox/VMM/MMPhys.cpp

    r6529 r6535  
    132132        {
    133133            if (fFlags == MM_RAM_FLAGS_DYNAMIC_ALLOC)
    134                 pVM->mm.s.cbRAMSize += cb;
     134                pVM->mm.s.cbRamRegistered += cb;
    135135
    136136            REMR3NotifyPhysRamRegister(pVM, GCPhys, cb, pvRam, fFlags);
     
    165165                {
    166166                    if (!fFlags)
    167                         pVM->mm.s.cbRAMSize += cb;
     167                        pVM->mm.s.cbRamRegistered += cb;
    168168
    169169                    REMR3NotifyPhysRamRegister(pVM, GCPhys, cb, pvRam, fFlags);
  • trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp

    r5999 r6535  
    182182    GEN_CHECK_OFF(MM, pvDummyPage);
    183183    GEN_CHECK_OFF(MM, HCPhysDummyPage);
    184     GEN_CHECK_OFF(MM, cbRAMSize);
    185     GEN_CHECK_OFF(MM, pvRamBaseHC);
     184    GEN_CHECK_OFF(MM, cbRamRegistered);
    186185    GEN_CHECK_OFF(MM, cbRamBase);
    187186    GEN_CHECK_OFF(MM, pHeap);
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