source: trunk/libs/newlib/src/libgloss/moxie/crt0.S @ 612

Last change on this file since 612 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.3 KB
Line 
1/* crt0.S -- startup file for moxie
2 *
3 * Copyright (c) 2008, 2009, 2014  Anthony Green
4 *
5 * The authors hereby grant permission to use, copy, modify, distribute,
6 * and license this software and its documentation for any purpose, provided
7 * that existing copyright notices are retained in all copies and that this
8 * notice is included verbatim in any distributions. No written agreement,
9 * license, or royalty fee is required for any of the authorized uses.
10 * Modifications to this software may be copyrighted by their authors
11 * and need not follow the licensing terms described here, provided that
12 * the new terms are clearly indicated on the first page of each file where
13 * they apply.
14 */
15
16        .globl  __start
17        .weak   _start
18        .text
19        .type   __start,@function
20__start:
21_start:
22        ldi.l   $sp, _stack     /* set the top of stack */
23        xor     $fp, $fp        /* zero fp to allow unwinders to stop */
24
25        /* zero the bss area */
26        ldi.l   $r0, __bss_start__
27        xor     $r1, $r1
28        ldi.l   $r2, __bss_end__
29        sub     $r2, $r0
30        jsra    memset
31
32        /* Call _init to invoke static constructors, etc.  */
33        jsra    _init
34       
35        /* Call _fini at exit time for static destructors.  */
36        ldi.l   $r0, _fini
37        jsra    atexit
38       
39        /* Set argc and argv.  These are populated by the simulator.  */
40        lda.l   $r0, 0x4
41        ldi.l   $r1, 0x8
42       
43        jsra    main
44        jsra    exit
45
46.Lend:
47        .size   __start,(.Lend-__start)
Note: See TracBrowser for help on using the repository browser.