+#include <lunaix/status.h>
+
+#include <lunaix/spike.h>
+#include <lunaix/syscall.h>
+
+__DEFINE_LXSYSCALL1(int, sbrk, size_t, size)
+{
+ heap_context_t* uheap = &__current->mm.u_heap;
+ mutex_lock(&uheap->lock);
+ void* r = lxsbrk(uheap, size, PG_ALLOW_USER);
+ mutex_unlock(&uheap->lock);
+ return r;
+}
+
+__DEFINE_LXSYSCALL1(void*, brk, void*, addr)
+{
+ heap_context_t* uheap = &__current->mm.u_heap;
+ mutex_lock(&uheap->lock);
+ int r = lxbrk(uheap, addr, PG_ALLOW_USER);
+ mutex_unlock(&uheap->lock);
+ return r;
+}
+
+int
+dmm_init(heap_context_t* heap)
+{
+ assert((uintptr_t)heap->start % BOUNDARY == 0);