Support to multi-threading and pthread interface (POSIX.1-2008) (#23)
[lunaix-os.git] / lunaix-os / kernel / boot_helper.c
index 1383f60af7290181a01d8524b9485810c0201fcc..3ac5bcbc1c1296fad091caefd7b2721ea6597ca4 100644 (file)
@@ -4,6 +4,7 @@
 #include <lunaix/mm/pmm.h>
 #include <lunaix/mm/vmm.h>
 #include <lunaix/spike.h>
+#include <lunaix/kcmd.h>
 #include <sys/mm/mempart.h>
 
 /**
@@ -36,8 +37,7 @@ boot_begin(struct boot_handoff* bhctx)
     /* 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(KERNEL_PID,
-                                PN(mod->start),
+        pmm_mark_chunk_occupied(PN(mod->start),
                                 CEIL(mod->end - mod->start, PG_SIZE_BITS),
                                 PP_FGLOCKED);
     }
@@ -86,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