[U-Boot] [PATCH v11 5/9] nds32/lib: add generic funcs in NDS32 lib
馬克泡
macpaul at gmail.com
Tue Sep 6 08:41:47 CEST 2011
Hi, Mike and Wolfgang,
2011/9/1 Mike Frysinger <vapier at gentoo.org>:
> On Thursday, September 01, 2011 01:52:46 Macpaul Lin wrote:
[... skipped and will discuss these later]
>> +void board_init_f(ulong bootflag)
>> +{
>> ...
>> + /* Pointer is writable since we allocated a register for it */
>> + gd = (gd_t *) ((CONFIG_SYS_INIT_SP_ADDR) & ~0x07);
>> +
>> + /* compiler optimization barrier needed for GCC >= 3.4 */
>> + __asm__ __volatile__("" : : : "memory");
>> +
>> + memset((void *)gd, 0, sizeof(gd_t));
>
> err, is that barrier really needed ? sounds like a bug in your compiler.
I'm not sure if this is really a bug which has been fixed or this is
still a common problem.
I've found there are architectures x86, mips, m68k, nios2, powerpc
have this code to do
optimization barrier.
I'll try to verify this with our toolchain department, but I think
this might be a common problem.
Could someone give a comment on this?
> as for the memset, it should be:
> memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
It's the similar case.
Since we have generated header file for global data, this code might be good.
However, there are other architecture remain the same code which do
memset with sizeof(gd_t).
Included m68k, sparc, arm, avr32 and powerpc.
Do I miss something of the discussion before in the mailing list?
Should these also be a clean up for other architectures, too?
>
>> + addr_sp -= sizeof(bd_t);
>
> sizeof(bd_t) -> GENERATED_BD_INFO_SIZE
>
> this shows up multiple times
>
> also, did i miss something, or do you not zero out your board info ?
>
>> + addr_sp -= sizeof(gd_t);
>
> sizeof(gd_t) -> GENERATED_GBL_DATA_SIZE
>
> this shows up multiple times
> -mike
>
No, I didn't zero out the board info just like the implementation of
other architecture.
Dose this lead a problem?
--
Best regards,
Macpaul Lin
More information about the U-Boot
mailing list