[U-Boot] early_malloc outline
Tomas Hlavacek
tmshlvck at gmail.com
Wed Aug 1 17:19:40 CEST 2012
Dear Wolfgang,
On Tue, Jul 31, 2012 at 9:52 PM, Wolfgang Denk <wd at denx.de> wrote:
>> Can/should we use some existing mechanism? Or would it be considered a
>> viable option to choose different beginning address for early heap,
>> use it (in architecture-specific way) and keep the pointer to the
>> beginning in GD. Then copy the early heap to memory before caches are
>> flushed and in case of DM copy again data from early heap to new
>> destinations that has been obtained through malloc() when it is
>> initialized?
>
> It is difficult (or actually impossible) to answer this, if you do not
> explain which concept you are talking about here, or why two copy
> operations would be needed, what "in case of DM" means (and which
> other cases exist), or how you intend to handle the problem of
> changing addresses (and thus pointers becoming incorrect) for each of
> such copy operations.
I have been given an advice by Graeme not to make early_malloc() as
one-purpose thing for DM (i.e. not to implement DM tree relocation or
special support for doing so in early_malloc routines).
Other guys working on DM wants AFAIK to create DM tree using
early_malloc inside board_init_f(). The tree is going to have root and
on some boards few extra elements, like 2 or 3 in this phase and each
object has 16 bytes. Then they want to have this tree accessible (or
at least a copy of the tree) in board_init_r(). They want to traverse
the tree (by recomputing pointers) at some point in board_init_r(),
allocate new tree objects using dlmalloc and copy the data into the
new tree.
The concept I am thinking about is reserving space for early heap
right after GD by same platform specific means (i.e. subtracting
CONFIG_SYS_INIT_SP_ADDR). Then I would like to reserve space in RAM
equal to used size of early_heap before relocation and memcpy the
existing early_heap there (the same way GD are copied). Therefore we
would have a copy of used early_heap in RAM and we can recompute
pointers to traverse the tree in board_init_r().
Tomas
--
Tomáš Hlaváček <tmshlvck at gmail.com>
More information about the U-Boot
mailing list