X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/1fe5f5eb5378a47bf0f3451762743c162e40faad..7cdb9e293b5657fac5295025a47c5b215ea62c0b:/lunaix-os/kernel/boot_helper.c diff --git a/lunaix-os/kernel/boot_helper.c b/lunaix-os/kernel/boot_helper.c index fa87bff..3ac5bcb 100644 --- a/lunaix-os/kernel/boot_helper.c +++ b/lunaix-os/kernel/boot_helper.c @@ -4,6 +4,7 @@ #include #include #include +#include #include /** @@ -32,6 +33,14 @@ boot_begin(struct boot_handoff* bhctx) vmm_set_mapping(VMS_SELF, pa, pa, PG_PREM_RW, VMAP_IGNORE); } } + + /* Reserve region for all loaded modules */ + for (size_t i = 0; i < bhctx->mods.mods_num; i++) { + struct boot_modent* mod = &bhctx->mods.entries[i]; + pmm_mark_chunk_occupied(PN(mod->start), + CEIL(mod->end - mod->start, PG_SIZE_BITS), + PP_FGLOCKED); + } } extern u8_t __kexec_boot_end; /* link/linker.ld */ @@ -77,6 +86,15 @@ boot_cleanup() // clean up for (size_t i = 0; i < (ptr_t)(&__kexec_boot_end); i += PG_SIZE) { vmm_del_mapping(VMS_SELF, (ptr_t)i); - pmm_free_page(KERNEL_PID, (ptr_t)i); + pmm_free_page((ptr_t)i); } +} + +void +boot_parse_cmdline(struct boot_handoff* bhctx) { + if (!bhctx->kexec.len) { + return; + } + + kcmd_parse_cmdline(bhctx->kexec.cmdline); } \ No newline at end of file