From c15925a24efe14f437d8a2699500241a58fdc8f9 Mon Sep 17 00:00:00 2001 From: Miguel Date: Fri, 17 Aug 2018 21:41:21 +0200 Subject: cleanup and working on fifo pipes --- kernel/usermode.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'kernel/usermode.c') diff --git a/kernel/usermode.c b/kernel/usermode.c index db4ac9f..2455ba6 100644 --- a/kernel/usermode.c +++ b/kernel/usermode.c @@ -4,6 +4,10 @@ #include "syscalls.h" #include "kmalloc.h" +#include "asm/syscall.h" +#include "asm/usermode.h" +#include "kernel/config.h" + #include "lib/logger/log.h" #include @@ -22,17 +26,15 @@ void install_tss(int cpu_no){ // sys_tss.iomap = ( unsigned short ) sizeof( tss_struct ); } -void switch_to_user_mode() +// THIS IS THE FUNCTION TO BE RUN IN RING 3 // USER MODE +static void userfunc() { - asm_usermode(); + syscall(SYSCALL_EXECVE,BIN_INIT,NULL,NULL); + while(1); // we should never get here. } -char *argv_init[]={"/bin/init",NULL}; -char *env_init[]={"var1=dupa","var2=mundl",NULL}; - -// THIS WILL BE RUN IN RING 3! -void userfunc() +void switch_to_user_mode() { - syscall(SYSCALL_EXECVE,"/bin/init",argv_init,env_init); - while(1); // we should never get here. + usermode(&userfunc); } + -- cgit v1.2.3