Skip to content

Commit 00c4da7

Browse files
pussuwxiaoxiang781216
authored andcommitted
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.
1 parent 20ce41d commit 00c4da7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

arch/arm64/src/common/arm64_addrenv.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ static int copy_kernel_mappings(arch_addrenv_t *addrenv)
208208

209209
memcpy((void *)user_mappings, (void *)g_kernel_mappings, MMU_PAGE_SIZE);
210210

211+
/* Update with memory by flushing the cache */
212+
213+
up_flush_dcache(user_mappings, user_mappings + MMU_PAGE_SIZE);
214+
211215
return OK;
212216
}
213217

@@ -737,7 +741,9 @@ int up_addrenv_select(const arch_addrenv_t *addrenv)
737741

738742
int up_addrenv_coherent(const arch_addrenv_t *addrenv)
739743
{
740-
/* Nothing needs to be done */
744+
/* Invalidate I-Cache */
745+
746+
up_invalidate_icache_all();
741747

742748
return OK;
743749
}

0 commit comments

Comments
 (0)