Patchwork [04/14] Remove second zero of BSS

login
register
mail settings
Submitter Anton Blanchard
Date July 9, 2010, 5:03 a.m.
Message ID <20100709050341.715323729@samba.org>
Download mbox | patch
Permalink /patch/58327/
State Changes Requested
Headers show

Comments

Anton Blanchard - July 9, 2010, 5:03 a.m.
We zero the BSS in two places: once in _start() and then
again in yaboot_start(). The second time we actually get
it wrong and zero 1/4 of the BSS (since we subtract two
pointers).

Since this second zeroing is superfluous and buggy, remove
it.

While here, fix the comments in _start. It claims we aren't
clearing the BSS when we are.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Patch

Index: yaboot/second/yaboot.c
===================================================================
--- yaboot.orig/second/yaboot.c	2010-07-08 16:17:23.000000000 +1000
+++ yaboot/second/yaboot.c	2010-07-08 16:17:43.000000000 +1000
@@ -157,11 +157,6 @@  extern unsigned char linux_logo_blue[];
 
 #define DEFAULT_TIMEOUT		-1
 
-/* Entry, currently called directly by crt0 (bss not inited) */
-
-extern char* __bss_start;
-extern char* _end;
-
 int
 yaboot_start (unsigned long r3, unsigned long r4, unsigned long r5)
 {
@@ -169,9 +164,6 @@  yaboot_start (unsigned long r3, unsigned
      void* malloc_base = NULL;
      prom_handle root;
 
-     /* OF seems to do it, but I'm not very confident */
-     memset(&__bss_start, 0, &_end - &__bss_start);
-
      /* Initialize OF interface */
      prom_init ((prom_entry) r5);
 
Index: yaboot/second/crt0.S
===================================================================
--- yaboot.orig/second/crt0.S	2010-07-08 16:17:48.000000000 +1000
+++ yaboot/second/crt0.S	2010-07-08 16:18:16.000000000 +1000
@@ -2,7 +2,7 @@ 
 #include "asm/processor.h"
 
 /*
- * Main entry point. should add code to clear BSS and more ...
+ * Main entry point. We zero the BSS then jump to yaboot_start.
  */
 _GLOBAL(_start)
 	lis	r10,edata@h