From 839034c1309bc331e4a44c8e0153f013a93ba5b5 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 23 Feb 2024 17:38:36 -0500 Subject: kernel: Add initial scheduler implementation Signed-off-by: Ian Moffett --- sys/include/sys/proc.h | 2 ++ sys/include/sys/sched.h | 4 ++++ sys/include/sys/sched_state.h | 6 ++---- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'sys/include') diff --git a/sys/include/sys/proc.h b/sys/include/sys/proc.h index 5106bf3..f45e4c6 100644 --- a/sys/include/sys/proc.h +++ b/sys/include/sys/proc.h @@ -33,6 +33,7 @@ #include #include #include +#include /* * A task running on the CPU e.g., a process or @@ -41,6 +42,7 @@ struct proc { pid_t pid; struct cpu_info *cpu; + struct trapframe *tf; TAILQ_ENTRY(proc) link; }; diff --git a/sys/include/sys/sched.h b/sys/include/sys/sched.h index 4fdf065..d803df0 100644 --- a/sys/include/sys/sched.h +++ b/sys/include/sys/sched.h @@ -35,6 +35,10 @@ #include #include #include +#include + +void sched_init(void); +void sched_context_switch(struct trapframe *tf); __noreturn void sched_init_processor(struct cpu_info *ci); diff --git a/sys/include/sys/sched_state.h b/sys/include/sys/sched_state.h index 03a55dd..52d6c56 100644 --- a/sys/include/sys/sched_state.h +++ b/sys/include/sys/sched_state.h @@ -30,15 +30,13 @@ #ifndef _SYS_SCHED_STATE_H_ #define _SYS_SCHED_STATE_H_ -#include -#include +#include /* * Scheduler state, per CPU. */ struct sched_state { - TAILQ_HEAD(, proc) queue; - size_t queue_nrun; /* Number of processes in the run queue */ + struct proc *td; /* Current_thread */ }; #endif /* !_SYS_SCHED_STATE_H_ */ -- cgit v1.2.3