From c9909b34db4d87f8373333ef452db4419b4a65ce Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sun, 8 Apr 2018 05:13:15 -0600 Subject: [PATCH] Use argc/argv in Stage 2 --- fusee/fusee-secondary/src/loader.c | 3 ++- fusee/fusee-secondary/src/loader.h | 2 +- fusee/fusee-secondary/src/main.c | 16 ++++++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/fusee/fusee-secondary/src/loader.c b/fusee/fusee-secondary/src/loader.c index 5b57d5156..12fd7d623 100644 --- a/fusee/fusee-secondary/src/loader.c +++ b/fusee/fusee-secondary/src/loader.c @@ -1,7 +1,8 @@ #include "utils.h" #include "loader.h" -entrypoint_t load_payload(void) { +entrypoint_t load_payload(const char *bct0) { /* TODO */ + (void)(bct0); return (entrypoint_t)NULL; } \ No newline at end of file diff --git a/fusee/fusee-secondary/src/loader.h b/fusee/fusee-secondary/src/loader.h index 5b5d445b5..d602f54bf 100644 --- a/fusee/fusee-secondary/src/loader.h +++ b/fusee/fusee-secondary/src/loader.h @@ -3,6 +3,6 @@ typedef void (*entrypoint_t)(int argc, void **argv); -entrypoint_t load_payload(void); +entrypoint_t load_payload(const char *bct0); #endif \ No newline at end of file diff --git a/fusee/fusee-secondary/src/main.c b/fusee/fusee-secondary/src/main.c index 8b6d18916..384edde7e 100644 --- a/fusee/fusee-secondary/src/main.c +++ b/fusee/fusee-secondary/src/main.c @@ -1,8 +1,10 @@ #include "utils.h" #include "hwinit.h" #include "loader.h" - #include "stage2.h" +#include "lib/printk.h" +#include "display/video_fb.h" + /* Allow for main(int argc, void **argv) signature. */ #pragma GCC diagnostic ignored "-Wmain" @@ -10,10 +12,20 @@ int main(int argc, void **argv) { entrypoint_t entrypoint; + if (argc != STAGE2_ARGC || *((u32 *)argv[STAGE2_ARGV_VERSION]) != 0) { + generic_panic(); + } + /* TODO: What other hardware init should we do here? */ + /* Setup LFB. */ + /* TODO: How can we keep the console line/offset to resume printing? */ + video_init((u32 *)argv[STAGE2_ARGV_LFB]); + + printk("Welcome to Atmosph\xe8re Fus\xe9" "e Stage 2!\n"); + /* This will load all remaining binaries off of the SD. */ - entrypoint = load_payload(); + entrypoint = load_payload((const char *)argv[STAGE2_ARGV_CONFIG]); /* TODO: What do we want to do in terms of argc/argv? */ entrypoint(0, NULL);