Hello Simon, On Tue, 10 Nov 2015 13:04:50 -0700, Simon Glass <s...@chromium.org> wrote:
> I'm hoping we don't have to bring back this assembler. What we need in ASM is just the part that actually alters the stack (i.e., changes the SP of the architecture) so that no C function has to do it. > Do we really need to put everything in separate functions? We need the (non-C) allocation code to be told the size to allocate and to pass the base address of the allocated space, so that makes two calls per allocated space, and there's GD and malloc, so four calls. Now, I created one function per call, but there are ways to use less than four functions. I could have specified the allocations sizes directly in crt0.S, but I agree that all we can do in C should be done in C, so I kept the size calculations in C functions. We could also reduce the score to one function for GD and one for malloc as follows: instead of calling one ulong(*)(void) to get the size and one void(*)(void*) to initialize the allocated space, we could call one ulong(*)(void*) twice, first with the void* equal to NULL (and the function then returns the size it needs allocated) and second with the void* equal to the base address of the allocated space (and the function can then initialize it). We could even reduce this to one single ulong(int chunk_id, void*) where chunk_id would be either CHUNK_GD or CHUNK_MALLOC), and the function would return the right size or do the right initializations for the chunk considered. Plus, if a new type of chunk should be allocated in addition to GD and the malloc arena, this could be handled by adding a new chunk_id and adding cases in the alloc function for size computation and chunk initialization. > Perhaps you could add a bit more detail in the commit message as to > what problem this solves? Will do in v3. > Regards, > Simon Amicalement, -- Albert. _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot