I was curious to see if SeaBIOS could run in memory above 4GB. This series demonstrates that it is possible. At the end of this experimental patch series, SeaBIOS can relocate itself to physical ram above 4GB and it can also run its internal threads above 4GB.
I've tested this with QEMU running FreeDOS on an ATA drive - other configs are likely to break as most drivers have not been updated to use ioremap().
The series is also available at: https://github.com/KevinOConnor/seabios/tree/testing
The first 7 patches are cleanup patches and should probably be committed even without the others. The remaining patches become more specific to PAE and become increasingly more experimental. The final patch is mostly a hack, but it does verify that SeaBIOS could use PAE to make full use of any RAM in the system.
Patch 14 implements PAE paging support with a simple ioremap() hash scheme. The first 2MB uses an identity map, and no other memory is accessible without first calling ioremap() (or the similar memremap() ). That scheme is probably a bit too aggressive - it would likely be simpler to not require memremap() to access regular ram below 4GB.
-Kevin
Kevin O'Connor (15): e820: Introduce e820_remove() and avoid exporting E820_HOLE e820: Rename memmap.c to e820map.c and use consistent "e820_" prefix e820: Update debugging messages to report 64bit values virtio: Simplify vring alignment code virtio: Move standard definitions from virtio-ring.h to standard headers malloc: Use consistent naming for internal low-level "alloc" functions malloc: Introduce common helper alloc_new_detail() malloc: Don't mix virtual and physical addresses memmap: Move GDT declarations from misc.c to new file memmap.c optionroms: Use ioremap() on PCI rom bars to map them to memory smp: Use ioremap() on APIC memory tpm: Temporary ioremap() hack for tpm_drivers Implement protected mode exception handlers Experimental support for PAE paging Experiment with SeaBIOS internal memory above 4GB
Makefile | 4 +- src/Kconfig | 7 ++ src/{memmap.c => e820map.c} | 18 ++- src/{memmap.h => e820map.h} | 9 +- src/fw/coreboot.c | 8 +- src/fw/csm.c | 14 +-- src/fw/paravirt.c | 22 ++-- src/fw/pciinit.c | 6 +- src/fw/smp.c | 23 ++-- src/fw/xen.c | 9 +- src/hw/pvscsi.c | 2 +- src/hw/ramdisk.c | 5 +- src/hw/tpm_drivers.c | 6 +- src/hw/virtio-ring.h | 36 ++---- src/list.h | 10 ++ src/malloc.c | 296 ++++++++++++++++++++++++-------------------- src/malloc.h | 22 ++-- src/memmap.c | 282 +++++++++++++++++++++++++---------------- src/memmap.h | 48 +++---- src/misc.c | 45 ------- src/optionroms.c | 5 +- src/pmm.c | 16 +-- src/post.c | 6 +- src/romlayout.S | 54 ++++++-- src/stacks.c | 17 ++- src/system.c | 2 +- src/x86.h | 53 +++++++- 27 files changed, 606 insertions(+), 419 deletions(-) copy src/{memmap.c => e820map.c} (90%) copy src/{memmap.h => e820map.h} (66%)