[PATCH v3] malloc: dlmalloc: add an ability for the malloc to be re-init/init multiple times
trini at konsulko.com
Fri May 1 23:57:40 CEST 2020
On Wed, Apr 29, 2020 at 06:23:07PM +0200, marek.bykowski at gmail.com wrote:
> From: Marek Bykowski <marek.bykowski at gmail.com>
> Malloc gets initialized with a call to mem_malloc_init() with the address
> the allocation starts to and its size. Currently it is not possible to
> move the malloc from one memory area to another as the malloc would eventually
> This patch adds in the ability to re-init the malloc with the updated
> start address and the size.
> One of the use cases of this feature is SPL U-Boot running from within
> the static memory and calling to malloc init from within board_init_f():
> arch/arm/cpu/armv8/start.S:reset vector
> Shortly after the DDR (main) memory is init and ready we call to malloc init
> again but this time with the start address in the DDR memory and a much greater
> size for moving the allocation off the static to the DDR memory:
> Where CONFIG_SYS_SPL_MALLOC_START and CONFIG_SPL_MALLOC_OFFSET are the start
> addresses of the malloc in the static and DDR memories respectively and
> CONFIG_SYS_SPL_MALLOC_SIZE=SZ_16K and CONFIG_SPL_MALLOC_SIZE=SZ_2M are
> the sizes of the mallocs in these memories. Note, now we have a much greater
> memory, enlarging from 16K to 2M, available for allocation.
> There is an alternative approach already existing in U-Boot with the use of
> an early (simplified) malloc and the proper (dlamalloc) malloc however
> necessitating managing the two mallocs whereas this approach proposes using
> a single dlmalloc.
> Signed-off-by: Marek Bykowski <marek.bykowski at gmail.com>
Applied to u-boot/master, thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 659 bytes
Desc: not available
More information about the U-Boot