1 #include <lunaix/boot_generic.h>
2 #include <lunaix/mm/pagetable.h>
3 #include <lunaix/mm/pmm.h>
4 #include <lunaix/spike.h>
5 #include <lunaix/sections.h>
7 #include <asm/mm_defs.h>
8 #include <asm/boot_stage.h>
9 #include <sys-generic/bootmem.h>
11 #ifdef CONFIG_ARCH_X86_64
14 boot_begin_arch_reserve(struct boot_handoff* bhctx)
21 boot_clean_arch_reserve(struct boot_handoff* bhctx)
25 start = leaf_count(__ptr(__kboot_start));
26 pmm_unhold_range(start, leaf_count(__ptr(__kboot_end)) - start);
31 #include <lunaix/mm/vmm.h>
34 boot_begin_arch_reserve(struct boot_handoff* bhctx)
36 // Identity-map the first 3GiB address spaces
37 pte_t* ptep = mkl0tep(mkptep_va(VMS_SELF, 0));
38 pte_t pte = mkpte_prot(KERNEL_DATA);
39 size_t count = page_count(KERNEL_RESIDENT, L0T_SIZE);
41 vmm_set_ptes_contig(ptep, pte_mkhuge(pte), L0T_SIZE, count);
46 boot_clean_arch_reserve(struct boot_handoff* bhctx)
48 pte_t* ptep = mkl0tep(mkptep_va(VMS_SELF, 0));
49 size_t count = page_count(KERNEL_RESIDENT, L0T_SIZE);
50 vmm_unset_ptes(ptep, count);
56 mb_parse(struct boot_handoff* bhctx);
59 prepare_boot_handover()
61 struct boot_handoff* handoff;
63 handoff = bootmem_alloc(sizeof(*handoff));