Changeset 99079 in vbox
- Timestamp:
- Mar 21, 2023 11:05:38 AM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 156444
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/MM.cpp
r99051 r99079 269 269 270 270 271 #if defined(VBOX_VMM_TARGET_ARMV8) 272 /** 273 * This sets up the RAM ranges from the VM config. 274 * 275 * @returns VBox status code. 276 * @param pVM The cross context VM structure. 277 * @param pMMCfg Pointer to the CFGM node holding the RAM config. 278 * 279 * @note On ARM there is no "standard" way to handle RAM like on x86. 280 * Every SoC can have multiple RAM regions scattered across the whole 281 * address space so we have to be much more flexible here. 282 */ 283 static int mmR3InitRamArmV8(PVM pVM, PCFGMNODE pMMCfg) 284 { 285 int rc = VINF_SUCCESS; 286 PCFGMNODE pMemRegions = CFGMR3GetChild(pMMCfg, "MemRegions"); 287 288 pVM->mm.s.cbRamBase = 0; 289 pVM->mm.s.cbRamHole = 0; 290 pVM->mm.s.cbRamBelow4GB = 0; 291 pVM->mm.s.cbRamAbove4GB = 0; 292 293 for (PCFGMNODE pCur = CFGMR3GetFirstChild(pMemRegions); pCur; pCur = CFGMR3GetNextChild(pCur)) 294 { 295 char szMemRegion[512]; RT_ZERO(szMemRegion); 296 rc = CFGMR3GetName(pCur, &szMemRegion[0], sizeof(szMemRegion)); 297 if (RT_FAILURE(rc)) 298 { 299 LogRel(("Failed to query memory region name -> %Rrc\n", rc)); 300 break; 301 } 302 303 uint64_t u64GCPhysStart = 0; 304 rc = CFGMR3QueryU64(pCur, "GCPhysStart", &u64GCPhysStart); 305 if (RT_FAILURE(rc)) 306 { 307 LogRel(("Failed to query \"GCPhysStart\" for memory region %s -> %Rrc\n", szMemRegion, rc)); 308 break; 309 } 310 311 uint64_t u64MemSize = 0; 312 rc = CFGMR3QueryU64(pCur, "Size", &u64MemSize); 313 if (RT_FAILURE(rc)) 314 { 315 LogRel(("Failed to query \"Size\" for memory region %s -> %Rrc\n", szMemRegion, rc)); 316 break; 317 } 318 319 rc = PGMR3PhysRegisterRam(pVM, u64GCPhysStart, u64MemSize, "Conventional RAM"); 320 if (RT_FAILURE(rc)) 321 { 322 LogRel(("Failed to register memory region '%s' GCPhysStart=%RGp Size=%#RX64 -> %Rrc\n", 323 szMemRegion, u64GCPhysStart, u64MemSize)); 324 break; 325 } 326 327 pVM->mm.s.cbRamBase += u64MemSize; 328 if (u64GCPhysStart >= _4G) 329 pVM->mm.s.cbRamAbove4GB += u64MemSize; 330 else if (u64GCPhysStart + u64MemSize > _4G) 331 { 332 uint64_t cbRamAbove4GB = (u64GCPhysStart + u64MemSize) - _4G; 333 pVM->mm.s.cbRamAbove4GB += cbRamAbove4GB; 334 pVM->mm.s.cbRamBelow4GB += (u64MemSize - cbRamAbove4GB); 335 } 336 else 337 pVM->mm.s.cbRamBelow4GB += (uint32_t)u64MemSize; 338 } 339 340 return rc; 341 } 342 #endif 343 344 271 345 /** 272 346 * Initializes the MM parts which depends on PGM being initialized. … … 291 365 } 292 366 367 #if defined(VBOX_VMM_TARGET_ARMV8) 368 rc = mmR3InitRamArmV8(pVM, pMMCfg); 369 #else 293 370 /** @cfgm{/RamSize, uint64_t, 0, 16TB, 0} 294 371 * Specifies the size of the base RAM that is to be set up during … … 405 482 pVM->mm.s.cbRamAbove4GB = cbRam > offRamHole ? cbRam - offRamHole : 0; 406 483 407 #if defined(VBOX_VMM_TARGET_ARMV8)408 rc = PGMR3PhysRegisterRam(pVM, 0, cbRam, "Conventional RAM");409 #else410 484 /* First the conventional memory: */ 411 485 rc = PGMR3PhysRegisterRam(pVM, 0, RT_MIN(cbRam, 640*_1K), "Conventional RAM"); … … 424 498 } 425 499 } 426 #endif 500 #endif /* !VBOX_VMM_TARGET_ARMV8 */ 427 501 428 502 /*
Note:
See TracChangeset
for help on using the changeset viewer.