From 192208770d3866838a450462dd4b1fc8e2b5c91a Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Sun, 24 Nov 2024 22:07:51 +0100 Subject: Simplify scheduling by introducing an init process MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Scheduling is easier if there is an init process which does nothing. This way we don't have to perform hacks in order to idle in S privilege mode while touching special registers in weird ways. For now this process is kind of costly since 'wfi' is not accepted in this context, but this can be further tuned down in the future by setting TW=1 on 'mstatus', or by handling the exception and allowing it if it comes from the proper process. All of that being said, there is still work to be done as things fail when optimitzations are on. Signed-off-by: Miquel Sabaté Solà --- include/fbos/sched.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/fbos/sched.h b/include/fbos/sched.h index c2a4b19..e05d0a1 100644 --- a/include/fbos/sched.h +++ b/include/fbos/sched.h @@ -23,10 +23,7 @@ struct task_struct { // Tasks available on this kernel. extern struct task_struct tasks[4]; -// Identifier for the next task to be run. -extern int next_task; - -// Bring the machine to idle mode. -__noreturn __kernel void idle(void); +// Switch execution to the given task id. +void switch_to(int task_id); #endif // __FBOS_SCHED_H_ -- cgit v1.2.3