
in case we are still at relocation target address before relocation we do not need to load the registers needed for relocation. We should instead skip the whole relocation part and jump over to clear_bss.
Also prepare to not use target address twice. When we use a scratch register here r6 is unchanged and can be used later on.
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com --- arch/arm/cpu/arm920t/start.S | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/arm/cpu/arm920t/start.S b/arch/arm/cpu/arm920t/start.S index 01edb9b..71de373 100644 --- a/arch/arm/cpu/arm920t/start.S +++ b/arch/arm/cpu/arm920t/start.S @@ -208,15 +208,16 @@ stack_setup: mov sp, r4
adr r0, _start + cmp r0, r6 + beq clear_bss /* skip relocation */ + mov r1, r6 ldr r2, _TEXT_BASE ldr r3, _bss_start_ofs add r2, r0, r3 /* r2 <- source end address */ - cmp r0, r6 - beq clear_bss
copy_loop: ldmia r0!, {r9-r10} /* copy from source address [r0] */ - stmia r6!, {r9-r10} /* copy to target address [r1] */ + stmia r1!, {r9-r10} /* copy to target address [r1] */ cmp r0, r2 /* until source end address [r2] */ blo copy_loop