From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Fri, 20 Nov 2015 17:26:12 +0100 Subject: [U-Boot] [PATCH v5] Fix board init code to respect the C runtime environment In-Reply-To: References: <1447690927-18871-1-git-send-email-albert.u.boot@aribaud.net> <20151117135932.1f7ef120@lilith> Message-ID: <20151120172612.49326273@lilith> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Simon, On Wed, 18 Nov 2015 18:05:07 -0700, Simon Glass wrote: > Hi Albert, > > >> early malloc() area > > > > "Arena", and "malloc arena", are established designations for the > > memory space used by malloc implementations; and I prefer to use this > > more specific term, as people may use it as a search keyword when > > looking for malloc related stuff. > > Arena is OK, but can you please mention 'early' each time? It's > confusing otherwise. I think we should have a clear distinction > between the early malloc() and full malloc(). Good point, will do. > If you can have it so that the stack top equals the global_data > bottom, then we should be OK. Will do that in v6. > > Note, however, that it will not simplify assembly code: it will turn a > > subtraction from sp into an assignment to sp, which is not simpler, and > > it will add an assignment to whatever register represents the first > > argument, since we'll turn a (void) function into a (ulong top) > > function, so all in all, it will add one assembly instruction with > > respect to the 'ulong board_init_f_get_reserve_size(void)' approach. > > True, but now we are just passing values around rather than doing > arithmetic in assembler. Well, at the C level an addition may be more complex than an assignment, but at the assembly level, that's pretty much equally simple. Anyway, the change is ok by me. > > gd works at this point, and I want to avoid any aliasing issue. > > I don't really understand that, but if you want to use gd I think it > would be worth a one-line comment. I believe it is already present in v5: + * ALSO IMPORTANT: + * + * On some architectures, gd will only be set once arch_setup_gd() is + * called. Therefore: + * + * Do not use 'gd->' until arch_setup_gd() has been called! I will expand that comment a bit, and add a one-liner in the code too. Thanks again for your comments! Amicalement, -- Albert.