Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libgloss/moxie/crt0.S')
-rw-r--r--libgloss/moxie/crt0.S18
1 files changed, 14 insertions, 4 deletions
diff --git a/libgloss/moxie/crt0.S b/libgloss/moxie/crt0.S
index e7c64a68b..d413a4580 100644
--- a/libgloss/moxie/crt0.S
+++ b/libgloss/moxie/crt0.S
@@ -1,6 +1,6 @@
/* crt0.S -- startup file for moxie
*
- * Copyright (c) 2008 Anthony Green
+ * Copyright (c) 2008, 2009 Anthony Green
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
@@ -23,12 +23,22 @@ _start:
ldi.l $fp, 0x0 /* zero fp to allow unwinders to stop */
/* zero the bss area */
- /* TODO */
- /* call memset */
+ dec $sp, 12
+ ldi.l $r0, __bss_start__
+ ldi.l $r1, __bss_end__
+ sub.l $r1, $r0
+ sto.l 8($sp), $r1
+ ldi.l $r1, 0
+ jsra memset
+ inc $sp, 12
- /* Call _init to invoke static constructors, etc. */
+ /* Call _init to invoke static constructors, etc. */
jsra _init
+ /* Call _fini at exit time for static destructors. */
+ ldi.l $r0, _fini
+ jsra atexit
+
/* Set argc and argv. These are populated by the simulator. */
lda.l $r0, 0x4
ldi.l $r1, 0x8