diff options
author | Jon Santmyer <jon@jonsantmyer.com> | 2024-05-22 13:00:41 -0400 |
---|---|---|
committer | Jon Santmyer <jon@jonsantmyer.com> | 2024-05-22 13:00:41 -0400 |
commit | ace65b453151845bc361f21f3e5b651c35f9f126 (patch) | |
tree | 262ebd29b0ca1d8584f0b6f1efa7a00d9f4f3e43 /usr/umode.c | |
parent | f004c1ade8d617a82cea2fe249434cccb47a2358 (diff) | |
download | jove-kernel-master.tar.gz jove-kernel-master.tar.bz2 jove-kernel-master.zip |
Diffstat (limited to 'usr/umode.c')
-rw-r--r-- | usr/umode.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/usr/umode.c b/usr/umode.c deleted file mode 100644 index 1105d9e..0000000 --- a/usr/umode.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "umode.h" -#include "elf.h" -#include "boot/cmdline.h" -#include "lib/jove.h" -#include "ird/initrd.h" -#include "mem/memory.h" - -void -umode_setup(void) -{ - extern void syscall_setup_syscall(void); - syscall_setup_syscall(); - - const char *init_path = cmdline_get("init"); - if(init_path == NULL) - kpanic("Missing path to init ELF file / binary\n"); - - struct InitrdFile *init_file = ird_getfile(init_path); - if(init_file == NULL) - kpanic("Missing init file %s in initrd\n", init_path); - - void (*entry_point)(void) = elf_load(init_file->data, init_file->size); - if(entry_point == NULL) - kpanic("Init file %s is incorrectly formatted (want ELF64)\n", init_path); - - void *user_stack = (void*)(0x00007FFFFFFFFFFF); - mem_ensure_range( - (uintptr_t)user_stack & ~0xFFF, - (uintptr_t)user_stack, - (page_flags_t) { - .present = true, - .writeable = true, - .useraccess = true, - .executable = false - }); - - klogf("User entry point %#016X\n", entry_point); - umode_enter(entry_point, user_stack); -} |