Update of /cvsroot/blob/blob/src/blob
In directory usw-pr-cvs1:/tmp/cvs-serv30674
Modified Files:
rest-ld-script trampoline.S
Added Files:
stack.S
Log Message:
- Move the stack into the .bss section
- Actually clear the .bss section before we jump to C code
--- NEW FILE: stack.S ---
/*
* stack.S: blob stack
*
* Copyright (C) 2001 Erik Mouw (J.A...@it...)
*
* $Id: stack.S,v 1.1 2001/10/28 20:34:41 erikm Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
.ident "$Id: stack.S,v 1.1 2001/10/28 20:34:41 erikm Exp $"
#ifdef HAVE_CONFIG_H
# include <blob/config.h>
#endif
.section ".stack"
/* 8kB stack should be enough */
.space (8 * 1024)
Index: rest-ld-script
===================================================================
RCS file: /cvsroot/blob/blob/src/blob/rest-ld-script,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- rest-ld-script 2001/10/07 19:04:25 1.1
+++ rest-ld-script 2001/10/28 20:34:41 1.2
@@ -53,12 +53,22 @@
. = ALIGN(4);
.ptaglist : {
__ptagtable_begin = .;
- *(.ptaglist)
+ *(.ptaglist)
__ptagtable_end = .;
}
- /* the BSS section should be the last section */
+ /* the BSS section should *always* be the last section */
. = ALIGN(4);
- .bss : { *(.bss) }
+ .bss : {
+ __bss_start = .;
+ /* first the real BSS data */
+ *(.bss)
+
+ /* and next the stack */
+ . = ALIGN(4);
+ *(.stack)
+ __stack_end = .;
+ __bss_end = .;
+ }
}
Index: trampoline.S
===================================================================
RCS file: /cvsroot/blob/blob/src/blob/trampoline.S,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- trampoline.S 2001/10/07 19:34:17 1.2
+++ trampoline.S 2001/10/28 20:34:41 1.3
@@ -24,11 +24,35 @@
#ifdef HAVE_CONFIG_H
# include <blob/config.h>
#endif
-
+
.text
.globl _trampoline
_trampoline:
+ /* clear the BSS section */
+ ldr r1, bss_start
+ ldr r0, bss_end
+ sub r0, r0, r1
+
+ /* r1 = start address */
+ /* r0 = #number of bytes */
+ mov r2, #0
+
+clear_bss:
+ stmia r1!, {r2}
+ subs r0, r0, #4
+ bne clear_bss
+
+ /* setup the stack pointer */
+ ldr r0, stack_end
+ sub sp, r0, #4
+
+ /* jump to C code */
bl main
/* if main ever returns we just call it again */
b _trampoline
+
+
+bss_start: .word __bss_start
+bss_end: .word __bss_end
+stack_end: .word __stack_end
|