diff options
Diffstat (limited to 'src/boot')
-rw-r--r-- | src/boot/hardwaremain.c | 17 | ||||
-rw-r--r-- | src/boot/selfboot.c | 10 |
2 files changed, 17 insertions, 10 deletions
diff --git a/src/boot/hardwaremain.c b/src/boot/hardwaremain.c index d78b859b62..bb7f264c08 100644 --- a/src/boot/hardwaremain.c +++ b/src/boot/hardwaremain.c @@ -35,6 +35,7 @@ it with the version available from LANL. #include <boot/tables.h> #include <boot/elf.h> #include <cbfs.h> +#include <lib.h> #if CONFIG_HAVE_ACPI_RESUME #include <arch/acpi.h> #endif @@ -143,7 +144,19 @@ void hardwaremain(int boot_complete) lb_mem = write_tables(); timestamp_add_now(TS_LOAD_PAYLOAD); - cbfs_load_payload(lb_mem, CONFIG_CBFS_PREFIX "/payload"); - printk(BIOS_ERR, "Boot failed.\n"); + + void *payload; + payload = cbfs_load_payload(lb_mem, CONFIG_CBFS_PREFIX "/payload"); + if (! payload) + die("Could not find a payload\n"); + + printk(BIOS_DEBUG, "Got a payload\n"); + /* Before we go off to run the payload, see if + * we stayed within our bounds. + */ + checkstack(&_estack, 0); + + selfboot(lb_mem, payload); + printk(BIOS_EMERG, "Boot failed"); } diff --git a/src/boot/selfboot.c b/src/boot/selfboot.c index 3c310234cb..fd5b382764 100644 --- a/src/boot/selfboot.c +++ b/src/boot/selfboot.c @@ -494,7 +494,7 @@ static int load_self_segments( return 1; } -static int selfboot(struct lb_memory *mem, struct cbfs_payload *payload) +int selfboot(struct lb_memory *mem, struct cbfs_payload *payload) { u32 entry=0; struct segment head; @@ -532,13 +532,7 @@ void *cbfs_load_payload(struct lb_memory *lb_mem, const char *name) struct cbfs_payload *payload; payload = (struct cbfs_payload *)cbfs_find_file(name, CBFS_TYPE_PAYLOAD); - if (payload == NULL) - return (void *) -1; - printk(BIOS_DEBUG, "Got a payload\n"); - selfboot(lb_mem, payload); - printk(BIOS_EMERG, "SELFBOOT RETURNED!\n"); - - return (void *) -1; + return payload; } |