Module Name: src Committed By: maxv Date: Tue Dec 20 14:03:15 UTC 2016
Modified Files: src/sys/arch/amd64/amd64: machdep.c src/sys/arch/i386/i386: machdep.c src/sys/arch/x86/x86: pmap.c x86_machdep.c Log Message: When the i386 port was designed, the bootstrap code needed little physical memory, and taking it below the kernel image was fine: we had 160 free pages, and never allocated more than 20. With amd64 however, we create a direct map, and for this map we need a number of page table pages that is mostly proportionate to the number of physical addresses available, which implies that these 160 free pages may not be enough. In particular, if the CPU does not support 1GB superpages, each 1GB chunk of physical memory needs a 4k page in the direct map, which means that if a machine has 160GB of ram, the bootstrap code allocates more than 160 pages, thereby overwriting the I/O mem area. If we push a little further, if a machine has 512GB of ram, we allocate ~525 pages, and start overwriting the kernel text, causing the system to go crazy at boot time. Fix this moving the physical allocation area from below the kernel to above it. avail_start is now beyond the kernel, and lowmem_rsvd indicates the reserved low-memory pages. The area [lowmem_rsvd; IOM_BEGIN[ is internalized into UVM, so there is no pa loss. The only limit now is the pa of LAPIC, which is located at ~4GB of memory, so it is perfectly fine. This change theoretically adds va support for 512GB of ram; and it is a prerequisite if we want to support more memory anyway. To generate a diff of this commit: cvs rdiff -u -r1.239 -r1.240 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.769 -r1.770 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.233 -r1.234 src/sys/arch/x86/x86/pmap.c cvs rdiff -u -r1.78 -r1.79 src/sys/arch/x86/x86/x86_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.