summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc-simple
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdlib/malloc-simple')
-rw-r--r--libc/stdlib/malloc-simple/Makefile2
-rw-r--r--libc/stdlib/malloc-simple/alloc.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/libc/stdlib/malloc-simple/Makefile b/libc/stdlib/malloc-simple/Makefile
index c2f8827b5..e46415536 100644
--- a/libc/stdlib/malloc-simple/Makefile
+++ b/libc/stdlib/malloc-simple/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-simple/alloc.c b/libc/stdlib/malloc-simple/alloc.c
index cf4835c97..f31105d4e 100644
--- a/libc/stdlib/malloc-simple/alloc.c
+++ b/libc/stdlib/malloc-simple/alloc.c
@@ -67,8 +67,12 @@ void *calloc(size_t num, size_t size)
void *malloc(size_t len)
{
void *result = mmap((void *) 0, len, PROT_READ | PROT_WRITE,
- //MAP_SHARED | MAP_ANONYMOUS, 0, 0);
- MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+#ifdef __HAS_NO_MMU__
+ MAP_SHARED | MAP_ANONYMOUS, 0, 0
+#else
+ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0
+#endif
+ );
if (result == (void *) -1)
return 0;