diff --git a/hypervisor/common/mmu.c b/hypervisor/common/mmu.c index aa847a42f..162515a1b 100644 --- a/hypervisor/common/mmu.c +++ b/hypervisor/common/mmu.c @@ -54,7 +54,7 @@ struct page *alloc_page(struct page_pool *pool) */ panic("no dummy aviable!"); } - (void)memset(page, 0U, PAGE_SIZE); + sanitize_pte((uint64_t *)page, NULL); return page; } @@ -621,7 +621,6 @@ void pgtable_add_map(uint64_t *pgtl3_page, uint64_t paddr_base, uint64_t vaddr_b void *pgtable_create_root(const struct pgtable *table) { uint64_t *page = (uint64_t *)alloc_page(table->pool); - sanitize_pte(page, table); return page; } diff --git a/hypervisor/include/common/mmu.h b/hypervisor/include/common/mmu.h index 13167d0ec..99584b60c 100644 --- a/hypervisor/include/common/mmu.h +++ b/hypervisor/include/common/mmu.h @@ -92,7 +92,8 @@ static inline uint64_t get_pgentry(const uint64_t *pte) static inline void set_pgentry(uint64_t *ptep, uint64_t pte, const struct pgtable *table) { *ptep = pte; - table->flush_cache_pagewalk(ptep); + if (table && table->flush_cache_pagewalk) + table->flush_cache_pagewalk(ptep); } void init_page_pool(struct page_pool *pool, uint64_t *page_base,