OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [newlib-1.18.0/] [libgloss/] [lm32/] [crt0.S] - Blame information for rev 859

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/*
2
 * Lattice Mico32 C startup code.
3
 * Contributed by Jon Beniston 
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 * notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 * notice, this list of conditions and the following disclaimer in the
12
 * documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
 * SUCH DAMAGE.
25
 */
26
 
27
        .section    .boot, "ax", @progbits
28
 
29
        /* Program starts here */
30
 
31
        .global     _start
32
_start:
33
 
34
        /* Setup stack and global pointer */
35
        mvhi    sp, hi(_fstack)
36
        ori     sp, sp, lo(_fstack)
37
        mvhi    gp, hi(_gp)
38
        ori     gp, gp, lo(_gp)
39
 
40
        /* Clear BSS */
41
        mvhi    r1, hi(_fbss)
42
        ori     r1, r1, lo(_fbss)
43
        mvi     r2, 0
44
        mvhi    r3, hi(_ebss)
45
        ori     r3, r3, lo(_ebss)
46
        sub     r3, r3, r1
47
        calli   memset
48
 
49
        /* Call C++ constructors */
50
        calli   _init
51
 
52
        /* Call C++ destructors on exit */
53
        mvhi    r1, hi(_fini)
54
        ori     r1, r1, lo(_fini)
55
        calli   atexit
56
 
57
        /* Call main program */
58
        mvi     r1, 0
59
        mvi     r2, 0
60
        mvi     r3, 0
61
        calli   main
62
 
63
        /* Call exit, which doesn't return, to perform any clean up */
64
        calli   exit

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.