]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/mips/nlm/dev/net/ucore/crt0_basic.S
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / sys / mips / nlm / dev / net / ucore / crt0_basic.S
1 /*-
2  * Copyright (c) 2003-2012 Broadcom Corporation
3  * All Rights Reserved
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  *
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in
13  *    the documentation and/or other materials provided with the
14  *    distribution.
15  * 
16  * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * $FreeBSD$
29  */
30
31 #include <machine/asm.h>
32
33         .text
34         .align  2
35         .globl  _start
36         .ent    _start
37 _start:
38         .set    noreorder
39         la      gp, _gp
40         .end    _start
41
42         .globl  __stack
43
44         .ent    zerobss
45 zerobss:
46         la      v0, _fbss
47         la      v1, _end
48 3:
49         sw      zero, 0(v0)
50         bltu    v0,v1,3b
51         addiu   v0,v0,4                 # executed in delay slot
52         la      sp, __stack             # set stack pointer
53         .end    zerobss
54
55         .ent    init
56 init:
57         addiu   a1,sp,32                # argv = sp + 32
58         addiu   a2,sp,40                # envp = sp + 40
59         sw      zero,(a1)               # argv[argc] = 0
60         sw      zero,(a2)               # envp[0] = 0
61         jal     main                    # call the program start function
62         move    a0,zero                 # set argc to 0
63 1:      b       1b
64         nop
65         .end    init
66