[U-Boot-Users] why jump at absolute address in start.S

Wolfgang Denk wd at denx.de
Fri Jan 3 09:23:17 CET 2003

In message <2214.1041574514 at msa.cmst.csiro.au>
Murray Jensen wrote:
> On Fri, 03 Jan 2003 11:47:22 +0800, Laudney Ren <bren at sjtu.edu.cn> writes:
> >I'm reading cpu/mpc8xx/start.S and found the following:
> >         lis     r3, CFG_MONITOR_BASE at h
> >         ori     r3, r3, CFG_MONITOR_BASE at l
> >         addi    r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
> >         mtlr    r3
> >         blr
> >
> >Why do we need to calculate the absolutely address?
> >Why should we do it here, instead of everywhere?
> U-Boot (aka ppcboot - since you are looking at cpu/mpc8xx) is compiled using
> the "-mrelocatable" flag i.e. my understanding of this is that all text
> references will be relative so that the code may be relocated at run time.

The "-mrelocatable" thingy has nothing to do with this  part  of  the
code.  Also,  "-mrelocatable"  does _not_ mean that you can just copy
the code to a new address and jump into it - it just means  that  the
compiler  will  generate  enough  information (especially the GOT) so
that you can relocate the code _manually_.

> The bit of code above is special - at this point the CPU will be executing
> at whatever address the reset configuration dictates (for 8xx I think the CPU
> This code jumps to the address that the boot device will appear at after you
> program the memory controller registers, so that the boot device will not
> disappear out from underneath you.

_This_ is the correct explanation.


> To the extent permitted by law, CSIRO does not represent, warrant and/or
> guarantee that the integrity of this communication has been maintained or
> that the communication is free of errors, virus, interception or interference.
> The information contained in this e-mail may be confidential or privileged.
> Any unauthorised use or disclosure is prohibited. If you have received this
> e-mail in error, please delete it immediately and notify Murray Jensen on
> +61 3 9662 7763. Thank you.

Can you please shut off this crap when posting to public mailing lists?

Best regards, and a Happy New Year!

Wolfgang Denk

Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Never put off until tomorrow what you can put off indefinitely.

More information about the U-Boot mailing list