[uClinux-dev] problem understanding bootmem allocation

thomas chen tchen at on-go.com
Tue Mar 4 15:21:40 EST 2003


i had the same problem a while back.... i just looked at how i did
that...

in arch/armnommu/mm/init.c

i did 
reserve_bootmem_node(pgdat, 0, &_end)

instead of 
reserve_bootmem_node(pgdat, &_text, &_end)

since _text is where TEXTADDR is... (for me 0x1000 above those
vectores)... this change will reserve everything below 0x1000
also, otherwise, if your RAM is configured to start from 0,
memory allocation somewhere would return 0 as the starting addres
of the block, but the calling program would think it is NULL...

sorry... i did not take good note and this is all i can remember, but
it does work for me since... (but this was done a while back)



Thomas Eschenbacher wrote:
> 
> Hi,
> 
> I need some help in understanding the bootmem allocation subsystem. Is
> there some documentation available or should I just ask on this list?
> 
> We still have problems in getting the memory setup right, so I decided
> to start making the bootmem stuff more "generic" so that it also works
> with different memory setups and not only for me.
> 
> The ideal case should be that init, text, data and bss can be whereever
> they want and DRAM at any other area, maybe overlapping with any
> combination of the segments listed before.
> 
> The state now is that things do not work when DRAM_START is at zero and
> the code is somewhere above. Setting PAGE_OFFSET to 64kB did not help
> (I'm running on armnommu, kernel 2.4 from CVS), it's just not enough.
> 
> Just as an example:
> in arch/armnommu/mm/init.c, function "reserve_node_zero" the call to
> 
> reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext);
> 
> fails terribly, because _end is the end of .bss and thus below our
> kernel code at _stext => the resulting size is negative!!!
> 
> I split this up into four calls:
> ------------------------------------------
> reserve_bootmem_node(pgdat, __pa(&__init_begin), &__init_end -
> __init_begin);
> reserve_bootmem_node(pgdat, __pa(&_text),  &_etext - &_text);
> reserve_bootmem_node(pgdat, __pa(&__data_start), &__data_end -
> &__data_start);
> reserve_bootmem_node(pgdat, __pa(&__bss_start), &__bss_end - &__bss_start);
> ------------------------------------------
> 
> and defined some missing symbols like __data_start in the linker script.
> Is that okay?
> 
> I also have problems with the following call to reserve_bootmem_node, as
> seen in mmnommu/bootmem.c. It calls "reserve_bootmem_core(pgdat->bdata,
> physaddr, size);" - but pgdat->bdata is a NULL pointer! What goes wrong
> here???
> 
> thanks,
>     Thomas
> --
> ________________________________________________________________________
> Thomas Eschenbacher <Thomas.Eschenbacher at gmx.de> [LANG=de_DE | en_EN]
> 
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev at uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev at uclinux.org



More information about the uClinux-dev mailing list