#include "usermode.h" #include "syscalls.h" #include "kmalloc.h" #include "asm/usermode.h" #include "asm/x86.h" #include "scheduler.h" #include "kernel.h" #include "fs/elf.h" #include void userfunc() { // we need enable here again (since the pushed eflags have it disabled)! x86_sti(); // if we are pid 0, replace ourselves with /bin/init and enter usermode if(task_get_current_pid()==0) { uint32_t alloc; uint32_t entry_global=load_elf(BIN_INIT,&alloc); task_set_brk(alloc); asm_usermode(entry_global); } // kernel worker thread: SLEEPER if(task_get_current_pid()==1) { while(1) { __asm__("hlt"); } } // kernel worker thread: SYSCALL CHECKER if(task_get_current_pid()==2) { task_syscall_worker(); } }