This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: clear BSS and register _fini for moxie port


I finally checked this in today.

AG

On Sun, 2009-05-10 at 06:43 -0700, Anthony Green wrote:
> I'm checking in the following patch.  It simply clears BSS in crt0, and
> registers _fini with atexit in order to call static destructors and the
> like.
> 
> AG
> 
> 
> 2009-05-10  Anthony Green  <green@moxielogic.com>
> 
>         * moxie/crt0.S (_start): Clear BSS at startup.  Register _fini()
>         with atexit().
>         * moxie/sim-open.S: Fix comment.
> 
> 
> Index: libgloss/moxie/crt0.S
> ===================================================================
> RCS file: /cvs/src/src/libgloss/moxie/crt0.S,v
> retrieving revision 1.1
> diff -u -r1.1 crt0.S
> --- libgloss/moxie/crt0.S	22 Apr 2009 19:48:07 -0000	1.1
> +++ libgloss/moxie/crt0.S	10 May 2009 04:09:36 -0000
> @@ -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 @@
>  	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: libgloss/moxie/sim-open.S
> ===================================================================
> RCS file: /cvs/src/src/libgloss/moxie/sim-open.S,v
> retrieving revision 1.1
> diff -u -r1.1 sim-open.S
> --- libgloss/moxie/sim-open.S	22 Apr 2009 19:48:07 -0000	1.1
> +++ libgloss/moxie/sim-open.S	10 May 2009 04:09:36 -0000
> @@ -1,5 +1,5 @@
>  /*
> - * sim-open.S -- open interface for frv simulator
> + * sim-open.S -- open interface for moxie simulator
>   * 
> 
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]