neobbo/include/scheduler/sched.h

33 lines
543 B
C

#include <stdint.h>
#pragma once
typedef enum proc_state {
RUNNING = 3,
READY = 2,
SLEEPING = 1,
UNUSED = 0
}proc_state;
struct context {
uint64_t r15, r14, r13, r12, rbp, rbx, rip;
};
struct thread {
struct thread *next;
struct thread *prev;
uint64_t *mem;
uint64_t *kstack;
proc_state state;
uint16_t pid;
struct context *context;
};
void scheduler_init();
[[noreturn]] void sched();
void yield();
#define PROC_MAX 512 // Max number of processes
#define INITIAL_STACK_SIZE 0x10000