Changeset 92192 in vbox
- Timestamp:
- Nov 3, 2021 2:44:45 PM (3 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevPcArch.cpp
r91920 r92192 215 215 RT_NOREF(pDevIns, pvUser, off); 216 216 memset(pv, 0xff, cb); 217 return VINF_SUCCESS;218 }219 220 221 /**222 * @interface_method_impl{PDMDEVREG,pfnInitComplete,223 * Turn RAM pages between 0xa0000 and 0xfffff into reserved memory.}224 */225 static DECLCALLBACK(int) pcarchInitComplete(PPDMDEVINS pDevIns)226 {227 int iRegion = 0;228 RTGCPHYS const GCPhysEnd = 0x100000;229 RTGCPHYS GCPhysCur = 0x0a0000;230 do231 {232 if (!PDMDevHlpPhysIsGCPhysNormal(pDevIns, GCPhysCur))233 GCPhysCur += X86_PAGE_SIZE;234 else235 {236 RTGCPHYS const GCPhysStart = GCPhysCur;237 do238 GCPhysCur += X86_PAGE_SIZE;239 while (GCPhysCur < GCPhysEnd && PDMDevHlpPhysIsGCPhysNormal(pDevIns, GCPhysCur));240 241 IOMMMIOHANDLE hMmioRegion;242 int rc = PDMDevHlpMmioCreateAndMap(pDevIns, GCPhysStart, GCPhysCur - GCPhysStart,243 pcarchReservedMemoryWrite, pcarchReservedMemoryRead,244 IOMMMIO_FLAGS_READ_PASSTHRU | IOMMMIO_FLAGS_WRITE_PASSTHRU | IOMMMIO_FLAGS_ABS,245 PDMDevHlpMMHeapAPrintf(pDevIns, MM_TAG_PGM_PHYS /* bad bird*/, "PC Arch Reserved #%u", iRegion),246 &hMmioRegion);247 AssertLogRelRCReturn(rc, rc);248 iRegion++;249 }250 } while (GCPhysCur < GCPhysEnd);251 252 217 return VINF_SUCCESS; 253 218 } … … 324 289 /* .pfnDetach = */ NULL, 325 290 /* .pfnQueryInterface = */ NULL, 326 /* .pfnInitComplete = */ pcarchInitComplete,291 /* .pfnInitComplete = */ NULL, 327 292 /* .pfnPowerOff = */ NULL, 328 293 /* .pfnSoftReset = */ NULL, -
trunk/src/VBox/VMM/VMMR3/MM.cpp
r91018 r92192 377 377 * Make the initial memory reservation with GMM. 378 378 */ 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; 380 381 rc = GMMR3InitialReservation(pVM, 381 382 RT_MAX(cBasePages + pVM->mm.s.cHandyPages, 1), … … 407 408 */ 408 409 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) 414 417 { 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 } 417 426 } 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 } 424 434 } 425 435 … … 608 618 uint64_t cOld = pVM->mm.s.cBasePages; 609 619 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)); 611 621 int rc = mmR3UpdateReservation(pVM); 612 622 if (RT_FAILURE(rc))
Note:
See TracChangeset
for help on using the changeset viewer.