Author: mcayland Date: Fri Apr 2 15:29:12 2010 New Revision: 727 URL: http://tracker.coreboot.org/trac/openbios/changeset/727
Log: Since the original boot code had been previously refactored to make use of saved-program-state, we can take the existing code and with only slight modification use it as a C implementation of the go word.
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
Modified: trunk/openbios-devel/arch/sparc32/boot.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/boot.c Fri Apr 2 15:01:10 2010 (r726) +++ trunk/openbios-devel/arch/sparc32/boot.c Fri Apr 2 15:29:12 2010 (r727) @@ -22,13 +22,14 @@ uint32_t qemu_cmdline; uint32_t cmdline_size; char boot_device; +static const void *romvec; static int (*entry)(const void *romvec_ptr, int p2, int p3, int p4, int p5);
-static int try_path(const char *path, char *param, const void *romvec) + +static int try_path(const char *path, char *param) { void *boot_notes = NULL; - ucell valid, address, type, size; - int image_retval = 0; + ucell valid;
push_str(path); fword("pathres-resolve-aliases"); @@ -78,6 +79,16 @@
start_image: + go(); + return -1; +} + + +void go(void) +{ + ucell address, type, size; + int image_retval = 0; + /* Get the entry point and the type (see forth/debugging/client.fs) */ feval("saved-program-state >sps.entry @"); address = POP(); @@ -122,8 +133,6 @@ }
printk("Image returned with return value %#x\n", image_retval); - - return -1; }
@@ -132,7 +141,6 @@ char *path = pop_fstr_copy(), *param, altpath[256]; const char *oldpath = path; int unit = 0; - const void *romvec; int result;
if(!path) { @@ -209,7 +217,7 @@ else printk("without parameters.\n");
- result = try_path(path, param, romvec); + result = try_path(path, param); if (!result) { push_str(path); PUSH(':'); @@ -218,7 +226,7 @@ POP(); POP(); - try_path(altpath, param, romvec); + try_path(altpath, param); }
printk("Unsupported image format\n");
Modified: trunk/openbios-devel/arch/sparc32/boot.h ============================================================================== --- trunk/openbios-devel/arch/sparc32/boot.h Fri Apr 2 15:01:10 2010 (r726) +++ trunk/openbios-devel/arch/sparc32/boot.h Fri Apr 2 15:29:12 2010 (r727) @@ -19,7 +19,8 @@ // boot.c extern struct sys_info sys_info; extern const char *bootpath; -void boot(void); +extern void boot(void); +extern void go(void);
// sys_info.c extern unsigned int qemu_mem_size;
Modified: trunk/openbios-devel/arch/sparc64/boot.c ============================================================================== --- trunk/openbios-devel/arch/sparc64/boot.c Fri Apr 2 15:01:10 2010 (r726) +++ trunk/openbios-devel/arch/sparc64/boot.c Fri Apr 2 15:29:12 2010 (r727) @@ -26,8 +26,7 @@ static int try_path(const char *path, char *param) { void *boot_notes = NULL; - ucell valid, address, type, size; - int image_retval = 0; + ucell valid;
#ifdef CONFIG_LOADER_ELF /* ELF Boot loader */ @@ -72,6 +71,16 @@
start_image: + go(); + return -1; +} + + +void go(void) +{ + ucell address, type, size; + int image_retval = 0; + /* Get the entry point and the type (see forth/debugging/client.fs) */ feval("saved-program-state >sps.entry @"); address = POP(); @@ -85,7 +94,7 @@ switch (type) { case 0x0: /* Start ELF boot image */ - image_retval = start_elf(address, (uint64_t)boot_notes); + image_retval = start_elf(address, (uint64_t)NULL); break;
case 0x5: @@ -112,10 +121,9 @@ }
printk("Image returned with return value %#x\n", image_retval); - - return -1; }
+ void boot(void) { char *path=pop_fstr_copy(), *param;
Modified: trunk/openbios-devel/arch/sparc64/boot.h ============================================================================== --- trunk/openbios-devel/arch/sparc64/boot.h Fri Apr 2 15:01:10 2010 (r726) +++ trunk/openbios-devel/arch/sparc64/boot.h Fri Apr 2 15:29:12 2010 (r727) @@ -21,7 +21,8 @@ extern uint64_t qemu_cmdline; extern uint64_t cmdline_size; extern char boot_device; -void boot(void); +extern void boot(void); +extern void go(void);
// sys_info.c extern uint64_t qemu_mem_size;
Modified: trunk/openbios-devel/arch/x86/boot.c ============================================================================== --- trunk/openbios-devel/arch/x86/boot.c Fri Apr 2 15:01:10 2010 (r726) +++ trunk/openbios-devel/arch/x86/boot.c Fri Apr 2 15:29:12 2010 (r727) @@ -23,8 +23,7 @@ static int try_path(const char *path, char *param) { void *boot_notes = NULL; - ucell valid, address, type, size; - int image_retval = 0;; + ucell valid;
#ifdef CONFIG_LOADER_ELF /* ELF Boot loader */ @@ -69,6 +68,16 @@
start_image: + go(); + return -1; +} + + +void go(void) +{ + ucell address, type, size; + int image_retval = 0; + /* Get the entry point and the type (see forth/debugging/client.fs) */ feval("saved-program-state >sps.entry @"); address = POP(); @@ -109,10 +118,9 @@ }
printk("Image returned with return value %#x\n", image_retval); - - return -1; }
+ void boot(void) { char *path=pop_fstr_copy(), *param;
Modified: trunk/openbios-devel/arch/x86/boot.h ============================================================================== --- trunk/openbios-devel/arch/x86/boot.h Fri Apr 2 15:01:10 2010 (r726) +++ trunk/openbios-devel/arch/x86/boot.h Fri Apr 2 15:29:12 2010 (r727) @@ -15,4 +15,5 @@
/* boot.c */ extern struct sys_info sys_info; -void boot(void); +extern void boot(void); +extern void go(void);