Add a kernel ELF module and load it in a new process.

Don't yet jump to userspace.
This commit is contained in:
Drew Galbraith 2023-05-29 00:32:54 -07:00
parent f86bbe6ea9
commit aefb4f082b
22 changed files with 223 additions and 16 deletions

10
zion/usr/crt0.s Normal file
View file

@ -0,0 +1,10 @@
.text
.global _start
_start:
call main
call _exit
_exit:
mov $1, %rdi
syscall

13
zion/usr/zcall.cpp Normal file
View file

@ -0,0 +1,13 @@
#include "include/zcall.h"
#include <stdint.h>
uint64_t SysCall1(uint64_t number, const void* first) {
uint64_t return_code;
asm("syscall" : "=a"(return_code) : "D"(number), "S"(first) : "rcx", "r11");
return return_code;
}
uint64_t ZDebug(const char* message) {
return SysCall1(Z_DEBUG_PRINT, message);
}