refactor: decouple the executable file implementations with execve functionality.
[lunaix-os.git] / lunaix-os / includes / lunaix / mm / mmap.h
index fffed078241b8c07aa2a4e370e58cf2ef4d87ed0..f85302e339b8d14056b9a1b3661608c6ff933ace 100644 (file)
@@ -5,20 +5,36 @@
 #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_adjust_inplace(vm_regions_t* regions,
+                   struct mm_region* region,
+                   ptr_t newend);
+
 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,