diff options
Diffstat (limited to 'kernel/usermode.c')
| -rw-r--r-- | kernel/usermode.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/kernel/usermode.c b/kernel/usermode.c index 81dc5c1..bb614d0 100644 --- a/kernel/usermode.c +++ b/kernel/usermode.c @@ -15,6 +15,9 @@ //https://wiki.osdev.org/Task_State_Segment tss_struct sys_tss; //Define the TSS as a global structure +static volatile uint32_t c1; +static volatile uint32_t c2; + void install_tss(int cpu_no){ // now fill each value @@ -28,20 +31,28 @@ void install_tss(int cpu_no){ 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 TODO: switch to usermode before! - if(task_get_current_pid()==0)syscall(SYSCALL_EXECVE,BIN_INIT,NULL,NULL); + if(task_get_current_pid()==0) + { + //usermode(&initfunc); + while(1) + { + c2++; + } + } - // kernel worker thread + // kernel worker thread on pid1 if(task_get_current_pid()==1) { + while(1) + { + c1++; + } } } -void switch_to_user_mode() -{ - usermode(&userfunc); -} |
