diff --git a/arch/risc-v/src/common/pgalloc.h b/arch/risc-v/src/common/pgalloc.h index 25d94af02d..db31a247aa 100644 --- a/arch/risc-v/src/common/pgalloc.h +++ b/arch/risc-v/src/common/pgalloc.h @@ -78,5 +78,22 @@ static inline uintptr_t riscv_pgvaddr(uintptr_t paddr) } #endif /* CONFIG_ARCH_PGPOOL_MAPPING */ +/**************************************************************************** + * Name: riscv_pgwipe + * + * Description: + * Wipe a page of physical memory, first mapping it into virtual memory. + * + * Input Parameters: + * paddr - Physical address of page + * + ****************************************************************************/ + +static inline void riscv_pgwipe(uintptr_t paddr) +{ + uintptr_t vaddr = riscv_pgvaddr(paddr); + memset((void *)vaddr, 0, MM_PGSIZE); +} + #endif /* CONFIG_MM_PGALLOC */ #endif /* __ARCH_RISC_V_SRC_COMMON_PGALLOC_H */ diff --git a/arch/risc-v/src/common/riscv_addrenv.c b/arch/risc-v/src/common/riscv_addrenv.c index 3dacbfb2e7..bcb7df2411 100644 --- a/arch/risc-v/src/common/riscv_addrenv.c +++ b/arch/risc-v/src/common/riscv_addrenv.c @@ -99,23 +99,6 @@ extern uintptr_t g_kernel_mappings; * Private Functions ****************************************************************************/ -/**************************************************************************** - * Name: wipe_page - * - * Description: - * Wipe a page of physical memory, first mapping it into virtual memory. - * - * Input Parameters: - * paddr - Physical address of page - * - ****************************************************************************/ - -static inline void wipe_page(uintptr_t paddr) -{ - uintptr_t vaddr = riscv_pgvaddr(paddr); - memset((void *)vaddr, 0, MM_PGSIZE); -} - /**************************************************************************** * Name: map_spgtables * @@ -183,7 +166,7 @@ static int create_spgtables(group_addrenv_t *addrenv) /* Wipe the memory and assign it */ - wipe_page(paddr); + riscv_pgwipe(paddr); addrenv->spgtables[i] = paddr; } @@ -290,7 +273,7 @@ static int create_region(group_addrenv_t *addrenv, uintptr_t vaddr, /* This is then used to map the final level */ - wipe_page(paddr); + riscv_pgwipe(paddr); } ptlast = riscv_pgvaddr(paddr); @@ -307,7 +290,7 @@ static int create_region(group_addrenv_t *addrenv, uintptr_t vaddr, /* Wipe the physical page memory */ - wipe_page(paddr); + riscv_pgwipe(paddr); /* Then map the virtual address to the physical address */ diff --git a/arch/risc-v/src/common/riscv_pgalloc.c b/arch/risc-v/src/common/riscv_pgalloc.c index ae78eb5a75..643d77dcd8 100644 --- a/arch/risc-v/src/common/riscv_pgalloc.c +++ b/arch/risc-v/src/common/riscv_pgalloc.c @@ -54,23 +54,6 @@ * Private Functions ****************************************************************************/ -/**************************************************************************** - * Name: wipe_page - * - * Description: - * Wipe a page of physical memory, first mapping it into virtual memory. - * - * Input Parameters: - * paddr - Physical address of page - * - ****************************************************************************/ - -static inline void wipe_page(uintptr_t paddr) -{ - uintptr_t vaddr = riscv_pgvaddr(paddr); - memset((void *)vaddr, 0, MM_PGSIZE); -} - /**************************************************************************** * Name: get_pgtable * @@ -101,7 +84,7 @@ static uintptr_t get_pgtable(group_addrenv_t *addrenv, uintptr_t vaddr) { /* Wipe the page and assign it */ - wipe_page(paddr); + riscv_pgwipe(paddr); mmu_ln_setentry(ptlevel, ptprev, paddr, vaddr, MMU_UPGT_FLAGS); } } @@ -205,7 +188,7 @@ uintptr_t pgalloc(uintptr_t brkaddr, unsigned int npages) /* Wipe the memory */ - wipe_page(paddr); + riscv_pgwipe(paddr); /* Then add the reference */