Merge branch 'master' of github.com:Minep/lunaix-os
[lunaix-os.git] / lunaix-os / kernel / mm / dmm.c
index cb87202e82c33c18a373dcffb5f7def06bbca515..651c6fce6c8852229e256e1dc0300b0a3c841ca2 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;
@@ -53,12 +51,12 @@ dmm_init(heap_context_t* heap)
     mutex_init(&heap->lock);
 
     int perm = PG_ALLOW_USER;
-    if (heap->brk >= &__kernel_heap_start) {
+    if (heap->brk >= KHEAP_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 | perm, VMAP_NULL) != NULL;
 }
 
 int
@@ -93,7 +91,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);
         }
     }