
Dear Albert ARIBAUD,
On 11 January 2011 02:21, Albert ARIBAUD albert.aribaud@free.fr wrote:
Le 10/01/2011 15:04, Minkyu Kang a écrit :
How about lcd_setmem function? panel_info is located at bss area, but lcd_setmem access this structure. Is it illegal?
This must not be done before relocation.
No, please see 360 line of arch/arm/lib/board.c This function is called before relocation.
Then it cannot access panel_info, which is "not there yet" at the time lcd_setmem() executes.
No, access for reserve the memory for LCD and we got wrong values. Did you test about it?
You must either move the call to lcd_setmem() to after relocation, or find a way not to depend on BSS.
This problem is not belong to my code. Move after relocation? it's easy. but, how we can reserve the memory for LCD?
And how about init_func_i2c()? This function is called twice, before the relocation and after relocation. When we use board_i2c_init function then, there is possibility that use symbols in bss because of this function is called after relocation.
If it is used both before and after relocation, then it has to respect the strictest case, which is before relocation, and not access BSS.
If we ignore this exception, it will be a big constraint.
btw, there are any side effects on my patch? I think.. It is just a little safety feature.
Regardless of the patch, if your code writes to panel_info or any other BSS variable before relocation it will trash the relocation tables that exist at BSS location at this point.
IOW, accessing BSS before relocation is forbidden, not just out of fancy, but for a serious reason.
This patch is not for accessing BSS before relocation, it's for prevent exceptions.
Thanks Minkyu Kang