Changeset 18880 in vbox
- Timestamp:
- Apr 14, 2009 9:42:01 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 45904
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/MM.cpp
r18792 r18880 429 429 else 430 430 rc = PGMR3PhysRegisterRam(pVM, 0, RT_MIN(cbRam, offRamHole), "Base RAM"); 431 if ( RT_SUCCESS(rc)432 && fPreAlloc)433 {434 /** @todo RamPreAlloc should be handled at the very end of the VM creation. (lazy bird) */435 return VM_SET_ERROR(pVM, VERR_NOT_IMPLEMENTED, "TODO: RamPreAlloc");436 }437 431 438 432 /* -
trunk/src/VBox/VMM/PGM.cpp
r18861 r18880 1209 1209 } 1210 1210 1211 rc = CFGMR3QueryBoolDef( pCfgPGM, "RamPreAlloc", &pVM->pgm.s.fRamPreAlloc, false);1211 rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "RamPreAlloc", &pVM->pgm.s.fRamPreAlloc, false); 1212 1212 AssertLogRelRCReturn(rc, rc); 1213 1213 … … 1873 1873 else 1874 1874 pVM->pgm.s.GCPhys4MBPSEMask = RT_BIT_64(32) - 1; 1875 1876 /* 1877 * Allocate memory if we're supposed to do that. 1878 */ 1879 if (pVM->pgm.s.fRamPreAlloc) 1880 rc = pgmR3PhysRamPreAllocate(pVM); 1875 1881 1876 1882 LogRel(("PGMR3InitFinalize: 4 MB PSE mask %RGp\n", pVM->pgm.s.GCPhys4MBPSEMask)); -
trunk/src/VBox/VMM/PGMInternal.h
r18746 r18880 2833 2833 2834 2834 2835 int pgmPhysAllocPage(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys); 2835 2836 int pgmPhysPageLoadIntoTlb(PPGM pPGM, RTGCPHYS GCPhys); 2836 2837 int pgmPhysPageLoadIntoTlbWithPage(PPGM pPGM, PPGMPAGE pPage, RTGCPHYS GCPhys); … … 2843 2844 VMMDECL(int) pgmPhysRomWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser); 2844 2845 #ifdef IN_RING3 2845 int pgmR3PhysChunkMap(PVM pVM, uint32_t idChunk, PPPGMCHUNKR3MAP ppChunk);2846 2846 void pgmR3PhysRelinkRamRanges(PVM pVM); 2847 int pgmR3PhysRamPreAllocate(PVM pVM); 2847 2848 int pgmR3PhysRamReset(PVM pVM); 2848 2849 int pgmR3PhysRomReset(PVM pVM); 2850 int pgmR3PhysChunkMap(PVM pVM, uint32_t idChunk, PPPGMCHUNKR3MAP ppChunk); 2849 2851 2850 2852 int pgmR3PoolInit(PVM pVM); … … 2882 2884 #endif 2883 2885 2886 int pgmR3ExitShadowModeBeforePoolFlush(PVM pVM); 2887 int pgmR3ReEnterShadowModeAfterPoolFlush(PVM pVM); 2888 2884 2889 void pgmMapSetShadowPDEs(PVM pVM, PPGMMAPPING pMap, unsigned iNewPDE); 2885 2890 void pgmMapClearShadowPDEs(PVM pVM, PPGMPOOLPAGE pShwPageCR3, PPGMMAPPING pMap, unsigned iOldPDE, bool fDeactivateCR3); -
trunk/src/VBox/VMM/PGMPhys.cpp
r18873 r18880 1019 1019 REMR3NotifyPhysRamRegister(pVM, GCPhys, cb, REM_NOTIFY_PHYS_RAM_FLAGS_RAM); 1020 1020 1021 return VINF_SUCCESS; 1022 } 1023 1024 1025 /** 1026 * Worker called by PGMR3InitFinalize if we're configured to pre-allocate RAM. 1027 * 1028 * We do this late in the init process so that all the ROM and MMIO ranges have 1029 * been registered already and we don't go wasting memory on them. 1030 * 1031 * @returns VBox status code. 1032 * 1033 * @param pVM Pointer to the shared VM structure. 1034 */ 1035 int pgmR3PhysRamPreAllocate(PVM pVM) 1036 { 1037 Assert(pVM->pgm.s.fRamPreAlloc); 1038 Log(("pgmR3PhysRamPreAllocate: enter\n")); 1039 1040 /* 1041 * Walk the RAM ranges and allocate all RAM pages, halt at 1042 * the first allocation error. 1043 */ 1044 uint64_t cPages = 0; 1045 uint64_t NanoTS = RTTimeNanoTS(); 1046 pgmLock(pVM); 1047 for (PPGMRAMRANGE pRam = pVM->pgm.s.pRamRangesR3; pRam; pRam = pRam->pNextR3) 1048 { 1049 PPGMPAGE pPage = &pRam->aPages[0]; 1050 RTGCPHYS GCPhys = pRam->GCPhys; 1051 uint32_t cLeft = pRam->cb >> PAGE_SHIFT; 1052 while (cLeft-- > 0) 1053 { 1054 if (PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_RAM) 1055 { 1056 switch (PGM_PAGE_GET_STATE(pPage)) 1057 { 1058 case PGM_PAGE_STATE_ZERO: 1059 { 1060 int rc = pgmPhysAllocPage(pVM, pPage, GCPhys); 1061 if (RT_FAILURE(rc)) 1062 { 1063 LogRel(("PGM: RAM Pre-allocation failed at %RGp (in %s) with rc=%Rrc\n", GCPhys, pRam->pszDesc, rc)); 1064 pgmUnlock(pVM); 1065 return rc; 1066 } 1067 cPages++; 1068 break; 1069 } 1070 1071 case PGM_PAGE_STATE_ALLOCATED: 1072 case PGM_PAGE_STATE_WRITE_MONITORED: 1073 case PGM_PAGE_STATE_SHARED: 1074 /* nothing to do here. */ 1075 break; 1076 } 1077 } 1078 1079 /* next */ 1080 pPage++; 1081 GCPhys += PAGE_SIZE; 1082 } 1083 } 1084 pgmUnlock(pVM); 1085 NanoTS = RTTimeNanoTS() - NanoTS; 1086 1087 LogRel(("PGM: Pre-allocated %llu pages in %llu ms\n", cPages, NanoTS / 1000000)); 1088 Log(("pgmR3PhysRamPreAllocate: returns VINF_SUCCESS\n")); 1021 1089 return VINF_SUCCESS; 1022 1090 } … … 1489 1557 int rc = MMR3AdjustFixedReservation(pVM, cPages, pszDesc); 1490 1558 if (RT_SUCCESS(rc)) 1491 { 1559 { 1492 1560 void *pvPages; 1493 1561 PSUPPAGE paPages = (PSUPPAGE)RTMemTmpAlloc(cPages * sizeof(SUPPAGE)); … … 1497 1565 { 1498 1566 memset(pvPages, 0, cPages * PAGE_SIZE); 1499 1567 1500 1568 /* 1501 1569 * Create the MMIO2 range record for it. … … 1520 1588 pNew->RamRange.cb = cb; 1521 1589 //pNew->RamRange.fFlags = 0; /// @todo MMIO2 flag? 1522 1590 1523 1591 pNew->RamRange.pvR3 = pvPages; 1524 1592 1525 1593 uint32_t iPage = cPages; 1526 1594 while (iPage-- > 0) … … 1530 1598 PGMPAGETYPE_MMIO2, PGM_PAGE_STATE_ALLOCATED); 1531 1599 } 1532 1600 1533 1601 /* update page count stats */ 1534 1602 pVM->pgm.s.cAllPages += cPages; 1535 1603 pVM->pgm.s.cPrivatePages += cPages; 1536 1604 1537 1605 /* 1538 1606 * Link it into the list. … … 1541 1609 pNew->pNextR3 = pVM->pgm.s.pMmio2RangesR3; 1542 1610 pVM->pgm.s.pMmio2RangesR3 = pNew; 1543 1611 1544 1612 *ppv = pvPages; 1545 1613 RTMemTmpFree(paPages); 1546 1614 return VINF_SUCCESS; 1547 1615 } 1548 1616 1549 1617 SUPR3PageFreeEx(pvPages, cPages); 1550 1618 } -
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r18716 r18880 334 334 * 335 335 * @remarks This function shouldn't really fail, however if it does 336 * it probably means we've screwed up the size of the amount 337 * and/or the low-water mark of handy pages. Or, that some 338 * device I/O is causing a lot of pages to be allocated while 339 * while the host is in a low-memory condition. 336 * it probably means we've screwed up the size of handy pages and/or 337 * the low-water mark. Or, that some device I/O is causing a lot of 338 * pages to be allocated while while the host is in a low-memory 339 * condition. This latter should be handled elsewhere and in a more 340 * controlled manner, it's on the @bugref{3170} todo list... 340 341 */ 341 342 int pgmPhysAllocPage(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys)
Note:
See TracChangeset
for help on using the changeset viewer.