diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2013-01-24 06:27:54 +0000 |
---|---|---|
committer | Daniel Schwierzeck <daniel.schwierzeck@gmail.com> | 2013-01-27 16:40:07 +0100 |
commit | 248fe03f53772a61bb7355a4e45cd055dfdcf7b2 (patch) | |
tree | 5a33e8aaea4dbb51a30930f99309aba538202252 /arch/mips/cpu/mips32 | |
parent | b2fe86f8873088391d77224fb33544bc1e3b2c0a (diff) | |
download | u-boot-imx-248fe03f53772a61bb7355a4e45cd055dfdcf7b2.zip u-boot-imx-248fe03f53772a61bb7355a4e45cd055dfdcf7b2.tar.gz u-boot-imx-248fe03f53772a61bb7355a4e45cd055dfdcf7b2.tar.bz2 |
MIPS: start.S: simplify relocation offset calculation
The current code uses four instructions and a
temporary register to calculate the relocation
offset and to adjust the gp register.
The relocation offset can be calculated directly
from the CONFIG_SYS_MONITOR_BASE constant and from
the destination address. The resulting offset can
be used to adjust the gp pointer.
This approach makes the code a bit simpler because
it needs two instructions only.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Cc: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
Diffstat (limited to 'arch/mips/cpu/mips32')
-rw-r--r-- | arch/mips/cpu/mips32/start.S | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/arch/mips/cpu/mips32/start.S b/arch/mips/cpu/mips32/start.S index 64a606f..d67dafa 100644 --- a/arch/mips/cpu/mips32/start.S +++ b/arch/mips/cpu/mips32/start.S @@ -283,19 +283,13 @@ relocate_code: move s2, a2 # save destination address in s2 li t0, CONFIG_SYS_MONITOR_BASE + sub s1, s2, t0 # s1 <-- relocation offset + la t3, in_ram lw t2, -12(t3) # t2 <-- uboot_end_data move t1, a2 - /* - * Fix $gp: - * - * New $gp = (Old $gp - CONFIG_SYS_MONITOR_BASE) + Destination Address - */ - move t6, gp - sub gp, CONFIG_SYS_MONITOR_BASE - add gp, a2 # gp now adjusted - sub s1, gp, t6 # s1 <-- relocation offset + add gp, s1 # adjust gp /* * t0 = source address |