add lunaix dynamic linker as submodule
[lunaix-os.git] / lunaix-os / kernel / mm / mmap.c
index 77e1264d2926661d78ea1ff335e030a250f5ccc5..8a4c9bc6af509a653477f61833b389b2ce9e549d 100644 (file)
@@ -7,8 +7,10 @@
 #include <lunaix/syscall.h>
 #include <lunaix/syscall_utils.h>
 
+#include <sys/mm/mempart.h>
+
 // any size beyond this is bullshit
-#define BS_SIZE (KERNEL_MM_BASE - UMMAP_START)
+#define BS_SIZE (KERNEL_EXEC - UMMAP_START)
 
 int
 mem_has_overlap(vm_regions_t* regions, ptr_t start, ptr_t end)
@@ -101,7 +103,7 @@ mem_map(void** addr_out,
     return ENOMEM;
 
 found:
-    if (found_loc >= KERNEL_MM_BASE || found_loc < USER_START) {
+    if (found_loc >= KERNEL_EXEC || found_loc < USER_START) {
         return ENOMEM;
     }
 
@@ -329,6 +331,7 @@ __DEFINE_LXSYSCALL3(void*, sys_mmap, void*, addr, size_t, length, va_list, lst)
 
     struct mmap_param param = { .flags = options,
                                 .mlen = ROUNDUP(length, PG_SIZE),
+                                .flen = length,
                                 .offset = offset,
                                 .type = REGION_TYPE_GENERAL,
                                 .proct = proct,