load should place the file at load-base, whilst init-program should parse the memory at load-base and set up the context accordingly.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- arch/unix/boot.c | 7 ++++++- libopenbios/elf_load.c | 16 ++++++---------- libopenbios/load.c | 9 +++------ 3 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/arch/unix/boot.c b/arch/unix/boot.c index d65681f..63a623d 100644 --- a/arch/unix/boot.c +++ b/arch/unix/boot.c @@ -5,12 +5,12 @@ #include "config.h" #include "libopenbios/bindings.h" #include "libopenbios/elf_load.h" +#include "libopenbios/initprogram.h" #include "arch/common/nvram.h" #include "libc/diskio.h"
void boot(void); void *load_elf(char *spec); -unsigned int start_elf(unsigned long address);
void *load_elf(char *spec) @@ -90,3 +90,8 @@ start_elf(unsigned long address) return 0; }
+int +arch_init_program(void) +{ + return 0; +} diff --git a/libopenbios/elf_load.c b/libopenbios/elf_load.c index aa81e4c..f09ccf6 100644 --- a/libopenbios/elf_load.c +++ b/libopenbios/elf_load.c @@ -11,6 +11,7 @@ #include "libopenbios/sys_info.h" #include "libopenbios/ipchecksum.h" #include "libopenbios/bindings.h" +#include "libopenbios/initprogram.h" #include "libopenbios/ofmem.h" #define printf printk #define debug printk @@ -453,13 +454,10 @@ elf_load(struct sys_info *info, ihandle_t dev, const char *cmdline, void **boot_ debug("entry point is " FMT_elf "\n", addr_fixup(ehdr.e_entry));
// Initialise saved-program-state - PUSH(addr_fixup(ehdr.e_entry)); - feval("load-state >ls.entry !"); PUSH(file_size); feval("load-state >ls.file-size !"); - - feval("-1 state-valid !"); - + feval("elf load-state >ls.file-type !"); + out: close_io(fd); if (phdr) @@ -483,7 +481,6 @@ elf_init_program(void) uintptr_t tmp;
/* TODO: manage ELF notes section */ - feval("0 state-valid !"); feval("load-base"); base = (char*)cell2pointer(POP());
@@ -531,9 +528,8 @@ elf_init_program(void) // Initialise load-state PUSH(ehdr->e_entry); feval("load-state >ls.entry !"); - PUSH(total_size); - feval("load-state >ls.file-size !"); - feval("elf load-state >ls.file-type !"); - + + arch_init_program(); + feval("-1 state-valid !"); } diff --git a/libopenbios/load.c b/libopenbios/load.c index a78e3b3..edc95cb 100644 --- a/libopenbios/load.c +++ b/libopenbios/load.c @@ -71,12 +71,9 @@ void load(ihandle_t dev) POP(); param = pop_fstr_copy();
- elf_load(&sys_info, dev, param, &elf_boot_notes); - feval("state-valid @"); - valid = POP(); - if (valid) { - feval("load-state >ls.file-size @"); - return; + if (elf_load(&sys_info, dev, param, &elf_boot_notes) != LOADER_NOT_SUPPORT) { + feval("load-state >ls.file-size @"); + return; } #endif