BarryServer : Git

All the code for all my projects
// BarryServer : Git / Orion / commit / d41a53cbc7d055b1c00cf0a339dbed6925f4f02c / mem / vm.h

// Related

Orion

Barry Importing existing Orion kernel d41a53c (2 years, 4 months ago)
diff --git a/mem/vm.h b/mem/vm.h
new file mode 100644
index 0000000..eab852d
--- /dev/null
+++ b/mem/vm.h
@@ -0,0 +1,37 @@
+#ifndef KERNEL_MEM_VM_H
+#define KERNEL_MEM_VM_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <sys/mman.h>
+#include "../vfs/vfs.h"
+
+typedef struct VirtualMemory VirtualMemory;
+typedef struct VMRegion VMRegion;
+typedef struct VMObject VMObject;
+
+/* Virtual Memory Namespace */
+struct VirtualMemory {
+	VMRegion *regions;
+	refcount_t usage;
+};
+
+/* Structure for a Virtual Memory Map Entry */
+struct VMRegion {
+	VMRegion *prev, *next;
+	uintptr_t start, end;
+	int prot;
+	int flags;
+	off_t offset;
+	File *front, *back;
+};
+
+VMRegion *vm_create_region(void *addr, size_t len, int prot, int flags,
+                           off_t offset, File *back);
+void vm_remove_region(VMRegion *region);
+void vm_destroy_region(VMRegion *region);
+VMRegion *vm_clone_regions(VMRegion *head);
+
+int verify_access(const void *addr, size_t len, int prot);
+
+#endif