- klptep++;
- }
-
- // Ensure the size of kernel is within the reservation
- pfn_t kimg_pagecount =
- pfn(__far(__kexec_end) - __far(__kexec_start));
- if (kimg_pagecount > KEXEC_RSVD * _PAGE_LEVEL_SIZE) {
- // ERROR: require more pages
- // here should do something else other than head into blocking
- asm("ud2");
- }
-
- // Now, map the kernel
-
- pfn_t kimg_end = pfn(to_kphysical(__far(__kexec_end)));
- pfn_t i = pfn(to_kphysical(__far(__kexec_text_start)));
- ktep += i;
-
- // kernel .text
- pte = pte_setprot(pte, KERNEL_EXEC);
- pfn_t ktext_end = pfn(to_kphysical(__far(__kexec_text_end)));
- for (; i < ktext_end; i++) {
- pte = pte_setpaddr(pte, page_addr(i));
- set_pte(ktep, pte);
+ kpt_mktable_at(&ptw, KMAP, L0T_SIZE);
+ kpt_mktable_at(&ptw, VMAP, L0T_SIZE);