OSDN Git Service

* moxie/crt0.S (_start): Clear BSS at startup. Register _fini()
authorgreen <green>
Wed, 1 Jul 2009 11:45:49 +0000 (11:45 +0000)
committergreen <green>
Wed, 1 Jul 2009 11:45:49 +0000 (11:45 +0000)
        with atexit().
        * moxie/sim-open.S: Fix comment.

libgloss/ChangeLog
libgloss/moxie/crt0.S
libgloss/moxie/sim-open.S

index ec1d49a..cc9cfd3 100644 (file)
@@ -1,3 +1,9 @@
+2009-07-01  Anthony Green  <green@moxielogic.com>
+
+       * moxie/crt0.S (_start): Clear BSS at startup.  Register _fini()
+       with atexit().
+       * moxie/sim-open.S: Fix comment.
+
 2009-06-19  Joseph Myers  <joseph@codesourcery.com>
 
        * Makefile.in (html, pdf): New.
index e7c64a6..d413a45 100644 (file)
@@ -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
index dafbe4d..87e9b94 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * sim-open.S -- open interface for frv simulator
+ * sim-open.S -- open interface for moxie simulator
  * 
  * Copyright (c) 2008 Anthony Green
  *