aboutsummaryrefslogtreecommitdiff
path: root/sys/include
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-02-23 17:38:36 -0500
committerIan Moffett <ian@osmora.org>2024-02-23 17:38:36 -0500
commit839034c1309bc331e4a44c8e0153f013a93ba5b5 (patch)
tree1fff6d3b251bcf7cdf1c87ecd68dfb87a1e1e136 /sys/include
parent4c00208b3a50be0bc6dd240e59d6d891ef18d8b3 (diff)
kernel: Add initial scheduler implementation
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/include')
-rw-r--r--sys/include/sys/proc.h2
-rw-r--r--sys/include/sys/sched.h4
-rw-r--r--sys/include/sys/sched_state.h6
3 files changed, 8 insertions, 4 deletions
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 <sys/types.h>
#include <sys/queue.h>
#include <machine/cpu.h>
+#include <machine/frame.h>
/*
* 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 <sys/types.h>
#include <sys/spinlock.h>
#include <machine/cpu.h>
+#include <machine/frame.h>
+
+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 <sys/types.h>
-#include <sys/queue.h>
+#include <sys/proc.h>
/*
* 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_ */