Changeset 6535 in vbox
- Timestamp:
- Jan 28, 2008 7:16:04 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 27562
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/MM.cpp
r6532 r6535 187 187 { 188 188 LogFlow(("MMR3InitPaging:\n")); 189 bool fPreAlloc; 189 190 /* 191 * Query the CFGM values. 192 */ 193 bool fPreAlloc; 190 194 int rc = CFGMR3QueryBool(CFGMR3GetRoot(pVM), "RamPreAlloc", &fPreAlloc); 191 195 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 192 #ifdef VBOX_WITH_PREALLOC_RAM_BY_DEFAULT193 fPreAlloc = true;194 #else195 196 fPreAlloc = false; 196 #endif197 197 else 198 198 AssertMsgRCReturn(rc, ("Configuration error: Failed to query integer \"RamPreAlloc\", rc=%Vrc.\n", rc), rc); 199 199 200 uint64_t 200 uint64_t cbRam; 201 201 rc = CFGMR3QueryU64(CFGMR3GetRoot(pVM), "RamSize", &cbRam); 202 202 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 203 203 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) 205 206 { 206 207 if (cbRam < PAGE_SIZE) … … 209 210 return VINF_SUCCESS; 210 211 } 212 213 /* 214 * Register the memory. 215 */ 211 216 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)) 216 220 { 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 */ 218 225 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); 233 231 } 234 232 } … … 347 345 348 346 /* (PGM saves the physical memory.) */ 349 SSMR3PutUInt(pSSM, pVM->mm.s.cbR AMSize);347 SSMR3PutUInt(pSSM, pVM->mm.s.cbRamRegistered); 350 348 return SSMR3PutUInt(pSSM, pVM->mm.s.cbRamBase); 351 349 } … … 374 372 375 373 /* 376 * Check the cbR AMSizeand cbRamBase values.374 * Check the cbRamRegistered and cbRamBase values. 377 375 */ 378 376 RTUINT cb; … … 380 378 if (VBOX_FAILURE(rc)) 381 379 return rc; 382 if (cb != pVM->mm.s.cbR AMSize)383 { 384 Log(("mmR3Load: Memory configuration has changed. cbR AMSize=%#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)); 385 383 return VERR_SSM_LOAD_MEMORY_SIZE_MISMATCH; 386 384 } -
trunk/src/VBox/VMM/MMInternal.h
r6529 r6535 662 662 /** Size of the currently allocated guest RAM. 663 663 * Mark that this is the actual size, not the end address. */ 664 RTUINT cbR AMSize;664 RTUINT cbRamRegistered; 665 665 /** Size of the base RAM in bytes. */ 666 666 RTUINT cbRamBase; 667 /** Pointer to the base RAM. */668 R3PTRTYPE(void *) pvRamBaseHC;669 667 /** The head of the ROM ranges. */ 670 668 R3PTRTYPE(PMMROMRANGE) pRomHead; -
trunk/src/VBox/VMM/MMPhys.cpp
r6529 r6535 132 132 { 133 133 if (fFlags == MM_RAM_FLAGS_DYNAMIC_ALLOC) 134 pVM->mm.s.cbR AMSize+= cb;134 pVM->mm.s.cbRamRegistered += cb; 135 135 136 136 REMR3NotifyPhysRamRegister(pVM, GCPhys, cb, pvRam, fFlags); … … 165 165 { 166 166 if (!fFlags) 167 pVM->mm.s.cbR AMSize+= cb;167 pVM->mm.s.cbRamRegistered += cb; 168 168 169 169 REMR3NotifyPhysRamRegister(pVM, GCPhys, cb, pvRam, fFlags); -
trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp
r5999 r6535 182 182 GEN_CHECK_OFF(MM, pvDummyPage); 183 183 GEN_CHECK_OFF(MM, HCPhysDummyPage); 184 GEN_CHECK_OFF(MM, cbRAMSize); 185 GEN_CHECK_OFF(MM, pvRamBaseHC); 184 GEN_CHECK_OFF(MM, cbRamRegistered); 186 185 GEN_CHECK_OFF(MM, cbRamBase); 187 186 GEN_CHECK_OFF(MM, pHeap);
Note:
See TracChangeset
for help on using the changeset viewer.