summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-06-30 22:10:37 -0400
committerIan Moffett <ian@osmora.org>2024-06-30 22:10:37 -0400
commitccdd5b6d2f196cb6a2add34f71eebccbedb35c55 (patch)
tree2211f94c9d9840f994da9148590cfeacf03ad6ca
parent9d0ac7b5da9f94224cbc9fcb2f60a84b15fc68fa (diff)
kernel/amd64: pmap: Add pmap_destroy_vas()
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/arch/amd64/amd64/pmap.c6
-rw-r--r--sys/include/vm/pmap.h5
2 files changed, 11 insertions, 0 deletions
diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c
index 108cd91..0f41e7a 100644
--- a/sys/arch/amd64/amd64/pmap.c
+++ b/sys/arch/amd64/amd64/pmap.c
@@ -224,6 +224,12 @@ pmap_new_vas(struct vas *res)
return 0;
}
+void
+pmap_destroy_vas(struct vas vas)
+{
+ vm_free_frame(vas.top_level, 1);
+}
+
struct vas
pmap_read_vas(void)
{
diff --git a/sys/include/vm/pmap.h b/sys/include/vm/pmap.h
index dccfe0d..4cd334c 100644
--- a/sys/include/vm/pmap.h
+++ b/sys/include/vm/pmap.h
@@ -57,6 +57,11 @@ void pmap_switch_vas(struct vas vas);
int pmap_new_vas(struct vas *res);
/*
+ * Deallocate a virtual address space.
+ */
+void pmap_destroy_vas(struct vas vas);
+
+/*
* Create a virtual memory mapping of a single page.
*/
int pmap_map(struct vas vas, vaddr_t va, paddr_t pa, vm_prot_t prot);