simple unix clone in ~9000 lines (goal is about 15kloc), with distant aim of multi arch
for x86 (primary target)
i literally just need
- the
execvsyscall - vfs fat wrapping (create nodes on mount, destroy on unmount)
- (and maybe rewrite the elf loader slightly)
I'm like ~400 lines away! (famous last words)
and it will (hopefully) just work! (still insecure ring0, but)
(i have cpu-hal, pci, rtc, pit, ide, sys_noop, sys_exit, sys_fork (shallow copy), sys_read, sys_write, sys_open, sys_close, framebuffer, idt, gdt, pde (kinda), multi tasking, panic (duh), basic mm allocators, vfs, ramfs, custom fs (kinda, not done))
update will be within days or sum like that
there isn't much to show... because the graphics aren't used yet (just backend stuff has been worked on, and its not that much)
// current core/kmain.c
#include <libk.h>
#include <cpu/cpu.h>
#include <drivers/kprint.h>
#include <sched/core.h>
// not the first function actually,
// init is ran first (architecture specific)
// e.g. here its `src/arch/x86/init.c`
// lol using syscalls from the kernel (just a test)
// no paging tho
// like 9000 lines have to work if this works, and it does :fire:
void kmain(void)
{
cpu_ei();
// fd is dynamic array, this is fd0 (stdin, hmm)
int fd = open("/dev/serial", 0); // just works! no flags or mode yet tho
if (fd < 0)
panic(PANIC_TODO);
write(fd, "Hello, World!\r\n", 15);
close(fd);
while(1)
cpu_pause();
}
(its prints first 512 bytes of ide0 because i was debugging.. and forgot to remove oops)
