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 2024/09/10 15:05:19 UTC

(nuttx) 01/04: arm64_mmu: Do not set accessed-flag for table descriptors

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/nuttx.git

commit fbc796cff1a60712b1630c42256f121c2c6cc111
Author: Ville Juven <vi...@unikie.com>
AuthorDate: Thu Aug 29 15:09:16 2024 +0300

    arm64_mmu: Do not set accessed-flag for table descriptors
    
    The 12:0 bits in table descriptors are RES0 and AF is the 10th bit, so
    it is not valid to set it in this case.
    
    Fix this by moving AF to the common MMU_MT_NORMAL_FLAGS field
---
 arch/arm64/src/common/arm64_mmu.c | 4 ----
 arch/arm64/src/common/arm64_mmu.h | 6 +++---
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/arm64/src/common/arm64_mmu.c b/arch/arm64/src/common/arm64_mmu.c
index ec1bb1b98b..a2572850a1 100644
--- a/arch/arm64/src/common/arm64_mmu.c
+++ b/arch/arm64/src/common/arm64_mmu.c
@@ -707,10 +707,6 @@ void mmu_ln_setentry(uint32_t ptlevel, uintptr_t lnvaddr, uintptr_t paddr,
 
   index = XLAT_TABLE_VA_IDX(vaddr, ptlevel);
 
-  /* Setup the page descriptor and access flag */
-
-  mmuflags |= PTE_PAGE_DESC | PTE_BLOCK_DESC_AF;
-
   /* Save it */
 
   lntable[index] = (paddr | mmuflags);
diff --git a/arch/arm64/src/common/arm64_mmu.h b/arch/arm64/src/common/arm64_mmu.h
index a5c59791a8..1e95232f34 100644
--- a/arch/arm64/src/common/arm64_mmu.h
+++ b/arch/arm64/src/common/arm64_mmu.h
@@ -223,11 +223,11 @@
 
 /* Flags for user page tables */
 
-#define MMU_UPGT_FLAGS              (0)
+#define MMU_UPGT_FLAGS              (PTE_TABLE_DESC)
 
 /* Flags for normal memory region */
 
-#define MMU_MT_NORMAL_FLAGS         (PTE_BLOCK_DESC_INNER_SHARE | PTE_BLOCK_DESC_MEMTYPE(MT_NORMAL))
+#define MMU_MT_NORMAL_FLAGS         (PTE_PAGE_DESC | PTE_BLOCK_DESC_AF | PTE_BLOCK_DESC_INNER_SHARE | PTE_BLOCK_DESC_MEMTYPE(MT_NORMAL))
 
 /* Flags for user FLASH (RX) and user RAM (RW) */
 
@@ -240,7 +240,7 @@
 
 /* Flags for kernel page tables */
 
-#define MMU_KPGT_FLAGS              (0)
+#define MMU_KPGT_FLAGS              (PTE_TABLE_DESC)
 
 /* Kernel FLASH and RAM are mapped globally */