blob: 00741feb336b99a901965801b2c84892b90b187e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include "scheduler.hpp"
TASK tasks[MAX_TASK];
u32 ntasks=0;
char show_ticks=0;
extern "C" void clock(){
if(show_ticks)
print(".");
}
void schedule(){
}
void create_task(void* task, u32 size){
if(ntasks>=MAX_TASK){
printk("Could not create more tasks.");
return;
}
TASK *t=&tasks[ntasks];
t->id=ntasks;
t->pid=ntasks;
t->size=size;
t->pml4=paging_create_task(size/4096+1);
// Load task using
lpml4(t->pml4);
memcpy(task, TASK_VMA, size);
lpml4(kpml4);
ntasks++;
}
void scheduler_start(){
TASK *t=&tasks[0];
lpml4(t->pml4);
asm("jmp switch");
}
|