From 2ee0e24dfd5319f128ed49b4f47679b7c13b21bf Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Mon, 21 Apr 2025 11:41:34 -0400 Subject: fs read/write functions, initrd --- kernel/mboot/module.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 kernel/mboot/module.c (limited to 'kernel/mboot/module.c') diff --git a/kernel/mboot/module.c b/kernel/mboot/module.c new file mode 100644 index 0000000..7a64f2e --- /dev/null +++ b/kernel/mboot/module.c @@ -0,0 +1,24 @@ +#include + +#include "mboot.h" + +#define MULTIBOOT_TAG_TYPE_MODULE 3 + +struct multiboot_tag_module { + uint32_t type; + uint32_t size; + uint32_t mod_start; + uint32_t mod_end; + char cmdline[]; +}; + +void *mboot_get_initrd(size_t *len) +{ + void *tag = locate_mboot_table(MULTIBOOT_TAG_TYPE_MODULE); + if (tag == NULL) + return NULL; + + struct multiboot_tag_module *mod = (struct multiboot_tag_module *)tag; + *len = mod->mod_end - mod->mod_start; + return (void*) (uintptr_t) mod->mod_start; +} -- cgit v1.2.3-freya