diff options
author | Juergen Beisert <jbe@pengutronix.de> | 2009-12-10 13:09:02 +0100 |
---|---|---|
committer | Juergen Beisert <jbe@pengutronix.de> | 2009-12-10 13:09:02 +0100 |
commit | 5ed894e9a64ab5acd149184c1ac8edae6057bc8b (patch) | |
tree | c64d1c8c44b38e8ec13db0bbbdd45b4774597df1 /common/misc.c | |
parent | e0a2f39561081bdc8101e4232f91fd60220dea07 (diff) | |
download | barebox-5ed894e9a64ab5acd149184c1ac8edae6057bc8b.tar.gz barebox-5ed894e9a64ab5acd149184c1ac8edae6057bc8b.tar.xz |
Combine memory initialization with the main memory functions.
Memory allocation is very simple in u-boot-v2. So, it makes also sense to
add the "operating system" emulation layer into the main memory management
source file, to keep them at one place and simple.
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Diffstat (limited to 'common/misc.c')
-rw-r--r-- | common/misc.c | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/common/misc.c b/common/misc.c index 6754696598..b3292d3120 100644 --- a/common/misc.c +++ b/common/misc.c @@ -20,57 +20,8 @@ */ #include <common.h> -#include <mem_malloc.h> #include <errno.h> -/* - * Begin and End of memory area for malloc(), and current "brk" - */ -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) -{ - malloc_start = (ulong)start; - malloc_end = (ulong)end; - malloc_brk = malloc_start; -} - -void *sbrk_no_zero(ptrdiff_t increment) -{ - ulong old = malloc_brk; - ulong new = old + increment; - - if ((new < malloc_start) || (new > malloc_end)) - return NULL; - - malloc_brk = new; - - return (void *)old; -} - -void *sbrk (ptrdiff_t increment) -{ - void *old = sbrk_no_zero(increment); - - /* Only clear increment, if valid address was returned */ - if (old != NULL) - memset (old, 0, increment); - - return old; -} - int errno; EXPORT_SYMBOL(errno); |