summaryrefslogtreecommitdiffstats
path: root/common/memory.c
diff options
context:
space:
mode:
authorAntony Pavlov <antonynpavlov@gmail.com>2011-12-08 18:03:49 +0400
committerSascha Hauer <s.hauer@pengutronix.de>2011-12-23 11:26:42 +0100
commitb25bb1f0726bf81aa1af52bd1eca63b51c907bcf (patch)
treeadcf5b4eaffbd1a516789735d783a36614a2cba0 /common/memory.c
parent282af094a6ec8e5eab5e134704fe2e0da0eef9f2 (diff)
downloadbarebox-b25bb1f0726bf81aa1af52bd1eca63b51c907bcf.tar.gz
add tlsf-based malloc implementation
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/memory.c')
-rw-r--r--common/memory.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/memory.c b/common/memory.c
index f0ae1cc..faff33b 100644
--- a/common/memory.c
+++ b/common/memory.c
@@ -47,11 +47,19 @@ unsigned long mem_malloc_end(void)
return malloc_end;
}
+#ifdef CONFIG_MALLOC_TLSF
+#include <tlsf.h>
+tlsf_pool tlsf_mem_pool;
+#endif
+
void mem_malloc_init(void *start, void *end)
{
malloc_start = (unsigned long)start;
malloc_end = (unsigned long)end;
malloc_brk = malloc_start;
+#ifdef CONFIG_MALLOC_TLSF
+ tlsf_mem_pool = tlsf_create(start, (char *)end - (char *)start);
+#endif
}
#ifndef __SANDBOX__