X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/32b9a6d76790c73d3d2d36d9081a2581cc65d184..28c176b668c841a3b7fb093faccf0efa39257603:/lunaix-os/arch/x86/boot/boot_helper.c diff --git a/lunaix-os/arch/x86/boot/boot_helper.c b/lunaix-os/arch/x86/boot/boot_helper.c new file mode 100644 index 0000000..c5f0c46 --- /dev/null +++ b/lunaix-os/arch/x86/boot/boot_helper.c @@ -0,0 +1,46 @@ +#include +#include + +#include "sys/mm/mm_defs.h" + +#ifdef CONFIG_ARCH_X86_64 + +void +boot_begin_arch_reserve(struct boot_handoff* bhctx) +{ + return; +} + + +void +boot_clean_arch_reserve(struct boot_handoff* bhctx) +{ + return; +} + +#else + +#include + +void +boot_begin_arch_reserve(struct boot_handoff* bhctx) +{ + // Identity-map the first 3GiB address spaces + pte_t* ptep = mkl0tep(mkptep_va(VMS_SELF, 0)); + pte_t pte = mkpte_prot(KERNEL_DATA); + size_t count = page_count(KERNEL_RESIDENT, L0T_SIZE); + + vmm_set_ptes_contig(ptep, pte_mkhuge(pte), L0T_SIZE, count); +} + + +void +boot_clean_arch_reserve(struct boot_handoff* bhctx) +{ + pte_t* ptep = mkl0tep(mkptep_va(VMS_SELF, 0)); + size_t count = page_count(KERNEL_RESIDENT, L0T_SIZE); + vmm_unset_ptes(ptep, count); +} + + +#endif \ No newline at end of file