mirror of
https://github.com/linux-sunxi/u-boot-sunxi.git
synced 2024-02-12 11:16:03 +08:00
Consolidate arch-specific sbrk() implementations
Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
This commit is contained in:

committed by
Wolfgang Denk

parent
65f6f07b72
commit
5e93bd1c9a
@ -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 */
|
||||
|
||||
|
Reference in New Issue
Block a user