diff options
Diffstat (limited to 'kernel/mboot')
-rw-r--r-- | kernel/mboot/module.c | 24 |
1 files changed, 24 insertions, 0 deletions
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 <comus/mboot.h> + +#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; +} |