add generic kremap for kernel remapping
[lunaix-os.git] / lunaix-os / arch / x86 / boot / boot_helper.c
index c5f0c460c19b5134a5ecfba17798b07caf75ef9f..2bc35a485640fd9fbd6299fad24d8ab2b47e04da 100644 (file)
@@ -1,7 +1,12 @@
 #include <lunaix/boot_generic.h>
 #include <lunaix/mm/pagetable.h>
+#include <lunaix/mm/pmm.h>
+#include <lunaix/spike.h>
+#include <lunaix/sections.h>
 
-#include "sys/mm/mm_defs.h"
+#include <asm/mm_defs.h>
+#include <asm/boot_stage.h>
+#include <sys-generic/bootmem.h>
 
 #ifdef CONFIG_ARCH_X86_64
 
@@ -15,7 +20,10 @@ boot_begin_arch_reserve(struct boot_handoff* bhctx)
 void
 boot_clean_arch_reserve(struct boot_handoff* bhctx)
 {
-    return;
+    pfn_t start;
+
+    start = leaf_count(__ptr(__kboot_start));
+    pmm_unhold_range(start, leaf_count(__ptr(__kboot_end)) - start);
 }
 
 #else
@@ -42,5 +50,19 @@ boot_clean_arch_reserve(struct boot_handoff* bhctx)
     vmm_unset_ptes(ptep, count);
 }
 
+#endif
+
+extern void
+mb_parse(struct boot_handoff* bhctx);
+
+struct boot_handoff*
+prepare_boot_handover()
+{
+    struct boot_handoff* handoff;
+
+    handoff = bootmem_alloc(sizeof(*handoff));
+
+    mb_parse(handoff);
 
-#endif
\ No newline at end of file
+    return handoff;
+}
\ No newline at end of file