Author: andreast
Date: Wed Nov 17 19:28:48 2010
New Revision: 215436
URL: http://svn.freebsd.org/changeset/base/215436

Log:
  Make sure the .bss is cleared at the beginning. The pSeries OF ELF loader does
  not clear .bss automatically.
  
  Approved by:  nwhitehorn (mentor)

Modified:
  head/sys/boot/powerpc/ofw/start.c

Modified: head/sys/boot/powerpc/ofw/start.c
==============================================================================
--- head/sys/boot/powerpc/ofw/start.c   Wed Nov 17 19:25:37 2010        
(r215435)
+++ head/sys/boot/powerpc/ofw/start.c   Wed Nov 17 19:28:48 2010        
(r215436)
@@ -50,7 +50,20 @@ _start:                              \n\
        addi    %r1,%r1,st...@l \n\
        addi    %r1,%r1,16384   \n\
                                \n\
-       b       startup         \n\
+       /* Clear the .bss!!! */ \n\
+       li      %r0,0           \n\
+       lis     %r8,_ed...@ha   \n\
+       addi    %r8,%r8,_ed...@l\n\
+       lis     %r9,_...@ha     \n\
+       addi    %r9,%r9,_...@l  \n\
+                               \n\
+1:     cmpw    0,%r8,%r9       \n\
+       bge     2f              \n\
+       stw     %r0,0(%r8)      \n\
+       addi    %r8,%r8,4       \n\
+       b       1b              \n\
+                               \n\
+2:     b       startup         \n\
 ");
 
 void
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to