aboutsummaryrefslogtreecommitdiff
path: root/kernel/main.c
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2024-12-03 07:59:01 +0100
committerMiquel Sabaté Solà <mikisabate@gmail.com>2024-12-03 07:59:01 +0100
commit065f42adc9af7fc4adc391bb6961460010c30d08 (patch)
treefbfee11307db6a695f4eb347dbe8a0fbb034fbf9 /kernel/main.c
parent4ab2ce3fb0e6b8085742c734a8f5437db5979046 (diff)
downloadfbos-065f42adc9af7fc4adc391bb6961460010c30d08.tar.gz
fbos-065f42adc9af7fc4adc391bb6961460010c30d08.zip
Remove stack pointer for each process
Since 6132623dbf30 ("Share the same stack everywhere") the same stack is used everywhere. Hence, it's rather pointless for each task to have a pointer to a stack which is the same and that is never read. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'kernel/main.c')
-rw-r--r--kernel/main.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/kernel/main.c b/kernel/main.c
index 5a11816..a2e4d13 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -5,22 +5,23 @@
#include <fbos/string.h>
#include <fbos/dt.h>
-// Stack to be used by our processes. "Blasphemy!" I hear you say. "How dare you
-// use the same stack for kernel and user space?" It's not like this is some
-// sort of utopian system in which everyone shares everything, but since this
-// stupidly simple kernel does not even bother to implement paging nor any other
-// memory protection of any kind, it's not like separating stacks for each
-// process and kernel space would make much of a difference. Hence, let's keep
-// it simple and have the same stack everwhere.
+// Stack to be used by our processes, which is initialized in head.S.
+// "Blasphemy!" I hear you say. "How dare you use the same stack for kernel and
+// user space?" It's not like this is some sort of utopian system in which
+// everyone shares everything, but since this stupidly simple kernel does not
+// even bother to implement paging nor any other memory protection of any kind,
+// it's not like separating stacks for each process and kernel space would make
+// much of a difference. Hence, let's keep it simple and have the same stack
+// everwhere.
uint64_t stack[STACK_SIZE / sizeof(uint64_t)];
// Initialize the list of structs by providing a fixed stack address and empty
// values everywhere else.
struct task_struct tasks[4] = {
- [TASK_INIT] = { .stack = stack, .name = "init", .entry_addr = nullptr, },
- [TASK_FIZZ] = { .stack = stack, .name = "fizz", .entry_addr = nullptr, },
- [TASK_BUZZ] = { .stack = stack, .name = "buzz", .entry_addr = nullptr, },
- [TASK_FIZZBUZZ] = { .stack = stack, .name = "fizzbuzz", .entry_addr = nullptr, },
+ [TASK_INIT] = { .name = "init", .entry_addr = nullptr, },
+ [TASK_FIZZ] = { .name = "fizz", .entry_addr = nullptr, },
+ [TASK_BUZZ] = { .name = "buzz", .entry_addr = nullptr, },
+ [TASK_FIZZBUZZ] = { .name = "fizzbuzz", .entry_addr = nullptr, },
};
// Defined in fbos/init.h.