[U-Boot-Users] [PATCH] 3/9: bss_clean
Robert Schwebel
robert at schwebel.de
Thu Mar 6 13:32:37 CET 2003
BSS_CLEAN
=========
- The C standard requires that the BSS segment is initialized with 0.
This was not the case for the xscale plattforms.
Robert
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Braunschweiger Str. 79, 31134 Hildesheim, Germany
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Phone: +49-5121-28619-0 | Fax: +49-5121-28619-4
-------------- next part --------------
diff -urN -x CVS -x ptx-patches -x logfile -x logfile1 u-boot/board/cradle/u-boot.lds u-boot-ptx/board/cradle/u-boot.lds
--- u-boot/board/cradle/u-boot.lds 2002-10-26 18:57:29.000000000 +0200
+++ u-boot-ptx/board/cradle/u-boot.lds 2003-02-13 13:52:42.000000000 +0100
@@ -47,7 +47,9 @@
armboot_end_data = .;
. = ALIGN(4);
+ bss_start = .;
.bss : { *(.bss) }
+ bss_end = .;
armboot_end = .;
}
diff -urN -x CVS -x ptx-patches -x logfile -x logfile1 u-boot/board/lubbock/u-boot.lds u-boot-ptx/board/lubbock/u-boot.lds
--- u-boot/board/lubbock/u-boot.lds 2002-10-26 18:57:34.000000000 +0200
+++ u-boot-ptx/board/lubbock/u-boot.lds 2003-02-13 13:52:21.000000000 +0100
@@ -47,7 +47,9 @@
armboot_end_data = .;
. = ALIGN(4);
+ bss_start = .;
.bss : { *(.bss) }
+ bss_end = .;
armboot_end = .;
}
diff -urN -x CVS -x ptx-patches -x logfile -x logfile1 u-boot/board/csb226/u-boot.lds u-boot-ptx/board/csb226/u-boot.lds
--- u-boot/board/csb226/u-boot.lds 2002-10-26 18:57:48.000000000 +0200
+++ u-boot-ptx/board/csb226/u-boot.lds 2003-02-13 13:51:37.000000000 +0100
@@ -47,7 +47,9 @@
armboot_end_data = .;
. = ALIGN(4);
+ bss_start = .;
.bss : { *(.bss) }
+ bss_end = .;
armboot_end = .;
}
diff -urN -x CVS -x ptx-patches -x logfile -x logfile1 u-boot/board/innokom/u-boot.lds u-boot-ptx/board/innokom/u-boot.lds
--- u-boot/board/innokom/u-boot.lds 2003-03-06 01:02:07.000000000 +0100
+++ u-boot-ptx/board/innokom/u-boot.lds 2003-02-13 13:01:31.000000000 +0100
@@ -47,7 +47,9 @@
armboot_end_data = .;
. = ALIGN(4);
+ bss_start = .;
.bss : { *(.bss) }
+ bss_end = .;
armboot_end = .;
}
diff -urN -x CVS -x ptx-patches -x logfile -x logfile1 u-boot/cpu/xscale/start.S u-boot-ptx/cpu/xscale/start.S
--- u-boot/cpu/xscale/start.S 2002-11-11 18:10:32.000000000 +0100
+++ u-boot-ptx/cpu/xscale/start.S 2003-03-06 08:04:37.000000000 +0100
@@ -84,6 +84,17 @@
.word armboot_end
/*
+ * This is defined in the board specific linker script
+ */
+.globl _bss_start
+_bss_start:
+ .word bss_start
+
+.globl _bss_end
+_bss_end:
+ .word bss_end
+
+/*
* _armboot_real_end is the first usable RAM address behind armboot
* and the various stacks
*/
@@ -143,7 +157,20 @@
ldr r0, _uboot_reloc /* upper 128 KiB: relocated uboot */
sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
/* FIXME: bdinfo should be here */
- sub sp, r0, #12 /* leave 3 words for abort-stack */
+ sub sp, r0, #12 /* leave 3 words for abort-stack */
+
+clear_bss:
+
+ ldr r0, _bss_start /* find start of bss segment */
+ add r0, r0, #4 /* start at first byte of bss */
+ ldr r1, _bss_end /* stop here */
+ mov r2, #0x00000000 /* clear */
+
+clbss_l:str r2, [r0] /* clear loop... */
+ add r0, r0, #4
+ cmp r0, r1
+ bne clbss_l
+
ldr pc, _start_armboot
More information about the U-Boot
mailing list