diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-11-19 14:55:32 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-11-19 15:05:59 +0100 |
| commit | 52a4afca71aee5c150c6c63e7c1a510501fce6f3 (patch) | |
| tree | 9f89676e30995aa9b8da02364b948a0cf6b7aa0c /kernel/main.c | |
| parent | 24e9f07624f8d71db91171c7f8a52aaed2098560 (diff) | |
| download | fbos-52a4afca71aee5c150c6c63e7c1a510501fce6f3.tar.gz fbos-52a4afca71aee5c150c6c63e7c1a510501fce6f3.zip | |
Setup the stack for an init task
Bootstrap an init task which holds at least the initial stack that is to
be used when setting up the registers (such as `sp` and `tp`).
In order to guarantee that the stack and the rest of the registers are
set up correctly, this commit also provides a raw implementation of a
`printk` function.
Moreover, this commit also adds an argument that must be passed to
`start_kernel`, which is the pointer to the embedded `fdt` blob. This
argument will be used by later work so to fetch, at least, the base
address for the initial ram disk. This was also used to test that the
stack was working as expected.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'kernel/main.c')
| -rw-r--r-- | kernel/main.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/kernel/main.c b/kernel/main.c index 325f858..07188b9 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -1,12 +1,28 @@ #include <fbos/init.h> +#include <fbos/printk.h> +#include <fbos/mm.h> +#include <fbos/sched.h> +#include <fbos/dt.h> + +unsigned long init_stack[THREAD_SIZE / sizeof(unsigned long)]; + +struct task_struct init_task = { .stack = init_stack }; /* * This is the main entry point of the kernel after head.S is done. This * function can (and will) assume that everything has been reset and that we can * start the whole thing. */ -__noreturn __kernel void start_kernel(void) +__noreturn __kernel void start_kernel(uintptr_t *dtb) { + // TODO: disable irqs, etc. + + printk("Welcome to FizzBuzz OS!\n"); + + parse_dtb(dtb); + + // TODO: reenable stuff + for (;;) ; } |
