#ifndef TASK_H #define TASK_H #include <list.h> #include <message.h> #include <stdbool.h> #include <stdint.h> extern void initTasking(); typedef struct __attribute__((packed)) { uint32_t eax, ebx, ecx, edx, esi, edi, esp, ebp, eip, eflags, cr3; } Registers; typedef struct Task { Registers registers; void *stack; ListElement *messages; uint32_t ticksLeft; uint32_t timerTicks; } Task; extern Task *currentTask; extern void initTasking(); extern void createTask(Task *task, uint32_t mainFunction, uint32_t flags, uint32_t *pagedir); extern void yield(); extern void yields(); extern void switchTask(Registers *old, Registers *new); extern void schedule(Task *task); extern void destroyCurrentTask(); extern void setRunningTask(Task *task); extern void sendMessage(Task *task, Message *message); extern Message *popMessage(Task *task); extern bool isTaskQueueEmpty(); extern ListElement *getAllTasks(); #endif