feat: (iso9660) finishing up unmount
[lunaix-os.git] / lunaix-os / kernel / mm / dmm.c
index cb87202e82c33c18a373dcffb5f7def06bbca515..edc28efadeb77ec6f7c16b2a16a038849f9ef84d 100644 (file)
@@ -24,8 +24,6 @@
 #include <lunaix/spike.h>
 #include <lunaix/syscall.h>
 
-extern void __kernel_heap_start;
-
 __DEFINE_LXSYSCALL1(int, sbrk, size_t, size)
 {
     heap_context_t* uheap = &__current->mm.u_heap;
@@ -52,13 +50,11 @@ dmm_init(heap_context_t* heap)
     heap->brk = heap->start;
     mutex_init(&heap->lock);
 
-    int perm = PG_ALLOW_USER;
-    if (heap->brk >= &__kernel_heap_start) {
-        perm = 0;
-    }
-
-    return vmm_set_mapping(PD_REFERENCED, heap->brk, 0, PG_WRITE | perm) !=
-           NULL;
+    return vmm_set_mapping(PD_REFERENCED,
+                           heap->brk,
+                           0,
+                           PG_WRITE | PG_ALLOW_USER,
+                           VMAP_NULL) != NULL;
 }
 
 int
@@ -93,7 +89,8 @@ lxsbrk(heap_context_t* heap, size_t size, int user)
             vmm_set_mapping(PD_REFERENCED,
                             PG_ALIGN(current_brk) + PG_SIZE + i,
                             0,
-                            PG_WRITE | user);
+                            PG_WRITE | user,
+                            VMAP_NULL);
         }
     }