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

Jerry Van Baren gerald.vanbaren at smiths-aerospace.com
Fri Jan 3 14:44:09 CET 2003


At 09:19 PM 1/3/2003 -0500, bren at sjtu.edu.cn wrote:
>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:
>  >>
>  >>       /*
>  >>         * Calculate absolute address in FLASH and jump there
>  >>         */
>  >>
>  >>        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?
>  >

Another part of the puzzle for doing an absolute address jump is because 
the PowerPC relative jump is limited 24 bits (+/- 8Mbytes).  If you are 
jumping to a location beyond the 24 bit jump range, for instance if your 
vector is at 0x100 but your ultimate u-boot code will be based at 
0x80000000 (to pick an arbitrary example to illustrate the problem), a 
relative jump won't get you there.  Since u-boot doesn't know a priori 
where the addresses will be on a given piece of hardware, this is the safe 
and effective method of getting to the right place on every system.

Once you get to your final destination, relative addresses are fine since 
Wolfgang will never let u-boot code exceed 8Mbytes :-).

gvb



**********************************************************************
This e-mail and any files transmitted with it are confidential and may
be legally privileged or otherwise exempt from disclosure under
applicable law. This e-mail and its files are intended solely for
the individual or entity to whom they are addressed and their content
is the property of Smiths Aerospace.  If you are not the intended
recipient, please do not read, copy, use or disclose this communication.
If you have received this e-mail in error please notify the e-mail 
administrator at postmaster at si.com and then delete this e-mail, its
files and any copies.

This footnote also confirms that this e-mail message has been scanned
for the presence of known computer viruses.
***********************************************************************





More information about the U-Boot mailing list