[U-Boot] why does "board_init_r()" accept a second arg of "ulong dest_addr"?

Robert P. J. Day rpjday at crashcourse.ca
Fri Apr 12 12:31:46 UTC 2019

  was tracing the ARM-based boot sequence and ended up at the call to

  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 */
        ldr     lr, =board_init_r       /* this is auto-relocated! */
        bx      lr
        ldr     pc, =board_init_r       /* this is auto-relocated! */
        /* we should not return here. */

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



Robert P. J. Day                                 Ottawa, Ontario, CANADA

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday

More information about the U-Boot mailing list