summaryrefslogtreecommitdiffstats
path: root/common/misc.c
diff options
context:
space:
mode:
authorSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-09-26 15:24:51 +0200
committerSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-09-26 15:24:51 +0200
commit52473038dcff62c4f693680fcc7e53c822f52988 (patch)
tree9b5780c85b0c747ca973da4dcf8d2f0c0d5f5001 /common/misc.c
parent326e4bddc3d36a2afc2781e3018e2649d2be0680 (diff)
downloadbarebox-52473038dcff62c4f693680fcc7e53c822f52988.tar.gz
display malloc space on startup
Diffstat (limited to 'common/misc.c')
-rw-r--r--common/misc.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/common/misc.c b/common/misc.c
index 6171598..35fd8eb 100644
--- a/common/misc.c
+++ b/common/misc.c
@@ -26,26 +26,36 @@
/*
* Begin and End of memory area for malloc(), and current "brk"
*/
-static ulong mem_malloc_start = 0;
-static ulong mem_malloc_end = 0;
-static ulong mem_malloc_brk = 0;
+static ulong malloc_start = 0;
+static ulong malloc_end = 0;
+static ulong malloc_brk = 0;
+
+ulong mem_malloc_start(void)
+{
+ return malloc_start;
+}
+
+ulong mem_malloc_end(void)
+{
+ return malloc_end;
+}
void mem_malloc_init (void *start, void *end)
{
- mem_malloc_start = (ulong)start;
- mem_malloc_end = (ulong)end;
- mem_malloc_brk = mem_malloc_start;
+ malloc_start = (ulong)start;
+ malloc_end = (ulong)end;
+ malloc_brk = malloc_start;
}
void *sbrk_no_zero(ptrdiff_t increment)
{
- ulong old = mem_malloc_brk;
+ ulong old = malloc_brk;
ulong new = old + increment;
- if ((new < mem_malloc_start) || (new > mem_malloc_end))
+ if ((new < malloc_start) || (new > malloc_end))
return NULL;
- mem_malloc_brk = new;
+ malloc_brk = new;
return (void *)old;
}