1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/* linux-crt0 -- Startup routines for the Linux BSP.
*
* Copyright (c) 2011 Edgar E. Iglesias
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice is included verbatim in any distributions. No written agreement,
* license, or royalty fee is required for any of the authorized uses.
* Modifications to this software may be copyrighted by their authors
* and need not follow the licensing terms described here, provided that
* the new terms are clearly indicated on the first page of each file where
* they apply.
*/
.section .text
.globl _start
.ent _start
.type _start, @function
_start:
la r13, r0, _SDA_BASE_
la r2, r0, _SDA2_BASE_
brlid r15, __init
nop
lwi r5, r1, 0
addik r6, r1, 4
# Add argc * 4.
addk r7, r5, r5
addk r7, r7, r7
brlid r15, main
# Now add 4 + r1 (i.e r6) in the delayslot.
addk r7, r7, r6
brlid r15, exit
addik r5, r3, 0
.size _start, . - _start
.end _start
/* Replacement for the GCC provided crti.S. This one avoids the
setup of stack protection regs (which result in privilieged
insn exceptions when running in user-space). */
.section .init, "ax"
.global __init
.align 2
__init:
addik r1, r1, -8
sw r15, r0, r1
.section .fini, "ax"
.global __fini
.align 2
__fini:
addik r1, r1, -8
sw r15, r0, r1
|