From ace65b453151845bc361f21f3e5b651c35f9f126 Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Wed, 22 May 2024 13:00:41 -0400 Subject: massive refactor for mp and organization --- task/init.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 task/init.c (limited to 'task/init.c') diff --git a/task/init.c b/task/init.c new file mode 100644 index 0000000..c4c8bad --- /dev/null +++ b/task/init.c @@ -0,0 +1,22 @@ +#include "commandline.h" +#include "jove.h" +#include "initrd.h" +#include "tasking.h" +#include "arch/elf.h" + +__attribute__((noreturn)) void +kinit(void) +{ + const char *init_filepath = cmdline_get("init"); + if(init_filepath == NULL) + kpanic("init filepath not found in kernel commandline\n"); + + initrd_file_t *init_file = ird_getfile(init_filepath); + if(init_file == NULL) + kpanic("init file not found in initrd [filepath=\"%s\"]\n", init_filepath); + + uintptr_t ip = elf_load(init_file->data, init_file->size); + + kexec((void*)ip, 0, NULL, 0, NULL); + kpanic("Reached end of kinit\n"); +} -- cgit v1.2.1