mm/kmap: Finalize kmap implementation for RISC-V

After this, RISC-V fully supports the kmap interface.

Due to the current design limitations of having only a single L2 table
per process, the kernel kmap area cannot be mapped via any user page
directory, as they do not contain the page tables to address that range.

So a "kernel address environment" is added, which can do the mapping. The
mapping is reflected to every process as only the root page directory (L1)
is copied to users, which means every change to L2 / L3 tables will be
seen by every user.
This commit is contained in:
Ville Juven
2023-11-23 16:25:20 +02:00
committed by Xiang Xiao
parent 26e4dd5638
commit 8a2b83c482
3 changed files with 82 additions and 7 deletions
+7 -1
View File
@@ -279,10 +279,16 @@ static void kmm_map_unlock(void)
void kmm_map_initialize(void)
{
/* Initialize the architecture specific part */
DEBUGVERIFY(up_addrenv_kmap_init());
/* Then, the local vmap */
g_kmm_map_vpages = gran_initialize((FAR void *)CONFIG_ARCH_KMAP_VBASE,
CONFIG_ARCH_KMAP_NPAGES << MM_PGSHIFT,
MM_PGSHIFT, MM_PGSHIFT);
DEBUGVERIFY(g_kmm_map_vpages);
DEBUGASSERT(g_kmm_map_vpages != NULL);
mm_map_initialize(&g_kmm_map, true);
}