feat: heap support and re-worked
[lunaix-os.git] / lunaix-os / includes / lunaix / mm / mmap.h
index fffed078241b8c07aa2a4e370e58cf2ef4d87ed0..ff1e443c9c8d5ab7178a2912bc12cbcfc9e56bff 100644 (file)
@@ -5,20 +5,31 @@
 #include <lunaix/mm/region.h>
 #include <lunaix/types.h>
 
+struct mmap_param
+{
+    ptr_t vms_mnt;        // vm mount point
+    struct proc_mm* pvms; // process vm
+    off_t offset;         // mapped file offset
+    size_t mlen;          // mapped memory length
+    size_t flen;          // mapped file length
+    u32_t proct;          // protections
+    u32_t flags;          // other options
+    u32_t type;           // region type
+};
+
 int
 mem_map(void** addr_out,
-        ptr_t mnt,
-        vm_regions_t* regions,
+        struct mm_region** created,
         void* addr,
         struct v_file* file,
-        off_t offset,
-        size_t length,
-        u32_t proct,
-        u32_t options);
+        struct mmap_param* param);
 
 int
 mem_unmap(ptr_t mnt, vm_regions_t* regions, void* addr, size_t length);
 
+void
+mem_unmap_region(ptr_t mnt, struct mm_region* region);
+
 void
 mem_sync_pages(ptr_t mnt,
                struct mm_region* region,