boot - Put loader heap in high memory
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 26 Jul 2015 08:03:46 +0000 (01:03 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 26 Jul 2015 08:03:46 +0000 (01:03 -0700)
commit349c99ee28c800cca8338621e90b603e7d452adc
treebfa4eb3608e78ec3bcffbb6d9fcd1d7a050cfc73
parentfff0110a0b936812fc3f14008be83aa396551ce3
boot - Put loader heap in high memory

* We ran out of low BIOS memory.  The initrd.img.gz unpacking requires a
  bit more than ~32KB of temporary space and it ran the loader out of
  low-BIOS heap memory.

  This can cause the loader to fail to load the image and prevent proper
  crypto or single-user bootstrapping.

* Steal the heap from high-memory, just ender the kernel+modules load area
  limit.  For now, steal 1MB, which gives the loader plenty of space again.
  The kernel will lose 1MB of physical memory, boo-hoo.

* The loader must remove the heap from the SMAP passed to the kernel.

* Move any objects requiring VTOPSEG/VTOPOFF out of malloc and into a
  static or stack declaration.

Reported-by: cgag, multiple
lib/libstand/sbrk.c
sys/boot/common/module.c
sys/boot/common/rel_open.c
sys/boot/pc32/libi386/biosdisk.c
sys/boot/pc32/libi386/biosmem.c
sys/boot/pc32/libi386/biossmap.c
sys/boot/pc32/libi386/libi386.h
sys/boot/pc32/loader/main.c