diff options
Diffstat (limited to 'boot/limine/limine.c')
-rw-r--r-- | boot/limine/limine.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/boot/limine/limine.c b/boot/limine/limine.c new file mode 100644 index 0000000..6a1bb43 --- /dev/null +++ b/boot/limine/limine.c @@ -0,0 +1,38 @@ +#include "limine.h" +#include "boot.h" +#include "string.h" + +char s_kernel_stack_initial[8192]; + +char *jove_bootargs; +int jove_bootargs_len; + +struct limine_kernel_file_request s_kernel_file_req = { + .id = LIMINE_KERNEL_FILE_REQUEST +}; + +void +_start(void) +{ + __asm__ volatile("movq %0, %%rsp":: "r"((uintptr_t)&s_kernel_stack_initial + 8191)); + + struct limine_kernel_file_response *kernel_file_response = s_kernel_file_req.response; + jove_bootargs = kernel_file_response->kernel_file->cmdline; + jove_bootargs_len = strlen(jove_bootargs); + + //Zero all spaces in bootargs not enclosed with quotes. + for(char *c = jove_bootargs; *c; c++) { + if(*c == '"') { + *c = 0; + for(++c; *c && *c != '"'; c++); + *(c++) = 0; + continue; + } + if(*c == ' ') *c = 0; + } + + extern void _jove_main(void); + + __asm__ volatile("movq $0, %%rbp"::); + _jove_main(); +} |