861a0b4808
PowerPC Apple hardware, and likely all Open Firmware systems. The loader would allocate memory for its heap at whatever address Open Firmware gave it, which would in general be the lowest unallocated address, usually starting a page or two above 0. As the kernel is linked at 1 MB, and loader insists on running the kernel at its link address, any heap larger than 1 MB would overlap the kernel, causing loader memory allocations to corrupt the kernel and vice versa. Although r328806 made this problem much worse by increasing the heap size to 8 MB, causing 88% of the loader heap to overlap with the kernel, the problem has always existed. The old heap size was 1 MB and, unless that started exactly at zero, which would cause other problems, some number of pages of the loader heap still overlapped with the kernel. This patch solves the issue in two ways and cleans up some related code: - Moves the loader heap inside of the loader. This guarantees that the heap will be contiguous with the loader and simplifies the heap allocation code at no cost, since the heap lives in BSS. - Moves the loader, previously at 28 MB and dangerously close to the kernel it loads, a bit higher to 44 MB. This has the effect of breaking loader on non-embedded PPC machines with < 48 MB of RAM, but we did not support those anyway. The fundamental problem is that the way loader loads ELF files is incredibly fragile, but that can't be fixed without fundamental architectural changes. MFC after: 10 days |
||
---|---|---|
.. | ||
arm | ||
arm64 | ||
common | ||
efi | ||
fdt | ||
ficl | ||
ficl32 | ||
forth | ||
geli | ||
i386 | ||
kshim | ||
libsa | ||
libsa32 | ||
man | ||
mips | ||
ofw | ||
powerpc | ||
sparc64 | ||
uboot | ||
usb | ||
userboot | ||
zfs | ||
zfs32 | ||
defs.mk | ||
fdt.mk | ||
ficl.mk | ||
loader.mk | ||
Makefile | ||
Makefile.amd64 | ||
Makefile.arm | ||
Makefile.arm64 | ||
Makefile.i386 | ||
Makefile.inc | ||
Makefile.mips | ||
Makefile.powerpc | ||
Makefile.sparc64 | ||
uboot.mk |