[PATCH 10/12] ARM: add early malloc support needed by the decompressor
Sascha Hauer
s.hauer at pengutronix.de
Mon Jul 30 05:20:44 EDT 2012
On Mon, Jul 30, 2012 at 11:04:43AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > > > > /* clear bss */
> > > > > > > memset(__bss_start, 0, __bss_stop - __bss_start);
> > > > > > >
> > > > > > > + /* set 128 KiB before the STACK_BASE - 16 address for early malloc */
> > > > > > > + free_mem_ptr = STACK_BASE - 0x20000 - 16;
> > > > > > > + free_mem_end_ptr = STACK_BASE - 16;
> > > > > > > +
> > > > > >
> > > > > > This assumes that the malloc area is directly before the stack. How
> > > > > > about using __bss_stop or _end instead?
> > > > >
> > > > > it's just for early alloc and __bss_stop no so maybe we can use the same as
> > > > > Malloc but we already use this for HEAD_TEXT_BASE
> > > >
> > > > _end is HEAD_TEXT_BASE + the space needed for the compressed
> > > > image, so what's wrong with it?
> > > the pbl image can be stored in a sram and link to fit there so _end could be
> > > at the end of the sram
> > >
> > > so we can not use it.
> > >
> > > We need to put the early malloc in the sdram
> >
> > HEAD_TEXT_BASE is in sdram, because it's the same as MALLOC_BASE, so
> > _end by definition also is in sdram.
> yes but pbl fill the sram fully so in my case I put HEAD_TEXT_BASE is sram not
> sdram so no space for the MALLOC and MALLOC_BASE is in sdram
Ok, then the assumption that HEAD_TEXT_BASE is always in sdram is wrong.
We can live with this until you add your at91 support. Nevertheless
MALLOC_BASE always is in sdram, so I suggest to use the last 128k of the
malloc space for early malloc:
free_mem_ptr = MALLOC_BASE + MALLOC_SIZE - SZ_128K
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list