From 3f2546b2ef55b661fd8dd69682b38992225e86f6 Mon Sep 17 00:00:00 2001 From: fishsoupisgood Date: Mon, 29 Apr 2019 01:17:54 +0100 Subject: Initial import of qemu-2.4.1 --- roms/openbios/arch/unix/boot.c | 84 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 roms/openbios/arch/unix/boot.c (limited to 'roms/openbios/arch/unix/boot.c') diff --git a/roms/openbios/arch/unix/boot.c b/roms/openbios/arch/unix/boot.c new file mode 100644 index 00000000..f4a29428 --- /dev/null +++ b/roms/openbios/arch/unix/boot.c @@ -0,0 +1,84 @@ +/* + * + */ +#undef BOOTSTRAP +#include "config.h" +#include "libopenbios/bindings.h" +#include "libopenbios/elf_load.h" +#include "arch/common/nvram.h" +#include "libc/diskio.h" + +void boot(void); +void *load_elf(char *spec); + +void +*load_elf(char *spec) +{ +#if 0 + int fd; + void *entry=NULL; + int i, lszz_offs, elf_offs; + char buf[128]; // , *addr; + Elf_ehdr ehdr; + Elf_phdr *phdr; + size_t s; + + if( (fd=open_io(spec)) == -1 ) + return NULL; + + if( (elf_offs=find_elf(fd)) < 0 ) { + printk("----> %s is not an ELF image\n", buf ); + return NULL; + } + + if( !(phdr=elf_readhdrs(fd, 0, &ehdr)) ) { + printk("elf32_readhdrs failed\n"); + return NULL; + } + + (unsigned long long *)entry = ehdr.e_entry; + + lszz_offs = elf_offs; + for( i=0; i