summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc/malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdlib/malloc/malloc.c')
-rw-r--r--libc/stdlib/malloc/malloc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libc/stdlib/malloc/malloc.c b/libc/stdlib/malloc/malloc.c
index 5ba552d25..e4523adb2 100644
--- a/libc/stdlib/malloc/malloc.c
+++ b/libc/stdlib/malloc/malloc.c
@@ -103,8 +103,13 @@ malloc_from_heap (size_t size, struct heap *heap)
#else /* !MALLOC_USE_SBRK */
/* Otherwise, use mmap. */
- block = mmap (0, block_size, PROT_READ | PROT_WRITE,
+#ifdef __ARCH_HAS_MMU__
+ block = mmap ((void *)0, block_size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+#else
+ block = mmap ((void *)0, block_size, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_ANONYMOUS, 0, 0);
+#endif
#endif /* MALLOC_USE_SBRK */