Merge branch 'master' into iso-9660
[lunaix-os.git] / lunaix-os / kernel / mm / dmm.c
index 44f0f9e897d2d176a65c260f38744fb3aa3a4c6a..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, VMAP_NULL) != NULL;
+    return vmm_set_mapping(PD_REFERENCED,
+                           heap->brk,
+                           0,
+                           PG_WRITE | PG_ALLOW_USER,
+                           VMAP_NULL) != NULL;
 }
 
 int