#ifndef SCHEDULER_H
#define SCHEDULER_H

#include "mem.h"


#define MAX_PROC 10

// If you change the following struct
// please consider updating the code in scheduler_asm.S
typedef struct REGISTERS {
    u32 eax, ebx, ecx, edx;
    u32 cs, eip;
    u32 ss, esp, ebp;
    u32 esi, edi;
    u32 ds, es, fs, gs;
    u32 eflags;
} __attribute__((packed)) REGISTERS;

// If you change the following struct
// please consider updating the code in scheduler_asm.S
typedef struct PROC {
    u16 id;
    u16 pid;
    u32* page_dir;
    REGISTERS regs;
} __attribute__((packed)) PROC;

extern char show_tics;
extern char scheduler_on;
extern PROC procs[MAX_PROC];
extern u16 current_id;
extern u16 nproc;

void clock();
void schedule();
void task_create(int *page_dir, void *task, int task_size);
void scheduler_start();
#endif