diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2006-07-28 19:31:13 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2006-07-28 19:31:13 +0000 |
commit | 4a1f30398302bf2c4bca2975221b5149a0d0e4dc (patch) | |
tree | 9bdb8e68b929d8d2202f2dc6ac23f1374e74360f /sys/arch/armish/stand/boot | |
parent | 92a2e51906c1cfccb001dd7095cc31870b0112e7 (diff) |
Pass the end of the symbol table to the kernel.
Diffstat (limited to 'sys/arch/armish/stand/boot')
-rw-r--r-- | sys/arch/armish/stand/boot/exec.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/sys/arch/armish/stand/boot/exec.c b/sys/arch/armish/stand/boot/exec.c index d44aae439ba..7561e953100 100644 --- a/sys/arch/armish/stand/boot/exec.c +++ b/sys/arch/armish/stand/boot/exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.c,v 1.1 2006/07/28 17:12:06 kettenis Exp $ */ +/* $OpenBSD: exec.c,v 1.2 2006/07/28 19:31:12 kettenis Exp $ */ /* * Copyright (c) 2006 Mark Kettenis @@ -20,11 +20,37 @@ #include <lib/libsa/loadfile.h> +#ifdef BOOT_ELF +#include <sys/exec_elf.h> +#endif + typedef void (*startfuncp)(void) __attribute__ ((noreturn)); void run_loadfile(u_long *marks, int howto) { +#ifdef BOOT_ELF + Elf_Ehdr *elf = (Elf_Ehdr *)marks[MARK_SYM]; + Elf_Shdr *shp = (Elf_Shdr *)(marks[MARK_SYM] + elf->e_shoff); + u_long esym = marks[MARK_END]; + int i; + + /* + * Tell locore.S where the symbol table ends by setting + * 'esym', which should be the first word in the .data + * section. + */ + for (i = 0; i < elf->e_shnum; i++) { + /* XXX Assume .data is the first writable segment. */ + if (shp[i].sh_flags & SHF_WRITE) { + /* XXX We have to store the virtual address. */ + esym |= shp[i].sh_addr & 0xff000000; + *(u_long *)(shp[i].sh_addr & 0x00ffffff) = esym; + break; + } + } +#endif + (*(startfuncp)(marks[MARK_ENTRY]))(); /* NOTREACHED */ |