Changeset 92441 in vbox for trunk/src/VBox/VMM/VMMR3
- Timestamp:
- Nov 15, 2021 8:50:49 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp
r92435 r92441 1783 1783 /* 1784 1784 * The PGMRAMRANGE structures for the high memory can get very big. 1785 * In order to avoid SUPR3PageAllocEx allocation failures due to the 1786 * allocation size limit there and also to avoid being unable to find 1787 * guest mapping space for them, we split this memory up into 4MB in 1788 * (potential) raw-mode configs and 16MB chunks in forced AMD-V/VT-x 1789 * mode. 1790 * 1791 * The first and last page of each mapping are guard pages and marked 1792 * not-present. So, we've got 4186112 and 16769024 bytes available for 1793 * the PGMRAMRANGE structure. 1785 * There used to be some limitations on SUPR3PageAllocEx allocation 1786 * sizes, so traditionally we limited this to 16MB chunks. These days 1787 * we do ~64 MB chunks each covering 16GB of guest RAM, making sure 1788 * each range is a multiple of 1GB to enable eager hosts to use 1GB 1789 * pages in NEM mode. 1794 1790 * 1795 1791 * See also pgmR3PhysMmio2CalcChunkCount. 1796 *1797 * Note! The sizes used here will influence the saved state.1798 1792 */ 1799 uint32_t cbChunk = _16M; 1800 uint32_t cPagesPerChunk = 1047552; /* max ~1048059 */ 1801 Assert(cPagesPerChunk / 512 * 512 == cPagesPerChunk); /* NEM large page requirement */ 1802 AssertCompile(sizeof(PGMRAMRANGE) + sizeof(PGMPAGE) * 1047552 < _16M - PAGE_SIZE * 2); 1803 AssertRelease(RT_UOFFSETOF_DYN(PGMRAMRANGE, aPages[cPagesPerChunk]) + PAGE_SIZE * 2 <= cbChunk); 1793 uint32_t const cPagesPerChunk = _4M; 1794 Assert(RT_ALIGN_32(cPagesPerChunk, X86_PD_PAE_SHIFT - X86_PAGE_SHIFT)); /* NEM large page requirement: 1GB pages. */ 1804 1795 1805 1796 RTGCPHYS cPagesLeft = cPages; … … 2710 2701 * Note! In additions, we've got a 24 bit sub-page range for MMIO2 ranges, leaving 2711 2702 * us with an absolute maximum of 16777215 pages per chunk (close to 64 GB). 2712 * 2713 * P.S. If we want to include a dirty bitmap, we'd have to drop down to 1040384 pages. 2714 */ 2715 uint32_t cbChunk = _16M; 2716 uint32_t cPagesPerChunk = 1047552; /* max ~1048059 */ 2717 Assert(cPagesPerChunk / 64 * 64 == cPagesPerChunk); /* (NEM requirement) */ 2718 Assert(cPagesPerChunk / 512 * 512 == cPagesPerChunk); /* (NEM large page requirement) */ 2719 AssertCompile(sizeof(PGMREGMMIO2RANGE) + sizeof(PGMPAGE) * 1047552 < _16M - PAGE_SIZE * 2); 2720 AssertRelease(cPagesPerChunk <= PGM_MMIO2_MAX_PAGE_COUNT); /* See above note. */ 2721 AssertRelease(RT_UOFFSETOF_DYN(PGMREGMMIO2RANGE, RamRange.aPages[cPagesPerChunk]) + PAGE_SIZE * 2 <= cbChunk); 2703 */ 2704 uint32_t const cPagesPerChunk = _4M; 2705 Assert(RT_ALIGN_32(cPagesPerChunk, X86_PD_PAE_SHIFT - X86_PAGE_SHIFT)); /* NEM large page requirement: 1GB pages. */ 2706 uint32_t const cbChunk = RT_UOFFSETOF_DYN(PGMREGMMIO2RANGE, RamRange.aPages[cPagesPerChunk]); 2707 AssertRelease(cPagesPerChunk < _16M); 2708 2722 2709 if (pcbChunk) 2723 2710 *pcbChunk = cbChunk;
Note:
See TracChangeset
for help on using the changeset viewer.