From 5e93bd1c9aaea886c5e5c7c1b6114ab36c30668f Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Fri, 21 Aug 2009 23:05:19 -0500 Subject: Consolidate arch-specific sbrk() implementations Signed-off-by: Peter Tyser --- common/dlmalloc.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 4a185620f9..f3bced463f 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -1502,7 +1502,23 @@ void malloc_bin_reloc (void) *p++ += gd->reloc_off; } } - + +ulong mem_malloc_start = 0; +ulong mem_malloc_end = 0; +ulong mem_malloc_brk = 0; + +void *sbrk(ptrdiff_t increment) +{ + ulong old = mem_malloc_brk; + ulong new = old + increment; + + if ((new < mem_malloc_start) || (new > mem_malloc_end)) + return NULL; + + mem_malloc_brk = new; + + return (void *)old; +} /* field-extraction macros */ -- cgit v1.2.1