Author: mcayland Date: Sun Jun 27 16:00:37 2010 New Revision: 801 URL: http://tracker.coreboot.org/trac/openbios/changeset/801
Log: Move a.out loader into the new C load implementation (also fix up the header includes in load.c).
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@siriusit.co.uk
Modified: trunk/openbios-devel/arch/sparc32/boot.c trunk/openbios-devel/arch/sparc32/boot.h trunk/openbios-devel/arch/sparc64/boot.c trunk/openbios-devel/arch/sparc64/boot.h trunk/openbios-devel/arch/x86/boot.c trunk/openbios-devel/arch/x86/boot.h trunk/openbios-devel/arch/x86/openbios.c trunk/openbios-devel/include/libopenbios/aout_load.h trunk/openbios-devel/include/libopenbios/sys_info.h trunk/openbios-devel/libopenbios/aout_load.c trunk/openbios-devel/libopenbios/load.c
Modified: trunk/openbios-devel/arch/sparc32/boot.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/boot.c Sun Jun 27 15:14:03 2010 (r800) +++ trunk/openbios-devel/arch/sparc32/boot.c Sun Jun 27 16:00:37 2010 (r801) @@ -54,7 +54,7 @@
#ifdef CONFIG_LOADER_AOUT /* a.out loader */ - aout_load(&sys_info, path); + aout_load(&sys_info, dev); feval("state-valid @"); valid = POP(); if (valid)
Modified: trunk/openbios-devel/arch/sparc32/boot.h ============================================================================== --- trunk/openbios-devel/arch/sparc32/boot.h Sun Jun 27 15:14:03 2010 (r800) +++ trunk/openbios-devel/arch/sparc32/boot.h Sun Jun 27 16:00:37 2010 (r801) @@ -17,7 +17,6 @@ void *init_openprom(void);
// boot.c -extern struct sys_info sys_info; extern const char *bootpath; extern void boot(void); extern void go(void);
Modified: trunk/openbios-devel/arch/sparc64/boot.c ============================================================================== --- trunk/openbios-devel/arch/sparc64/boot.c Sun Jun 27 15:14:03 2010 (r800) +++ trunk/openbios-devel/arch/sparc64/boot.c Sun Jun 27 16:00:37 2010 (r801) @@ -46,7 +46,7 @@
#ifdef CONFIG_LOADER_AOUT /* a.out loader */ - aout_load(&sys_info, path); + aout_load(&sys_info, dev); feval("state-valid @"); valid = POP(); if (valid)
Modified: trunk/openbios-devel/arch/sparc64/boot.h ============================================================================== --- trunk/openbios-devel/arch/sparc64/boot.h Sun Jun 27 15:14:03 2010 (r800) +++ trunk/openbios-devel/arch/sparc64/boot.h Sun Jun 27 16:00:37 2010 (r801) @@ -15,7 +15,6 @@ uint64_t start_client_image(uint64_t entry_point, uint64_t cif_handler);
// boot.c -extern struct sys_info sys_info; extern uint64_t kernel_image; extern uint64_t kernel_size; extern uint64_t qemu_cmdline;
Modified: trunk/openbios-devel/arch/x86/boot.c ============================================================================== --- trunk/openbios-devel/arch/x86/boot.c Sun Jun 27 15:14:03 2010 (r800) +++ trunk/openbios-devel/arch/x86/boot.c Sun Jun 27 16:00:37 2010 (r801) @@ -43,7 +43,7 @@
#ifdef CONFIG_LOADER_AOUT /* a.out loader */ - aout_load(&sys_info, path); + aout_load(&sys_info, dev); feval("state-valid @"); valid = POP(); if (valid)
Modified: trunk/openbios-devel/arch/x86/boot.h ============================================================================== --- trunk/openbios-devel/arch/x86/boot.h Sun Jun 27 15:14:03 2010 (r800) +++ trunk/openbios-devel/arch/x86/boot.h Sun Jun 27 16:00:37 2010 (r801) @@ -14,6 +14,5 @@ unsigned int start_elf(unsigned long entry_point, unsigned long param);
/* boot.c */ -extern struct sys_info sys_info; extern void boot(void); extern void go(void);
Modified: trunk/openbios-devel/arch/x86/openbios.c ============================================================================== --- trunk/openbios-devel/arch/x86/openbios.c Sun Jun 27 15:14:03 2010 (r800) +++ trunk/openbios-devel/arch/x86/openbios.c Sun Jun 27 16:00:37 2010 (r801) @@ -75,7 +75,6 @@
int openbios(void) { - extern struct sys_info sys_info; #ifdef CONFIG_DEBUG_CONSOLE #ifdef CONFIG_DEBUG_CONSOLE_SERIAL uart_init(CONFIG_SERIAL_PORT, CONFIG_SERIAL_SPEED);
Modified: trunk/openbios-devel/include/libopenbios/aout_load.h ============================================================================== --- trunk/openbios-devel/include/libopenbios/aout_load.h Sun Jun 27 15:14:03 2010 (r800) +++ trunk/openbios-devel/include/libopenbios/aout_load.h Sun Jun 27 16:00:37 2010 (r801) @@ -21,7 +21,7 @@ #include "libopenbios/sys_info.h"
extern int is_aout(struct exec *ehdr); -extern int aout_load(struct sys_info *info, const char *filename); +extern int aout_load(struct sys_info *info, ihandle_t dev); extern void aout_init_program(void);
#endif /* _H_AOUTLOAD */
Modified: trunk/openbios-devel/include/libopenbios/sys_info.h ============================================================================== --- trunk/openbios-devel/include/libopenbios/sys_info.h Sun Jun 27 15:14:03 2010 (r800) +++ trunk/openbios-devel/include/libopenbios/sys_info.h Sun Jun 27 16:00:37 2010 (r801) @@ -22,6 +22,8 @@ unsigned long *dict_end; };
+extern struct sys_info sys_info; + void collect_elfboot_info(struct sys_info *info); void collect_linuxbios_info(struct sys_info *info);
Modified: trunk/openbios-devel/libopenbios/aout_load.c ============================================================================== --- trunk/openbios-devel/libopenbios/aout_load.c Sun Jun 27 15:14:03 2010 (r800) +++ trunk/openbios-devel/libopenbios/aout_load.c Sun Jun 27 16:00:37 2010 (r801) @@ -68,7 +68,7 @@ }
int -aout_load(struct sys_info *info, const char *filename) +aout_load(struct sys_info *info, ihandle_t dev) { int retval = -1; struct exec ehdr; @@ -80,7 +80,7 @@ /* Mark the saved-program-state as invalid */ feval("0 state-valid !");
- fd = open_io(filename); + fd = open_ih(dev); if (!fd) goto out;
@@ -113,8 +113,8 @@ if (size < 7680) size = 7680;
- - start = 0x4000; // N_TXTADDR(ehdr); + fword("load-base"); + start = POP(); // N_TXTADDR(ehdr);
if (!check_mem_ranges(info, start, size)) goto out;
Modified: trunk/openbios-devel/libopenbios/load.c ============================================================================== --- trunk/openbios-devel/libopenbios/load.c Sun Jun 27 15:14:03 2010 (r800) +++ trunk/openbios-devel/libopenbios/load.c Sun Jun 27 16:00:37 2010 (r801) @@ -17,15 +17,30 @@ #include "config.h" #include "kernel/kernel.h" #include "libopenbios/bindings.h" +#include "libopenbios/sys_info.h" #include "libopenbios/load.h"
+#ifdef CONFIG_LOADER_AOUT +#include "libopenbios/aout_load.h" +#endif + +#ifdef CONFIG_LOADER_FCODE #include "libopenbios/fcode_load.h" +#endif + +#ifdef CONFIG_LOADER_FORTH #include "libopenbios/forth_load.h" +#endif +
void load(ihandle_t dev) { /* Invoke the loaders on the specified device */
+#ifdef CONFIG_LOADER_AOUT + aout_load(&sys_info, dev); +#endif + #ifdef CONFIG_LOADER_FCODE fcode_load(dev); #endif