// http://hosted.cjmovie.net/TutMultitask.htm // // #include "kernel.h" #include "lib/logger/log.h" // logger facilities #include "lib/buffer/ringbuffer.h" #include "mem.h" #include "timer.h" #include "console.h" #include "x86.h" #include "syscalls.h" #include "fs/fs.h" #include "fs/ext2.h" #define FOOLOS_MODULE_NAME "task" #define MAX_TASKS 10 static volatile int current_task=-2; static volatile struct task_list_struct { int parent; bool active; uint32_t esp; // stack pointer of the task; uint32_t vmem; // number of virtual memory table to switch to }volatile task_list[MAX_TASKS]; int add_task(uint32_t esp, uint32_t vmem) { for(int i=0;i