summaryrefslogtreecommitdiff
path: root/kernel/usermode.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/usermode.c')
-rw-r--r--kernel/usermode.c20
1 files changed, 11 insertions, 9 deletions
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 <stddef.h>
@@ -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);
}
+