From 5c15e93fa87800b1f8fae7ef688a9d41221526f1 Mon Sep 17 00:00:00 2001 From: Nathan Lee Date: Fri, 19 Jun 2026 19:05:01 -0500 Subject: 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 --- kernel/kernel.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'kernel/kernel.c') 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 -#include +#include +#include #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); } -- cgit v1.2.3