[uClinux-dev] problem understanding bootmem allocation

Thomas Eschenbacher Thomas.Eschenbacher at gmx.de
Tue Mar 4 14:02:00 EST 2003


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 - 
reserve_bootmem_node(pgdat, __pa(&_text),  &_etext - &_text);
reserve_bootmem_node(pgdat, __pa(&__data_start), &__data_end - 
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

Thomas Eschenbacher <Thomas.Eschenbacher at gmx.de> [LANG=de_DE | en_EN]

More information about the uClinux-dev mailing list