summaryrefslogtreecommitdiffstats
path: root/sys/boot/ofw
diff options
context:
space:
mode:
authorgrehan <grehan@FreeBSD.org>2004-07-08 06:04:45 +0000
committergrehan <grehan@FreeBSD.org>2004-07-08 06:04:45 +0000
commitebf9bdd5488d9d612035dad8c7ac0544c74882fb (patch)
treec4417f586e3bd357638ea7d9fd47047d7db58037 /sys/boot/ofw
parente34c156b1bb02b71fce785b611ff5a8698df9cdd (diff)
downloadFreeBSD-src-ebf9bdd5488d9d612035dad8c7ac0544c74882fb.zip
FreeBSD-src-ebf9bdd5488d9d612035dad8c7ac0544c74882fb.tar.gz
Extract entry point from elf header before releasing the heap.
This caused a data-miss trap when the BAT init code was removed on PPC. Compile tested on: panther (sparc64). Code built, but not used, on sparc64.
Diffstat (limited to 'sys/boot/ofw')
-rw-r--r--sys/boot/ofw/libofw/elf_freebsd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/boot/ofw/libofw/elf_freebsd.c b/sys/boot/ofw/libofw/elf_freebsd.c
index 8e336b9..4a8855b 100644
--- a/sys/boot/ofw/libofw/elf_freebsd.c
+++ b/sys/boot/ofw/libofw/elf_freebsd.c
@@ -66,11 +66,13 @@ __elfN(ofw_exec)(struct preloaded_file *fp)
vm_offset_t mdp;
Elf_Ehdr *e;
int error;
+ intptr_t entry;
if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) {
return(EFTYPE);
}
e = (Elf_Ehdr *)&fmp->md_data;
+ entry = e->e_entry;
if ((error = md_load(fp->f_args, &mdp)) != 0)
return (error);
@@ -79,7 +81,7 @@ __elfN(ofw_exec)(struct preloaded_file *fp)
dev_cleanup();
ofw_release_heap();
- OF_chain((void *)reloc, end - (char *)reloc, (void *)e->e_entry,
+ OF_chain((void *)reloc, end - (char *)reloc, (void *)entry,
(void *)mdp, sizeof(mdp));
panic("exec returned");
OpenPOWER on IntegriCloud