aboutsummaryrefslogtreecommitdiff
path: root/include/apos/vmem.h
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2021-10-11 23:18:47 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2021-10-11 23:18:47 +0300
commit7237d673904d8568a2f9c290a0247c9d1a07c5d2 (patch)
tree7deabe2dc64ddf05016eb3e3a4f22a7e252b5c35 /include/apos/vmem.h
parentebd34a9ab3809167e16e4107c8e72d1d81faff9c (diff)
downloadkmi-7237d673904d8568a2f9c290a0247c9d1a07c5d2.tar.gz
kmi-7237d673904d8568a2f9c290a0247c9d1a07c5d2.zip
Start designing vmem framework
Diffstat (limited to 'include/apos/vmem.h')
-rw-r--r--include/apos/vmem.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/apos/vmem.h b/include/apos/vmem.h
new file mode 100644
index 0000000..589e814
--- /dev/null
+++ b/include/apos/vmem.h
@@ -0,0 +1,32 @@
+#ifndef APOS_VMEM_H
+#define APOS_VMEM_H
+
+/* arch-specific data */
+#include <vmem.h>
+
+/* general overview of the different functions:
+ * (un)map_vmem: map one known page of physical memory to one known page of
+ * virtual memory
+ *
+ * (un)map_vregion: map known physical region to unknown virtual region within
+ * start and end
+ *
+ * (un)map_vsize: map unknown physical region to unknown virtual region
+ */
+
+void map_vmem(struct vm_branch_t *branch,
+ pm_t paddr, vm_t vaddr,
+ uint8_t flags, enum mm_order_t order);
+
+void unmap_vmem(struct vm_branch_t *branch, vm_t vaddr, enum mm_order_t order);
+
+#define map_kvregion(b, pb, pt) map_vregion(b, pb, pt, VMEM_BASE, VMEM_TOP);
+#define map_uvregion(b, pb, pt) map_vregion(b, pb, pt, UMEM_BASE, UMEM_TOP);
+
+vm_t map_vregion(struct vm_branch_t *branch, pm_t base, pm_t top, vm_t start, vm_t end);
+void unmap_vregion(struct vm_branch_t *branch, pm_t base, pm_t top);
+
+vm_t map_vsize(struct vm_branch_t *branch, size_t size);
+void unmap_vsize(struct vm_branch_t *branch, size_t size);
+
+#endif /* APOS_VMEM_H */