You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/11/17 01:17:02 UTC

[incubator-nuttx] 03/04: riscv/mmu: Implement mmu_ln_clear

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 5c29042ab4b673319f7bc717be2dd55e68f88b57
Author: Ville Juven <vi...@unikie.com>
AuthorDate: Wed Nov 16 14:34:43 2022 +0200

    riscv/mmu: Implement mmu_ln_clear
    
    Implement procedure to clear a mapping from MMU
---
 arch/risc-v/src/common/riscv_mmu.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/risc-v/src/common/riscv_mmu.h b/arch/risc-v/src/common/riscv_mmu.h
index e67fadc276..fb0847ccf2 100644
--- a/arch/risc-v/src/common/riscv_mmu.h
+++ b/arch/risc-v/src/common/riscv_mmu.h
@@ -363,6 +363,25 @@ uintptr_t mmu_ln_getentry(uint32_t ptlevel, uintptr_t lnvaddr,
 void mmu_ln_restore(uint32_t ptlevel, uintptr_t lnvaddr, uintptr_t vaddr,
                     uintptr_t entry);
 
+/****************************************************************************
+ * Name: mmu_ln_clear
+ *
+ * Description:
+ *   Unmap a level n translation table entry.
+ *
+ * Input Parameters:
+ *   ptlevel - The translation table level, amount of levels is
+ *     MMU implementation specific
+ *   lnvaddr - The virtual address of the beginning of the page table at
+ *     level n
+ *   vaddr - The virtual address to get pte for. Must be aligned to a PPN
+ *     address boundary which is dependent on the level of the entry
+ *
+ ****************************************************************************/
+
+#define mmu_ln_clear(ptlevel, lnvaddr, vaddr) \
+  mmu_ln_restore(ptlevel, lnvaddr, vaddr, 0)
+
 /****************************************************************************
  * Name: mmu_ln_map_region
  *