#ifndef KERNEL_MEM_VM_H #define KERNEL_MEM_VM_H #include #include #include #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