summaryrefslogtreecommitdiff
path: root/kernel/usermode.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/usermode.c')
-rw-r--r--kernel/usermode.c36
1 files changed, 3 insertions, 33 deletions
diff --git a/kernel/usermode.c b/kernel/usermode.c
index 3befefd..7153e29 100644
--- a/kernel/usermode.c
+++ b/kernel/usermode.c
@@ -1,53 +1,26 @@
-
#include "usermode.h"
#include "syscalls.h"
#include "kmalloc.h"
-#include "asm/syscall.h"
#include "asm/usermode.h"
#include "kernel.h"
#include <stddef.h>
-//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(uint32_t esp0){
-
- // now fill each value
- // set values necessary
- sys_tss.ss0 = 0x10; //kernel data
- sys_tss.esp0 = esp0;
-
- // now set the IO bitmap (not necessary, so set above limit)
- // sys_tss.iomap = ( unsigned short ) sizeof( tss_struct );
-}
-
-void initfunc()
-{
- while(1)
- {
- c2++;
- }
-}
-
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 via usermode
+ // 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);
- usermode(entry_global);
+ asm_usermode(entry_global);
}
// kernel worker thread: SLEEPER
@@ -62,10 +35,7 @@ void userfunc()
// kernel worker thread: SYSCALL CHECKER
if(task_get_current_pid()==2)
{
- while(1)
- {
- task_syscall_worker();
- }
+ task_syscall_worker();
}
}