summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdlib/malloc')
-rw-r--r--libc/stdlib/malloc/Makefile2
-rw-r--r--libc/stdlib/malloc/malloc.c8
2 files changed, 8 insertions, 2 deletions
diff --git a/libc/stdlib/malloc/Makefile b/libc/stdlib/malloc/Makefile
index fe3f8b424..0824e71a8 100644
--- a/libc/stdlib/malloc/Makefile
+++ b/libc/stdlib/malloc/Makefile
@@ -20,7 +20,7 @@
# other sundry sources. Files within this library are copyright by their
# respective copyright holders.
-TOPDIR=../
+TOPDIR=../../
include $(TOPDIR)Rules.make
LIBC=$(TOPDIR)libc.a
diff --git a/libc/stdlib/malloc/malloc.c b/libc/stdlib/malloc/malloc.c
index 1a0b61aa5..4ed9fe873 100644
--- a/libc/stdlib/malloc/malloc.c
+++ b/libc/stdlib/malloc/malloc.c
@@ -190,7 +190,13 @@ static void *hunk_alloc(int size)
if ((p = free_h[size]) == NULL)
{
if ((p = (Hunk_t*)mmap(HUNK_MSTART,HUNK_MSIZE,PROT_READ|PROT_WRITE,
- MAP_PRIVATE|MAP_ANON,0,0)) == (Hunk_t*)MAP_FAILED)
+#ifdef __HAS_NO_MMU__
+ MAP_PRIVATE|MAP_ANONYMOUS
+#else
+
+ MAP_SHARED|MAP_ANONYMOUS
+#endif
+ ,0,0)) == (Hunk_t*)MAP_FAILED)
return NULL;
memset(p,0,HUNK_MSIZE);
p->id = HUNK_ID;