From 40bfcbb2cf8a39e58ec19b21956caaf4685c9b8b Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Tue, 6 May 2025 12:34:48 -0400 Subject: terrible hack to not overwrite mboot data --- kernel/mboot/module.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'kernel/mboot/module.c') diff --git a/kernel/mboot/module.c b/kernel/mboot/module.c index bf15eca..03c5147 100644 --- a/kernel/mboot/module.c +++ b/kernel/mboot/module.c @@ -1,4 +1,4 @@ -#include "comus/memory.h" +#include #include #include "mboot.h" @@ -16,7 +16,7 @@ struct multiboot_tag_module { static void *mapped_addr = NULL; size_t initrd_len; -void *mboot_get_initrd(size_t *len) +void *mboot_get_initrd_phys(size_t *len) { struct multiboot_tag_module *mod; void *tag, *phys; @@ -36,11 +36,21 @@ void *mboot_get_initrd(size_t *len) phys = (void *)(uintptr_t)mod->mod_start; initrd_len = mod->mod_end - mod->mod_start; + *len = initrd_len; + return phys; +} + +void *mboot_get_initrd(size_t *len) +{ + // get phys + void *phys = mboot_get_initrd_phys(len); + if (phys == NULL) + return NULL; + // map addr mapped_addr = kmapaddr(phys, NULL, initrd_len, F_PRESENT | F_WRITEABLE); if (mapped_addr == NULL) return NULL; - *len = initrd_len; return mapped_addr; } -- cgit v1.2.3-freya