#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;
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
vmm_set_mapping(PD_REFERENCED,
PG_ALIGN(current_brk) + PG_SIZE + i,
0,
- PG_WRITE | user);
+ PG_WRITE | user,
+ VMAP_NULL);
}
}