summaryrefslogtreecommitdiff
path: root/src/user_bootstrap/main.c
diff options
context:
space:
mode:
authordzwdz2022-07-26 00:38:45 +0200
committerdzwdz2022-07-26 00:38:45 +0200
commit90af8825a41981ce2ee52e0a9ce84f624eb022e6 (patch)
treeaed82a8ca12fdaaa960adac98afecd62a8d81ec8 /src/user_bootstrap/main.c
parent9352abbed0f1266f511f170517a4094c6c4ff917 (diff)
move user_bootstrap to user/bootstrap for consistency's sake
Diffstat (limited to 'src/user_bootstrap/main.c')
-rw-r--r--src/user_bootstrap/main.c36
1 files changed, 0 insertions, 36 deletions
diff --git a/src/user_bootstrap/main.c b/src/user_bootstrap/main.c
deleted file mode 100644
index 5f36aa1..0000000
--- a/src/user_bootstrap/main.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <shared/flags.h>
-#include <shared/mem.h>
-#include <shared/syscalls.h>
-#include <user/lib/elfload.h>
-#include <user/lib/fs/misc.h>
-
-#include "tar.h"
-
-extern char _bss_start;
-extern char _bss_end;
-extern char _initrd;
-
-__attribute__((section(".text.startup")))
-int main(void) {
- _syscall_memflag(&_bss_start, &_bss_end - &_bss_start, MEMFLAG_PRESENT);
-
- /* move everything provided by the kernel to /kdev */
- MOUNT("/kdev/", fs_passthru(NULL));
- if (!fork2_n_mount("/")) {
- const char *l[] = {"/kdev/", NULL};
- fs_whitelist(l);
- }
- if (!fork2_n_mount("/")) fs_dir_inject("/kdev/"); // TODO should be part of fs_whitelist
-
- MOUNT("/init/", tar_driver(&_initrd));
-
- void *init = tar_find("init.elf", 8, &_initrd, ~0) + 512;
- if (init) {
- _klogf("execing init.elf");
- elf_exec(init);
- _klogf("elf_exec failed");
- } else {
- _klogf("couldn't find init.elf");
- }
- _syscall_exit(1);
-}