diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2021-04-16 18:26:11 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2021-04-16 18:26:11 +0200 |
| commit | 93c2975ea8096a391a242299e119c31844b8fcbf (patch) | |
| tree | 23f8a0c48bbccb4183e8ed7d42bdce8753a42851 /src/core/scheduler.h | |
| parent | 2549b2503b67b2931850980ad6c89a792bd98676 (diff) | |
Cleaning scheduler code
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 |
