diff --git a/src/kernel/libs/libc/stdio.h b/src/kernel/libs/libc/stdio.h new file mode 100644 index 0000000..d3514f2 --- /dev/null +++ b/src/kernel/libs/libc/stdio.h @@ -0,0 +1,5 @@ +#pragma once + +#include + +#define printf(...) _log(LOG_INFO, loc$(), __VA_ARGS__) diff --git a/src/libs/dtb/mod.c b/src/libs/dtb/mod.c index b6ff6b1..efe10e8 100644 --- a/src/libs/dtb/mod.c +++ b/src/libs/dtb/mod.c @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include "mod.h" @@ -13,7 +13,7 @@ static uint32_t read_offset(uint8_t** offset) { static DTBNode* dtb_parse(FDTHeader* dtb_header, Allocator* alloc) { if (dtb_header == NULL) { - error$("Device tree blob not initialized"); + printf("Device tree blob not initialized"); return NULL; } @@ -34,13 +34,13 @@ static DTBNode* dtb_parse(FDTHeader* dtb_header, Allocator* alloc) { if (!root) { if (*node_name) { - error$("Invalid device tree blob. Expected root node to be empty"); + printf("Invalid device tree blob. Expected root node to be empty"); return NULL; } root = alloc->alloc(alloc, sizeof(DTBNode)); if (root == NULL) { - error$("Failed to allocate memory for device tree node"); + printf("Failed to allocate memory for device tree node"); return NULL; } @@ -53,7 +53,7 @@ static DTBNode* dtb_parse(FDTHeader* dtb_header, Allocator* alloc) { DTBNode* new_node = alloc->alloc(alloc, sizeof(DTBNode)); if (new_node == NULL) { - error$("Failed to allocate memory for device tree node"); + printf("Failed to allocate memory for device tree node"); return NULL; } @@ -92,7 +92,7 @@ static DTBNode* dtb_parse(FDTHeader* dtb_header, Allocator* alloc) { DTBProp* prop = alloc->alloc(alloc, sizeof(DTBProp)); if (prop == NULL) { - error$("Failed to allocate memory for device tree property"); + printf("Failed to allocate memory for device tree property"); return NULL; } @@ -126,7 +126,7 @@ static DTBNode* dtb_parse(FDTHeader* dtb_header, Allocator* alloc) { break; default: { - error$("Unknown token %x", token); + printf("Unknown token %x", token); return NULL; } } @@ -139,7 +139,7 @@ DTBNode* dtb_init(uintptr_t dtb, Allocator* alloc) { FDTHeader* dtb_header = (FDTHeader*)dtb; if (from_be32(dtb_header->magic) != DTB_MAGIC) { - error$("Invalid device tree blob magic number. Excecting %x, got %x", DTB_MAGIC, from_be32(dtb_header->magic)); + printf("Invalid device tree blob magic number. Excecting %x, got %x", DTB_MAGIC, from_be32(dtb_header->magic)); return NULL; } @@ -179,7 +179,7 @@ RegValue dtb_lookup_reg(DTBNode* node) { DTBProp* prop = dtb_lookup_prop(node, "reg"); if (prop == NULL) { - error$("Failed to find reg property in device tree node %s", node->name); + printf("Failed to find reg property in device tree node %s", node->name); return reg; } @@ -187,13 +187,13 @@ RegValue dtb_lookup_reg(DTBNode* node) { DTBProp* address_cells_prop = dtb_lookup_prop(node->parent, "#address-cells"); if (address_cells_prop == NULL) { - error$("Failed to find #address-cells property in device tree node %s", node->parent->name); + printf("Failed to find #address-cells property in device tree node %s", node->parent->name); return reg; } DTBProp* size_cells_prop = dtb_lookup_prop(node->parent, "#size-cells"); if (size_cells_prop == NULL) { - error$("Failed to find #size-cells property in device tree node %s", node->parent->name); + printf("Failed to find #size-cells property in device tree node %s", node->parent->name); return reg; }