1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-09-19 21:43:29 +01:00

Use argc/argv in Stage 2

This commit is contained in:
Michael Scire 2018-04-08 05:13:15 -06:00
parent 39bf3cb800
commit c9909b34db
3 changed files with 17 additions and 4 deletions

View file

@ -1,7 +1,8 @@
#include "utils.h" #include "utils.h"
#include "loader.h" #include "loader.h"
entrypoint_t load_payload(void) { entrypoint_t load_payload(const char *bct0) {
/* TODO */ /* TODO */
(void)(bct0);
return (entrypoint_t)NULL; return (entrypoint_t)NULL;
} }

View file

@ -3,6 +3,6 @@
typedef void (*entrypoint_t)(int argc, void **argv); typedef void (*entrypoint_t)(int argc, void **argv);
entrypoint_t load_payload(void); entrypoint_t load_payload(const char *bct0);
#endif #endif

View file

@ -1,8 +1,10 @@
#include "utils.h" #include "utils.h"
#include "hwinit.h" #include "hwinit.h"
#include "loader.h" #include "loader.h"
#include "stage2.h" #include "stage2.h"
#include "lib/printk.h"
#include "display/video_fb.h"
/* Allow for main(int argc, void **argv) signature. */ /* Allow for main(int argc, void **argv) signature. */
#pragma GCC diagnostic ignored "-Wmain" #pragma GCC diagnostic ignored "-Wmain"
@ -10,10 +12,20 @@
int main(int argc, void **argv) { int main(int argc, void **argv) {
entrypoint_t entrypoint; entrypoint_t entrypoint;
if (argc != STAGE2_ARGC || *((u32 *)argv[STAGE2_ARGV_VERSION]) != 0) {
generic_panic();
}
/* TODO: What other hardware init should we do here? */ /* 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. */ /* 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? */ /* TODO: What do we want to do in terms of argc/argv? */
entrypoint(0, NULL); entrypoint(0, NULL);