Initial commit
This commit is contained in:
commit
ef80f65fbf
136 changed files with 13728 additions and 0 deletions
33
include/scheduler/sched.h
Normal file
33
include/scheduler/sched.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef enum proc_state {
|
||||
ZOMBIE = 4,
|
||||
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;
|
||||
char name[8];
|
||||
};
|
||||
|
||||
void scheduler_init();
|
||||
[[noreturn]] void sched();
|
||||
void yield();
|
||||
|
||||
#define PROC_MAX 1024 // Max number of processes per cpu
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue