7 uintptr_t __brk(uintptr_t);
11 void *__simple_malloc(size_t n)
13 static uintptr_t cur, brk;
18 if (n > SIZE_MAX/2) goto toobig;
20 while (align<n && align<ALIGN)
22 n = n + align - 1 & -align;
25 if (!cur) cur = brk = __brk(0)+16;
26 base = cur + align-1 & -align;
27 if (n > SIZE_MAX - PAGE_SIZE - base) goto fail;
29 new = base+n + PAGE_SIZE-1 & -PAGE_SIZE;
30 if (__brk(new) != new) goto fail;
45 weak_alias(__simple_malloc, malloc);