diff options
| author | Nathan Lee <me@nwlee.tech> | 2026-06-19 19:05:01 -0500 |
|---|---|---|
| committer | Nathan Lee <me@nwlee.tech> | 2026-06-19 19:05:01 -0500 |
| commit | 5c15e93fa87800b1f8fae7ef688a9d41221526f1 (patch) | |
| tree | 2b8ed7b696edc9889b588dd79db14c564ea9a77e /kernel/kernel.c | |
| parent | b106df2447d23d6b3fcffa7cc87edde218d054f3 (diff) | |
create dtb allocator
the parent commit (b106df2447d23d6b3fcffa7cc87edde218d054f3) discussed
the possibility of creating dtb device discovery. for that, we have
replaced wdt device discovery with dtb device discovery. in the future,
we will use the pci kernel module to use device discovery via a PCI
controller
Diffstat (limited to 'kernel/kernel.c')
| -rw-r--r-- | kernel/kernel.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c index 3dbf0d1..568d8a3 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -1,5 +1,6 @@ #include <types.h> -#include <wdt.h> +#include <dtb.h> +#include <bump.h> #define UART_BASE 0x10000000 // Example UART address static inline void putchar(char c) { @@ -13,19 +14,17 @@ static void print_string(const char *str) { } } -void kernel_main(void *wdt) { - struct wdt_root *root = wdt; - print_string("deserialized all!\n"); - uint32_t count = root->count; - for (uint32_t i = 0; i < count; i++) { - print_string("deserializing wdt node!\n"); - print_string("device type: "); - if (root->devices[i].type == 0) { - print_string("mem"); - } else { - print_string("unknown"); - } - print_string("\n"); +void kernel_main(size_t hart, void *fdt) { + (void)hart; + + struct dt_node *head = dt_parse(fdt); + struct mem_info *info = km_find_memory(head); + + if (info) { + print_string("found memory!\n"); + } else { + print_string("could not find memory!\n"); } + while(1); } |
