summaryrefslogtreecommitdiff
path: root/kernel/usermode.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/usermode.c')
-rw-r--r--kernel/usermode.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/kernel/usermode.c b/kernel/usermode.c
index 76558d8..81dc5c1 100644
--- a/kernel/usermode.c
+++ b/kernel/usermode.c
@@ -26,11 +26,18 @@ void install_tss(int cpu_no){
// sys_tss.iomap = ( unsigned short ) sizeof( tss_struct );
}
-// THIS IS THE FUNCTION TO BE RUN IN RING 3 // USER MODE
-static void userfunc()
+void userfunc()
{
- syscall(SYSCALL_EXECVE,BIN_INIT,NULL,NULL);
- while(1); // we should never get here.
+ // we need enable here again (since the pushed eflags have it disabled)!
+ x86_sti();
+
+ // if we are pid 0, replace ourselves with /bin/init TODO: switch to usermode before!
+ if(task_get_current_pid()==0)syscall(SYSCALL_EXECVE,BIN_INIT,NULL,NULL);
+
+ // kernel worker thread
+ if(task_get_current_pid()==1)
+ {
+ }
}
void switch_to_user_mode()