diff options
| author | Nathan Lee <me@nwlee.tech> | 2026-08-28 21:26:14 -0500 |
|---|---|---|
| committer | Nathan Lee <me@nwlee.tech> | 2026-08-28 21:26:14 -0500 |
| commit | 7f4c833ced046f88160a50e7adb1f55343e7e759 (patch) | |
| tree | ec41ed5c02ba61bc9abf58b9db5f8a1d88c8ebd1 /kernel/common/bump.c | |
| parent | 4bbe418d2ecea36f80a38b74462c2936343f3b7d (diff) | |
rework early kernel init
Diffstat (limited to 'kernel/common/bump.c')
| -rw-r--r-- | kernel/common/bump.c | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/kernel/common/bump.c b/kernel/common/bump.c deleted file mode 100644 index 1e07837..0000000 --- a/kernel/common/bump.c +++ /dev/null @@ -1,54 +0,0 @@ -#include <early/bump.h> -#include <sys/log.h> -#include <sys/mem.h> - -static char eheap[EHEAP_SIZE] = {0}; -static size_t eheap_off = 0; - -struct mem_info *km_find_memory(struct dt_node *head) { - struct dt_node *child = head->children; - while (child) { - struct mem_info *location = km_find_memory(child); - if (location) { - return location; - } else { - child = child->next; - } - } - - if (strlen(head->name) != 0) { - struct dt_prop *prop_head = head->props; - while (prop_head) { - if (strcmp(prop_head->name, "device_type") == 0 - && strcmp(prop_head->value, "memory") == 0) { - size_t len = 0; - uint32_t *reg = (uint32_t *)dt_get_prop(head, "reg", &len); - if (reg && len >= 8) { - uint32_t base = btohi(reg[0]); - uint32_t size = btohi(reg[1]); - struct mem_info *ret = kemalloc(sizeof(struct mem_info)); - ret->start = (void*)base; - ret->size = (size_t)size; - - return ret; - } - } - prop_head = prop_head->next; - } - } - return NULL; -} - - -void* kemalloc(size_t size) { - size = (size + 7) & ~7; - - if (eheap_off + size > EHEAP_SIZE) { - return NULL; - } - - void *ptr = &eheap[eheap_off]; - eheap_off += size; - return ptr; -} - |
