From 59038fc67c20a1f04e5d2fd5f9a444e707d1d3ea Mon Sep 17 00:00:00 2001 From: Miguel Date: Wed, 22 Aug 2018 00:52:30 +0200 Subject: userspace and kernelspace taskswitching --- kernel/scheduler.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) (limited to 'kernel/scheduler.c') diff --git a/kernel/scheduler.c b/kernel/scheduler.c index 4823276..d6e2c76 100644 --- a/kernel/scheduler.c +++ b/kernel/scheduler.c @@ -13,8 +13,6 @@ #include "fs/fs.h" #include "fs/ext2.h" -#define MAX_TASKS 10 - static volatile int volatile current_task=-1; static volatile struct task_list_struct @@ -36,7 +34,6 @@ volatile int add_task(uint32_t esp, uint32_t vmem) { if(task_list[i].active!=true) { - task_list[i].parent=current_task; task_list[i].vmem=vmem; task_list[i].esp=esp; @@ -174,30 +171,12 @@ volatile void scheduler_init(pdirectory *dir) task_list[1].vmem=dir; task_list[1].esp = kballoc(4); // fresh 16kb stack from here. - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"fresh esp on: 0x%08X",1,task_list[1].esp); - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"fresh esp on: 0x%08X",0,task_list[0].esp); + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"fresh esp on: 0x%08X",task_list[1].esp+4*4096-1); + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"fresh esp on: 0x%08X",task_list[0].esp+4*4096-1); task_pusha(task_list[1].esp); // pusha but to alternative location task_pusha(task_list[0].esp); // pusha but to alternative location - /* - current_task=0; - unsigned esp, ebp, eax, ebx, ecx, edx; - - asm( - "movl %%esp, %0;" - "movl %%ebp, %1;" - "movl %%eax, %2;" - "movl %%ebx, %3;" - "movl %%ecx, %4;" - "movl %%edx, %5;" - :"=r"(esp), "=r"(ebp), "=r"(eax), "=r"(ebx), "=r"(ecx), "=r"(edx) - ); - - // TODO: prepare stack so popa get's what it wants! - int i=task_fork(esp); - */ - // finally enable interrrupts so the scheduler is called (by timer) x86_sti(); -- cgit v1.2.3