diff options
Diffstat (limited to 'src/core/scheduler.h')
| -rw-r--r-- | src/core/scheduler.h | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/core/scheduler.h b/src/core/scheduler.h index fbcf6bd..ecb9428 100644 --- a/src/core/scheduler.h +++ b/src/core/scheduler.h @@ -3,7 +3,6 @@ #include "mem.h" - #define MAX_PROC 10 // If you change the following struct @@ -29,11 +28,27 @@ typedef struct PROC { extern char show_tics; extern char scheduler_on; extern PROC procs[MAX_PROC]; -extern u16 current_id; -extern u16 nproc; +extern u16 current_id; // Current running task PID/id +extern u16 nproc; // Number of active tasks +/** + * Must be called at each clock interrupt + */ void clock(); -void schedule(); -void task_create(int *page_dir, void *task, int task_size); +/** + * Called by clock() and schedule the next task + * Stack is a pointer pointing to the gs register on the stack. + * The stack must contains the interrupted process registers in the following + * order: gs,fs,es,ds,edi,esi,ebp,UNUSED,edx,ecx,ebx,eax,eip,cs,eflags,esp,ss + */ +void schedule(u32 *stack); +/** + * Create a new task to be schedule + */ +void task_create(int *page_dir, void *task, int task_size, int stack_offset); +/** + * Stack the scheduler starting by task with PID 0 + */ void scheduler_start(); + #endif
\ No newline at end of file |
