From 24fdac29fb8a1c7766869b05e7a17b2c4cc98ce1 Mon Sep 17 00:00:00 2001 From: Nathan Lee Date: Sun, 12 Jul 2026 12:42:31 -0500 Subject: 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 --- kernel/dtb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'kernel/dtb.c') 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; -- cgit v1.2.3