summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/pmap.c13
-rw-r--r--sys/include/vm/pmap.h6
2 files changed, 19 insertions, 0 deletions
diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c
index 2760532..54d4ca3 100644
--- a/sys/arch/amd64/amd64/pmap.c
+++ b/sys/arch/amd64/amd64/pmap.c
@@ -228,6 +228,19 @@ pmap_switch_vas(struct vm_ctx *ctx, struct vas vas)
: "memory");
}
+/*
+ * TODO: During the mapping of a virtual address, a level
+ * may be allocated. This function does not handle the
+ * freeing of allocated levels. We should keep track
+ * of levels allocated and free them here.
+ */
+int
+pmap_free_vas(struct vm_ctx *ctx, struct vas vas)
+{
+ vm_free_pageframe(vas.top_level, 1);
+ return 0;
+}
+
struct vas
pmap_read_vas(void)
{
diff --git a/sys/include/vm/pmap.h b/sys/include/vm/pmap.h
index ebabd32..3380199 100644
--- a/sys/include/vm/pmap.h
+++ b/sys/include/vm/pmap.h
@@ -90,6 +90,12 @@ struct vas pmap_read_vas(void);
int pmap_map(struct vm_ctx *, struct vas, vaddr_t, paddr_t, vm_prot_t);
/*
+ * Get rid of a virtual address space and free
+ * resources.
+ */
+int pmap_free_vas(struct vm_ctx *, struct vas);
+
+/*
* Unmap a page.
*/
int pmap_unmap(struct vm_ctx *, struct vas, vaddr_t);