[U-Boot-Users] relocate_code
YanMin Qiao
sepherosa at sohu.com
Fri Jan 3 17:22:21 CET 2003
<u-boot>/cpu/mpc8xx/start.S
....
....
.globl relocate_code
relocate_code:
mr r1, r3 /* Set new stack pointer */
mr r9, r4 /* Save copy of Global Data pointer */
mr r10, r5 /* Save copy of Destination Address */
....
cmplw cr1,r3,r4
addi r0,r5,3
srwi. r0,r0,2
beq cr1,4f /* In place copy is not necessary */
beq 7f /* Protect against 0 count */
mtctr r0
bge cr1,2f
^^^^^^^^^^ why we need to differeciate the two situation,
addr>CFG_MONITOR_BASE
and addr<=CFG_MONITOR_BASE
la r8,-4(r4)
la r7,-4(r3)
1: lwzu r0,4(r8)
stwu r0,4(r7)
bdnz 1b
b 4f
2: slwi r0,r0,2 <<----------------- i think above code will
be enough for the two
add r8,r4,r0 situation
add r7,r3,r0
3: lwzu r0,-4(r8)
stwu r0,-4(r7)
bdnz 3b
....
....
thnx
best regards
More information about the U-Boot
mailing list