tasking: add loading of a process' page directory before switching
This commit is contained in:
+10
-5
@@ -44,6 +44,8 @@ Process* task_create(EntryPoint func, void** args, uint32_t arg_count)
|
||||
*(--p->stackPointer) = 0;//esi
|
||||
*(--p->stackPointer) = 0;//ebx
|
||||
|
||||
p->page_directory = kernel_page_directory;
|
||||
|
||||
p->next = 0;
|
||||
|
||||
if(!queue)
|
||||
@@ -84,7 +86,10 @@ void schedule()
|
||||
if(!next)
|
||||
next = queue;
|
||||
if(next != current)
|
||||
{
|
||||
loadPageDirectory(next->page_directory);
|
||||
switchProcess(next);
|
||||
}
|
||||
}
|
||||
|
||||
void idle()
|
||||
@@ -111,15 +116,15 @@ void jump_usermode2(void);
|
||||
|
||||
void scheduler_init()
|
||||
{
|
||||
jump_usermode2();
|
||||
//jump_usermode2();
|
||||
//we create this task two times because in other case it just won't start
|
||||
//task_create((EntryPoint)&idle, NULL, 0);
|
||||
//task_create((EntryPoint)&idle, NULL, 0);
|
||||
task_create((EntryPoint)&idle, NULL, 0);
|
||||
task_create((EntryPoint)&idle, NULL, 0);
|
||||
|
||||
void* args1[] = {(void*)42, (void*)"ebalo"};
|
||||
//task_create((EntryPoint)&task1, args1, 2);
|
||||
task_create((EntryPoint)&task1, args1, 2);
|
||||
void* args2[] = {(void*)69, (void*)420};
|
||||
//task_create((EntryPoint)&task2, args2, 2);
|
||||
task_create((EntryPoint)&task2, args2, 2);
|
||||
}
|
||||
|
||||
extern void test_user_function(void);
|
||||
|
||||
Reference in New Issue
Block a user