From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nishanth Menon Date: Tue, 6 Oct 2009 22:14:53 -0500 Subject: [U-Boot] [PATCH v2] DLMALLOC:!X86: add av_ initialization In-Reply-To: References: <1254881629-19027-1-git-send-email-nm@ti.com> Message-ID: <4ACC07AD.7070703@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Graeme Russ had written, on 10/06/2009 09:52 PM, the following: > On Wed, Oct 7, 2009 at 1:13 PM, Nishanth Menon 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 >> >> Signed-off-by: Nishanth Menon >> Cc: Peter Tyser >> Cc: Sandeep Paulraj >> Cc: Tom Rix >> --- >> common/dlmalloc.c | 9 +++++++++ >> 1 files changed, 9 insertions(+), 0 deletions(-) >> >> diff --git a/common/dlmalloc.c b/common/dlmalloc.c >> index 241db8c..25e5314 100644 >> --- a/common/dlmalloc.c >> +++ b/common/dlmalloc.c >> @@ -1474,6 +1474,7 @@ typedef struct malloc_chunk* mbinptr; >> >> #define IAV(i) bin_at(i), bin_at(i) >> >> +#ifdef CONFIG_X86 >> static mbinptr av_[NAV * 2 + 2] = { >> 0, 0, >> IAV(0), IAV(1), IAV(2), IAV(3), IAV(4), IAV(5), IAV(6), IAV(7), >> @@ -1493,6 +1494,9 @@ static mbinptr av_[NAV * 2 + 2] = { >> IAV(112), IAV(113), IAV(114), IAV(115), IAV(116), IAV(117), IAV(118), IAV(119), >> IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127) >> }; >> +#else >> +static mbinptr av_[NAV * 2 + 2]; >> +#endif > > Is there any reason why X86 is treated differently? I know the previous > patch to dlmalloc.c did, but in the end it really didn't need to and ended > up breaking the x86 build anyway (my fault for not getting time to test it > before it went mainline) > > Feel free to remove this #ifdef unless you are 100% sure it IS needed. > Mainline x86 is broken anyway - if this change introduces another break, I > will submit a consolidated fix soon I dont have any rationale to retain the #ifdef.. it is ugly.. will kick it out and send out a v3 of this patch in a short while. > >> void malloc_bin_reloc (void) >> { >> @@ -1527,6 +1531,11 @@ void *sbrk(ptrdiff_t increment) >> */ >> 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; >> -- >> 1.6.0.4 > > Regards, > > Graeme > -- Regards, Nishanth Menon