1 #include <lunaix/sections.h>
3 #include <asm/mm_defs.h>
4 #include <asm-generic/init_pagetable.h>
5 #include <asm/boot_stage.h>
9 static pte_t kpt[LEVEL_SIZE][32];
14 struct pt_alloc alloc;
19 init_pt_alloc(&alloc, to_kphysical(&kpt), sizeof(kpt));
20 init_ptw_state(&ptw, &alloc, kpt_alloc_table(&alloc));
22 pte = mkpte(bootsec_start, KERNEL_DATA);
23 pte = pte_mkexec(pte);
24 nr = leaf_count(bootsec_end - bootsec_start);
25 kpt_set_ptes(&ptw, bootsec_start, pte, LFT_SIZE, nr);
27 kpt_mktable_at(&ptw, VMAP, L0T_SIZE);
28 kpt_mktable_at(&ptw, PMAP, L2T_SIZE);
29 kpt_mktable_at(&ptw, KMAP, LFT_SIZE);
31 kpt_migrate_highmem(&ptw);
33 pte = mkpte(__ptr(ptw.root), KERNEL_PGTAB);
34 kpt_set_ptes(&ptw, VMS_SELF, pte, L0T_SIZE, 1);
36 return __ptr(ptw.root);