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


The following commit(s) were added to refs/heads/master by this push:
     new 00c4da73b3 arm64_addrenv.c: Flush kernel page table copy to user 
mappings
00c4da73b3 is described below

commit 00c4da73b39ee478ebcdac65849cbf77eb3b4a00
Author: Ville Juven <[email protected]>
AuthorDate: Wed Sep 4 12:28:42 2024 +0300

    arm64_addrenv.c: Flush kernel page table copy to user mappings
    
    Make sure the user L1 page is updated to system memory when the kernel
    mappings are copied.
    
    Also, flush the I-cache when switching address environments.
---
 arch/arm64/src/common/arm64_addrenv.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/src/common/arm64_addrenv.c 
b/arch/arm64/src/common/arm64_addrenv.c
index 2864de4f23..5f28883774 100644
--- a/arch/arm64/src/common/arm64_addrenv.c
+++ b/arch/arm64/src/common/arm64_addrenv.c
@@ -208,6 +208,10 @@ static int copy_kernel_mappings(arch_addrenv_t *addrenv)
 
   memcpy((void *)user_mappings, (void *)g_kernel_mappings, MMU_PAGE_SIZE);
 
+  /* Update with memory by flushing the cache */
+
+  up_flush_dcache(user_mappings, user_mappings + MMU_PAGE_SIZE);
+
   return OK;
 }
 
@@ -737,7 +741,9 @@ int up_addrenv_select(const arch_addrenv_t *addrenv)
 
 int up_addrenv_coherent(const arch_addrenv_t *addrenv)
 {
-  /* Nothing needs to be done */
+  /* Invalidate I-Cache */
+
+  up_invalidate_icache_all();
 
   return OK;
 }

Reply via email to