From b2d191e83337fbace1d5c389d2a00bcb1107c211 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 14 May 2014 10:23:18 +0200 Subject: bsps/sparc: Fix data copy in start procedure Use the register %g4 for the data content since it must be an even numbered register due to the std/ldd. Use the register %g2 for the BSS start address, so that it can be later re-used for the BSS zero loop. --- c/src/lib/libbsp/sparc/shared/start/start.S | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/c/src/lib/libbsp/sparc/shared/start/start.S b/c/src/lib/libbsp/sparc/shared/start/start.S index 26da7b49b8..a1b3ff086b 100644 --- a/c/src/lib/libbsp/sparc/shared/start/start.S +++ b/c/src/lib/libbsp/sparc/shared/start/start.S @@ -319,25 +319,25 @@ cpu0: * LENGTH: (__bss_start - _data_start) bytes */ - sethi %hi(_endtext),%g2 - or %g2,%lo(_endtext),%g2 ! g2 = start of initialized data in ROM + sethi %hi(_endtext),%g1 + or %g1,%lo(_endtext),%g1 ! g1 = start of initialized data in ROM sethi %hi(_data_start),%g3 or %g3,%lo(_data_start),%g3 ! g3 = start of initialized data in RAM - sethi %hi(__bss_start),%g4 - or %g4,%lo(__bss_start),%g4 ! g4 = end of initialized data in RAM + sethi %hi(__bss_start), %g2 + or %g2,%lo(__bss_start),%g2 ! g2 = end of initialized data in RAM - cmp %g2, %g3 + cmp %g1, %g3 be 1f nop copy_data: - ldd [ %g2 ], %g5 - std %g5 , [ %g3 ] ! copy this double word + ldd [%g1], %g4 + std %g4 , [%g3] ! copy this double word add %g3, 8, %g3 ! bump the destination pointer - add %g2, 8, %g2 ! bump the source pointer - cmp %g3, %g4 ! Is the pointer past the end of dest? + add %g1, 8, %g1 ! bump the source pointer + cmp %g3, %g2 ! Is the pointer past the end of dest? bl copy_data nop -- cgit v1.2.3