[U-Boot] [PATCH v3] DLMALLOC: make av_ initialization dynamic

Graeme Russ graeme.russ at gmail.com
Wed Oct 7 05:45:50 CEST 2009


On Wed, Oct 7, 2009 at 2:38 PM, Nishanth Menon <nm at ti.com> wrote:
> Remove the predefined static initialization
> and generate the map dynamically to reduce
> code size.
>
> This patch benefits were pointed out by Peter:
> http://www.nabble.com/forum/Permalink.jtp?root=25518020&post=25523748&page=y
>
> Additional comments from Graeme Russ on x86
> support to be removed:
> http://www.nabble.com/Re%3A--U-Boot---PATCH-v2--DLMALLOC%3A%21X86%3A-add-av_-initialization-p25779706.html
>
> Tested on SDP3430 ONLY. Following code seem to
> explicitly call this:
> lib_avr32/board.c
> lib_blackfin/board.c
> lib_m68k/board.c
> lib_mips/board.c
> lib_nios2/board.c
> lib_nios/board.c
> lib_ppc/board.c
> lib_sh/board.c
> lib_sparc/board.c
> These unfortunately could not be tested
>
> Signed-off-by: Nishanth Menon <nm at ti.com>
> Cc: Peter Tyser <ptyser at xes-inc.com>
> Cc: Graeme Russ <graeme.russ at gmail.com>
> Cc: Sandeep Paulraj <s-paulraj at ti.com>
> Cc: Tom Rix <tom.rix at windriver.com>
> ---
>  common/dlmalloc.c |   27 ++++++---------------------
>  1 files changed, 6 insertions(+), 21 deletions(-)
>
> diff --git a/common/dlmalloc.c b/common/dlmalloc.c
> index 241db8c..9039b3e 100644
> --- a/common/dlmalloc.c
> +++ b/common/dlmalloc.c

[snip]

> @@ -1520,20 +1502,23 @@ void *sbrk(ptrdiff_t increment)
>        return (void *)old;
>  }
>
> -#ifndef CONFIG_X86

This is unrelated to the commit message - Probably best to leave this as-is.

I will submit a patch to remove x86 specifics soon

>  /*
>  * x86 boards use a slightly different init sequence thus they implement
>  * their own version of mem_malloc_init()
>  */
>  void mem_malloc_init(ulong start, ulong size)
>  {
> +       u8 i;
> +       av_[0] = av_[1] = 0;
> +       for (i = 0; i < 128; i++)
> +               av_[2 + i * 2] = av_[2 + i * 2 + 1] = bin_at(i);
> +
>        mem_malloc_start = start;
>        mem_malloc_end = start + size;
>        mem_malloc_brk = start;
>
>        memset((void *)mem_malloc_start, 0, size);
>  }
> -#endif

Ditto

>
>  /* field-extraction macros */
>
> --
> 1.6.0.4
>
>


More information about the U-Boot mailing list