[rtems commit] bsps/sparc: Remove support to load data section

Sebastian Huber sebh at rtems.org
Thu Jun 10 06:11:04 UTC 2021


Module:    rtems
Branch:    master
Commit:    07f6a61d034d715e0340b6ffcffffa6dc6034662
Changeset: http://git.rtems.org/rtems/commit/?id=07f6a61d034d715e0340b6ffcffffa6dc6034662

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Jun  8 08:13:54 2021 +0200

bsps/sparc: Remove support to load data section

Remove the support to load the data section and rely on the boot loader.  The
code is an artifact from the old erc32 days, when we would boot and execute
from ROM and the .data had to be copied over to RAM.  With leon1/2/3, this is
not used anymore as a boot loader is made from the RAM image using a custom
tool (mkprom).

In SMP configurations, this support was also broken since LEON3_Boot_Cpu
(in the data section due to the -1 initialization value) was used quite
early in the start sequence.

If the data copy is really necessary, then an application can still add this
step as a very early system initialization step, since boot_card() and the
system initialization loop does not use initialized read-write data (only
read-only and BSS data).  However, the SMP startup would still not work in this
case.  A boot loader is a better place to load the sections.

---

 bsps/sparc/shared/start/start.S | 36 ++++--------------------------------
 1 file changed, 4 insertions(+), 32 deletions(-)

diff --git a/bsps/sparc/shared/start/start.S b/bsps/sparc/shared/start/start.S
index f7caacf..369ef72 100644
--- a/bsps/sparc/shared/start/start.S
+++ b/bsps/sparc/shared/start/start.S
@@ -331,47 +331,19 @@ SYM(hard_reset):
         mov     %sp, %fp                ! Set frame pointer
         nop
 
-        /*
-         *  Copy the initialized data to RAM
-         *
-         *  FROM:   _data_load_start
-         *  TO:     _data_start
-         *  LENGTH: (__bss_start - _data_start) bytes
-         */
-
-        sethi %hi(_data_load_start),%g1 ! g1 = start of initialized data in ROM
-        or    %g1,%lo(_data_load_start),%g1
-
-        sethi %hi(_data_start),%g3      ! g3 = start of initialized data in RAM
-        or    %g3,%lo(_data_start),%g3
+        /* clear the bss */
 
-        sethi %hi(__bss_start), %g2     ! g2 = end of initialized data in RAM
+        sethi %hi(__bss_start), %g2     ! g2 = start of bss
         or    %g2,%lo(__bss_start),%g2
 
-	cmp   %g1, %g3
-	be    1f
-	nop
-
-copy_data:
-        ldd   [%g1], %g4
-        std   %g4 , [%g3]               ! copy this double word
-        add   %g3, 8, %g3               ! bump the destination pointer
-        add   %g1, 8, %g1               ! bump the source pointer
-        cmp   %g3, %g2                  ! Is the pointer past the end of dest?
-        bl    copy_data
-        nop
-
-        /* clear the bss */
-1:
-
         sethi %hi(_end),%g3
         or    %g3,%lo(_end),%g3         ! g3 = end of bss
         mov   %g0,%g1                   ! so std has two zeros
-zerobss:
+.Lzerobss:
         std    %g0,[%g2]
         add    %g2,8,%g2
         cmp    %g2,%g3
-        bleu,a zerobss
+        bleu,a .Lzerobss
         nop
 
         mov     %g0, %o0                ! command line



More information about the vc mailing list