summaryrefslogtreecommitdiff
path: root/kernel/kernel.c
blob: 568d8a3d140ed0dde3a6f6c872e6356b43698b54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <types.h>
#include <dtb.h>
#include <bump.h>
#define UART_BASE 0x10000000  // Example UART address

static inline void putchar(char c) {
    volatile char *uart = (volatile char *)UART_BASE;
    *uart = c;
}

static void print_string(const char *str) {
    while (*str) {
        putchar(*str++);
    }
}

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);
}