@@ -43,8 +43,8 @@
#define pgd_free(pgd) free(pgd)
static inline pgd_t *pgd_alloc(void)
{
- pgd_t *pgd = memalign(L1_CACHE_BYTES, PTRS_PER_PGD * sizeof(pgd_t));
- memset(pgd, 0, PTRS_PER_PGD * sizeof(pgd_t));
+ assert(PTRS_PER_PGD * sizeof(pgd_t) <= PAGE_SIZE);
+ pgd_t *pgd = alloc_page();
return pgd;
}
@@ -217,7 +217,7 @@ void *setup_mmu(phys_addr_t phys_end, void *unused)
#endif
if (!mmu_idmap)
- mmu_idmap = alloc_page();
+ mmu_idmap = pgd_alloc();
for (r = mem_regions; r->end; ++r) {
if (r->flags & MR_F_IO) {
@@ -253,7 +253,7 @@ void __iomem *__ioremap(phys_addr_t phys_addr, size_t size)
pgtable = current_thread_info()->pgtable;
} else {
if (!mmu_idmap)
- mmu_idmap = alloc_page();
+ mmu_idmap = pgd_alloc();
pgtable = mmu_idmap;
}
@@ -49,8 +49,8 @@
#define pgd_free(pgd) free(pgd)
static inline pgd_t *pgd_alloc(void)
{
- pgd_t *pgd = memalign(PAGE_SIZE, PTRS_PER_PGD * sizeof(pgd_t));
- memset(pgd, 0, PTRS_PER_PGD * sizeof(pgd_t));
+ assert(PTRS_PER_PGD * sizeof(pgd_t) <= PAGE_SIZE);
+ pgd_t *pgd = alloc_page();
return pgd;
}