Skip to contentSkip to conversation

why jump at absolute address in start.S

U-Boot-Users Jerry Van Baren 1 participant 1 message Jan 3, 2003 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 16 lines · bren at sjtu.edu.cn
Quoted 1 line · Murray Jensen

On Fri, 03 Jan 2003 11:47:22 +0800, Laudney Ren <[email protected]>

Quoted 13 lines · writes:
Quoted 13 lines

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

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

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.
***********************************************************************