static void _npg_map_4K(offset_t addr, uint64_t attr) { npg_pdpe_t *pdpe = __npg_resolve_pdpe(addr, attr); npg_pde64_t *pde = __npg_resolve_pde(pdpe, addr, attr); npg_pte64_t *pte; debug(PG_MAP, "map 4K 0x%X 0x%X\n", addr, attr); if(npg_large(pdpe) || npg_large(pde)) return; pte = __npg_resolve_pte(pde, addr, attr); npg_set_page_entry(pte, attr, pg_4K_nr(addr)); }
/* ** Low level services */ static void __npg_map_2M_nolarge(npg_pde64_t *pde, offset_t addr, uint64_t attr) { npg_pte64_t *pt; offset_t pfn; uint32_t i; pt = __npg_new_pt(); debug(PG_MAP, "new pt\n"); pfn = pg_4K_nr(addr); debug(PG_MAP, "mapping 4K for each pte\n"); for(i=0 ; i<PTE64_PER_PT ; i++, pfn++) npg_set_page_entry(&pt[i], attr, pfn); /* upper-level entry has full pvl */ npg_set_entry(pde, attr|npg_dft_pvl, page_nr(pt)); debug(PG_MAP, "mapped 2M 0x%X 0x%X\n", addr, attr); }