diff options
| author | Ian Moffett <ian@osmora.org> | 2025-11-21 22:45:41 -0500 |
|---|---|---|
| committer | Ian Moffett <ian@osmora.org> | 2025-11-21 22:45:41 -0500 |
| commit | 01001c2aa2216c92603e1bdc334613e5adcacb04 (patch) | |
| tree | d70c5222caea12188128266b3d38861bbae911e5 /sys/arch/amd64 | |
| parent | 03090935db3e40132177e8ec25b7503b0e2ee78d (diff) | |
kern/amd64: mu: Add pmap unmap function
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/arch/amd64')
| -rw-r--r-- | sys/arch/amd64/cpu/mmu.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sys/arch/amd64/cpu/mmu.c b/sys/arch/amd64/cpu/mmu.c index b709ee1..2be4b12 100644 --- a/sys/arch/amd64/cpu/mmu.c +++ b/sys/arch/amd64/cpu/mmu.c @@ -193,6 +193,27 @@ mu_pmap_map(struct mmu_vas *vas, uintptr_t pa, uintptr_t va, } int +mu_pmap_unmap(struct mmu_vas *vas, uintptr_t va, pagesize_t ps) +{ + uintptr_t *pagetbl; + size_t index; + + if (vas == NULL) { + return -EINVAL; + } + + pagetbl = pmap_get_level(vas, va, false, PMAP_PML1); + if (pagetbl == NULL) { + return 0; + } + + index = pmap_get_index(va, PMAP_PML1); + pagetbl[index] = 0; + pmap_invlpg(va); + return 0; +} + +int mu_pmap_readvas(struct mmu_vas *vas) { __asmv( |
