page: remove duplicate logic from map_hhdm_zones
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
352477595e
commit
5d9e62e4a9
1 changed files with 1 additions and 23 deletions
24
mem/page.c
24
mem/page.c
|
|
@ -141,29 +141,7 @@ static void map_hhdm_zones(pgd_t *pgd_table)
|
|||
top_paddr = entry->base + entry->length;
|
||||
}
|
||||
|
||||
hhdm_end = top_paddr;
|
||||
device_base = ALIGN_UP((u64)TO_VIRT(hhdm_end) + PAGE_SIZE, PAGE_SIZE);
|
||||
|
||||
for (paddr_t p = 0; p < top_paddr; p += 0x200000) {
|
||||
vaddr_t v = (vaddr_t)TO_VIRT(p);
|
||||
|
||||
pgd_t *pgd_entry = &pgd_table[pgd_index(v)];
|
||||
if (!(pgd_entry->pgd & PAGE_PRESENT)) {
|
||||
pgd_entry->pgd = TO_PHYS((u64)pt_alloc()) | PAGE_PRESENT | PAGE_RW;
|
||||
}
|
||||
|
||||
pud_t *pud_table = TO_VIRT(pgd_entry->pgd & PAGE_MASK);
|
||||
pud_t *pud_entry = &pud_table[pud_index(v)];
|
||||
if (!(pud_entry->pud & PAGE_PRESENT)) {
|
||||
pud_entry->pud = TO_PHYS((u64)pt_alloc()) | PAGE_PRESENT | PAGE_RW;
|
||||
}
|
||||
|
||||
/* use PAGE_PS for 2MB pages */
|
||||
pmd_t *pmd_table = TO_VIRT(pud_entry->pud & PAGE_MASK);
|
||||
pmd_t *pmd_entry = &pmd_table[pmd_index(v)];
|
||||
|
||||
pmd_entry->pmd = p | PAGE_PRESENT | PAGE_RW | PAGE_PS;
|
||||
}
|
||||
page_map(pgd_table, 0, hhdm_start, ALIGN_UP(top_paddr, PAGE_SIZE), PAGE_XD | PAGE_RW, NULL);
|
||||
}
|
||||
|
||||
void *map_mmio_dev(paddr_t base, size_t len)
|
||||
|
|
|
|||
Loading…
Reference in a new issue