summaryrefslogtreecommitdiff
path: root/kernel/dtb.c
diff options
context:
space:
mode:
authorNathan Lee <me@nwlee.tech>2026-07-12 12:42:31 -0500
committerNathan Lee <me@nwlee.tech>2026-07-12 12:45:05 -0500
commit24fdac29fb8a1c7766869b05e7a17b2c4cc98ce1 (patch)
tree6fddf53527e7ab52e089b620bcdbcba5fa67daa3 /kernel/dtb.c
parent5d9942d70ca61af4d12cd2a531a190c98052c9c4 (diff)
create elf.h
The ELF parser needs more work, there are more structs to be added. memcpy was refactored from mem.h into common.h endianness conversions were standardized in types.h
Diffstat (limited to 'kernel/dtb.c')
-rw-r--r--kernel/dtb.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/dtb.c b/kernel/dtb.c
index 99b1679..7647767 100644
--- a/kernel/dtb.c
+++ b/kernel/dtb.c
@@ -10,15 +10,15 @@ struct dt_node *dt_parse(void *fdt) {
return NULL;
}
- uint32_t *p = (uint32_t *)(fdt + be32_to_cpu(hdr->off_dt_struct));
- char *strings = fdt + be32_to_cpu(hdr->off_dt_strings);
+ uint32_t *p = (uint32_t *)(fdt + btohi(hdr->off_dt_struct));
+ char *strings = fdt + btohi(hdr->off_dt_strings);
struct dt_node *root = NULL;
struct dt_node *stack[DTB_MAX_NODES];
int sp = 0;
while (1) {
- uint32_t token = be32_to_cpu(*p++);
+ uint32_t token = btohi(*p++);
switch (token) {
case FDT_BEGIN_NODE: {
char *name = (char *)p;
@@ -35,8 +35,8 @@ struct dt_node *dt_parse(void *fdt) {
break;
}
case FDT_PROP: {
- uint32_t len = be32_to_cpu(*p++);
- uint32_t nameoff = be32_to_cpu(*p++);
+ uint32_t len = btohi(*p++);
+ uint32_t nameoff = btohi(*p++);
void *value = p;
p += (len + 3) / 4;