| 123456789101112131415161718192021222324252627 | /* * sbrk allocator */#include <stddef.h>#include <errno.h>#include "sys.h"#include "common.h"#define HEAP_SIZE	(4 << 20) /* 4 MB */static char __attribute__((section(".heap"))) __heap[HEAP_SIZE];static char *cur_brk = __heap;void *_sbrk(size_t increment){    char *old_brk = cur_brk;    char *new_brk = old_brk + increment;    if (unlikely(new_brk > &__heap[HEAP_SIZE])) {	errno = ENOMEM;	return (void *)(-1);    }    cur_brk = new_brk;    return old_brk;}
 |