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à --- kernel/initrd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'kernel/initrd.c') diff --git a/kernel/initrd.c b/kernel/initrd.c index a5c8861..ff1f52b 100644 --- a/kernel/initrd.c +++ b/kernel/initrd.c @@ -53,7 +53,9 @@ __kernel uint64_t strtoul16(const char *str, size_t count) __kernel int get_task_id_from_name(const char *const name) { - if (strcmp(name, "usr/bin/fizz") == 0) { + if (strcmp(name, "usr/bin/init") == 0) { + return TASK_INIT; + } else if (strcmp(name, "usr/bin/fizz") == 0) { return TASK_FIZZ; } else if (strcmp(name, "usr/bin/buzz") == 0) { return TASK_BUZZ; -- cgit v1.2.3