why does "board_init_r()" accept a second arg of "ulong dest_addr"?
was tracing the ARM-based boot sequence and ended up at the call toboard_init_r():
void board_init_r(gd_t *new_gd, ulong dest_addr)
{
/*
* Set up the new global data pointer. So far only x86 does this
* here.
* TODO(sjg at chromium.org): Consider doing this for all archs, or
* dropping the new_gd parameter.
*/
... snip ...
but as i read board_init_r(), it's not clear what that routine is doing with that second argument, "dest_addr".
there is no explicit reference to that argument in that routine that
i can see. i backtracked to arch/arm/lib/crt0.S to see the setup for the call:
/* call board_init_r(gd_t *id, ulong dest_addr) */
mov r0, r9 /* gd_t */
ldr r1, [r9, #GD_RELOCADDR] /* dest_addr */
/* call board_init_r */
#if CONFIG_IS_ENABLED(SYS_THUMB_BUILD)
ldr lr, =board_init_r /* this is auto-relocated! */
bx lr
#else
ldr pc, =board_init_r /* this is auto-relocated! */
#endif
/* we should not return here. */#endif
so i can see the assignment to registers r0 and r1, and thought maybe there's something down the road that expects that argument explicitly in r1 but i can't tell.
i'm currently reading doc/README.arm-relocation to see if i've
overlooked something trivially obvious, but is there a simple explanation as to the purpose of that second argument being passed to board_init_r()?
rday
Signature · 7 lines
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================Hi Robert,
Quoted 35 lines · Robert P. J. Day
was tracing the ARM-based boot sequence and ended up at the call to
board_init_r():void
board_init_r(gd_t *new_gd, ulong dest_addr)
{
/*
* Set up the new global data pointer. So far only x86 does this
* here.
* TODO(sjg at chromium.org): Consider doing this for all archs, or
* dropping thenew_gdparameter.
*/
... snip ...but as i read
board_init_r(), it's not clear what that routine is doing with that second argument, "dest_addr".there is no explicit reference to that argument in that routine that
i can see. i backtracked toarch/arm/lib/crt0.Sto see the setup for the call:/* call board_init_r(gd_t *id, ulong dest_addr) */ mov r0, r9 /* gd_t */ ldr r1, [r9, #GD_RELOCADDR] /* dest_addr */ /* call board_init_r */ #if CONFIG_IS_ENABLED(SYS_THUMB_BUILD) ldr lr, =board_init_r /* this is auto-relocated! */ bx lr #else ldr pc, =board_init_r /* this is auto-relocated! */ #endif /* we should not return here. */#endif
Quoted 8 lines
so i can see the assignment to registers r0 and r1, and thought maybe there's something down the road that expects that argument explicitly in r1 but i can't tell.
i'm currently reading doc/README.arm-relocation to see if i've
overlooked something trivially obvious, but is there a simple explanation as to the purpose of that second argument being passed toboard_init_r()?
I believe this is not used. The value is available in gd->dest_addr and we now read it from there.
So perhaps this argument could be dropped.
Regards,
Simon
Quoted 20 lines · Simon Glass
Hi Robert,
Quoted 17 lines · Robert P. J. Day
was tracing the ARM-based boot sequence and ended up at the call to
board_init_r():void
board_init_r(gd_t *new_gd, ulong dest_addr)
{
/*
* Set up the new global data pointer. So far only x86 does this
* here.
* TODO(sjg at chromium.org): Consider doing this for all archs, or
* dropping thenew_gdparameter.
*/
... snip ...but as i read
board_init_r(), it's not clear what that routine is doing with that second argument, "dest_addr".
... snip ...
Quoted 4 lines
I believe this is not used. The value is available in
gd->dest_addrand we now read it from there.So perhaps this argument could be dropped.
massive sigh of relief here as i was totally prepared for a response
like, "oh, come on, how can you not see how it's being used?" :-)
anyway, i can take a shot at a patch unless someone else wants to do
it. i'm just relieved that it wasn't that dumb a question after all.
rday
Signature · 7 lines
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================Quoted 28 lines · Robert P. J. Day
Quoted 20 lines · Simon Glass
Hi Robert,
Quoted 17 lines · Robert P. J. Day
was tracing the ARM-based boot sequence and ended up at the call to
board_init_r():void
board_init_r(gd_t *new_gd, ulong dest_addr)
{
/*
* Set up the new global data pointer. So far only x86 does this
* here.
* TODO(sjg at chromium.org): Consider doing this for all archs, or
* dropping thenew_gdparameter.
*/
... snip ...but as i read
board_init_r(), it's not clear what that routine is doing with that second argument, "dest_addr".... snip ...
Quoted 3 lines
I believe this is not used. The value is available in
gd->dest_addrand we now read it from there.
Quoted 7 lines
Quoted 1 line
So perhaps this argument could be dropped.
massive sigh of relief here as i was totally prepared for a response
like, "oh, come on, how can you not see how it's being used?" :-)anyway, i can take a shot at a patch unless someone else wants to do
it. i'm just relieved that it wasn't that dumb a question after all.
i take it back ... there are, of course, calls to board_init_r()
from all over the place, across all architectures, so if someone higher up the food chain wants to do something about that, that's fine -- all i needed to confirm was that that second argument wasn't doing anything. thanks. movin' on ...
rday
Signature · 7 lines
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================