From 265b5faec741277f9295baf03a627f9f855af0f2 Mon Sep 17 00:00:00 2001 From: Anthony Green Date: Wed, 1 Jul 2009 11:45:49 +0000 Subject: [PATCH] * moxie/crt0.S (_start): Clear BSS at startup. Register _fini() with atexit(). * moxie/sim-open.S: Fix comment. --- libgloss/ChangeLog | 6 ++++++ libgloss/moxie/crt0.S | 18 ++++++++++++++---- libgloss/moxie/sim-open.S | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/libgloss/ChangeLog b/libgloss/ChangeLog index ec1d49a3c..cc9cfd312 100644 --- a/libgloss/ChangeLog +++ b/libgloss/ChangeLog @@ -1,3 +1,9 @@ +2009-07-01 Anthony Green + + * moxie/crt0.S (_start): Clear BSS at startup. Register _fini() + with atexit(). + * moxie/sim-open.S: Fix comment. + 2009-06-19 Joseph Myers * Makefile.in (html, pdf): New. 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 diff --git a/libgloss/moxie/sim-open.S b/libgloss/moxie/sim-open.S index dafbe4de1..87e9b94f8 100644 --- a/libgloss/moxie/sim-open.S +++ b/libgloss/moxie/sim-open.S @@ -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 *