diff options
author | marcel <marcel@FreeBSD.org> | 2011-04-03 22:31:51 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2011-04-03 22:31:51 +0000 |
commit | e253ede76350c4b63552fb9fa2ab251200bba4d6 (patch) | |
tree | eca323dd0978bd6b21c62e82ce8932b641bfb4e0 /sys/boot/pc98 | |
parent | 37c0565836f4c33ee4fcf4b66d577ca704ea5375 (diff) | |
download | FreeBSD-src-e253ede76350c4b63552fb9fa2ab251200bba4d6.zip FreeBSD-src-e253ede76350c4b63552fb9fa2ab251200bba4d6.tar.gz |
Add 2 new archsw interfaces:
1. arch_loadaddr - used by platform code to adjust the address at which
the object gets loaded. Implement PC98 using this new interface instead
of using conditional compilation. For ELF objects the ELF header is
passed as the data pointer. For raw files it's the filename. Note that
ELF objects are first considered as raw files.
2. arch_loadseg - used by platform code to keep track of actual segments,
so that (instruction) caches can be flushed or translations can be
created. Both the ELF header as well as the program header are passed
to allow platform code to treat the kernel proper differently from any
additional modules and to have all the relevant details of the loaded
segment (e.g. protection).
Diffstat (limited to 'sys/boot/pc98')
-rw-r--r-- | sys/boot/pc98/loader/main.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/boot/pc98/loader/main.c b/sys/boot/pc98/loader/main.c index da14d0b..391c5e9 100644 --- a/sys/boot/pc98/loader/main.c +++ b/sys/boot/pc98/loader/main.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include <string.h> #include <machine/bootinfo.h> #include <machine/psl.h> +#include <sys/param.h> #include <sys/reboot.h> #include "bootstrap.h" @@ -77,6 +78,21 @@ extern char end[]; static void *heap_top; static void *heap_bottom; +static uint64_t +pc98_loadaddr(u_int type, void *data, uint64_t addr) +{ + struct stat st; + + if (type == LOAD_ELF) + return (roundup(addr, PAGE_SIZE)); + + /* We cannot use 15M-16M area on pc98. */ + if (type == LOAD_RAW && addr < 0x1000000 && stat(data, &st) == 0 && + (st.st_size == -1 || addr + st.st_size > 0xf00000)) + addr = 0x1000000; + return (addr); +} + int main(void) { @@ -160,6 +176,7 @@ main(void) archsw.arch_readin = i386_readin; archsw.arch_isainb = isa_inb; archsw.arch_isaoutb = isa_outb; + archsw.arch_loadaddr = pc98_loadaddr; /* * March through the device switch probing for things. |