summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-01-12 10:53:48 +0000
committerEric Andersen <andersen@codepoet.org>2001-01-12 10:53:48 +0000
commitddaf94095891a21cedd6a18d9178e4444fb937a7 (patch)
treeb47bcefa33533e4f41ecce4e3a1bee1d215e006e /libc/stdlib/malloc
parent77879554671206102471bb282accb3251395d151 (diff)
Patch from James Graves <jgraves@deltamobile.com> to better handle m68k.
Also fixes 2 very important malloc bugs! Anyone using malloc (esp mmu-less) should update and recompile. -Erik
Diffstat (limited to 'libc/stdlib/malloc')
-rw-r--r--libc/stdlib/malloc/malloc.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libc/stdlib/malloc/malloc.c b/libc/stdlib/malloc/malloc.c
index b20c09390..fce529d80 100644
--- a/libc/stdlib/malloc/malloc.c
+++ b/libc/stdlib/malloc/malloc.c
@@ -495,7 +495,13 @@ static Block_t *bl_mapnew(size_t size)
map_size = PAGE_ALIGN(size);
pt = mmap(LARGE_MSTART, map_size, PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANON, 0, 0);
+#ifdef __HAS_NO_MMU__
+ MAP_SHARED | MAP_ANONYMOUS
+#else
+ MAP_PRIVATE | MAP_ANONYMOUS
+#endif
+ 0, 0);
+
if (pt == MAP_FAILED)
return (Block_t *) NULL;
@@ -517,7 +523,12 @@ void __bl_uncommit(Block_t * b)
#if M_DOTRIMMING
mmap(u_start, u_end - u_start, PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANON | MAP_FIXED, 0, 0);
+#ifdef __HAS_NO_MMU__
+ MAP_SHARED | MAP_ANONYMOUS |MAP_FIXED
+#else
+ MAP_PRIVATE | MAP_ANONYMOUS |MAP_FIXED
+#endif
+ 0, 0);
#endif
}