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.
This commit is contained in:
Ville Juven 2024-09-04 12:28:42 +03:00 committed by Xiang Xiao
parent 20ce41d080
commit 00c4da73b3
1 changed files with 7 additions and 1 deletions

View File

@ -208,6 +208,10 @@ static int copy_kernel_mappings(arch_addrenv_t *addrenv)
memcpy((void *)user_mappings, (void *)g_kernel_mappings, MMU_PAGE_SIZE); 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; return OK;
} }
@ -737,7 +741,9 @@ int up_addrenv_select(const arch_addrenv_t *addrenv)
int up_addrenv_coherent(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; return OK;
} }