]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/cris/crt1.S
Inital import
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / libc / sysdeps / linux / cris / crt1.S
1 /* Startup code compliant to the ELF CRIS ABI */
2
3 #include <features.h>
4
5         .syntax no_register_prefix
6
7 /* The first piece of initialized data.  */
8         .data
9         .global __data_start
10         .align  2
11         .type   __data_start, @object
12         .size   __data_start, 4
13 __data_start:
14         .dword  0
15
16         .text
17         .align  1
18         .global _start
19         .type   _start, %function
20 #if defined(__UCLIBC_CTOR_DTOR__)
21         .type   _init, %function
22         .type   _fini, %function
23 #else
24         .weak   _init
25         .weak   _fini
26 #endif
27         .type   main, %function
28         .type   __uClibc_main, %function
29
30 /*
31  * On the stack we have argc. We can calculate argv/envp
32  * from that and the succeeding stack location, but fix so
33  * we get the right calling convention (regs in r10/r11).
34  *
35  * Please view linux/fs/binfmt_elf.c for a complete
36  * understanding of this.
37  */
38
39 /*
40  * Need to call __uClibc_main(main, argc, argv, _init, _fini)
41  */
42
43 _start:
44         move.d  main, r10
45         move.d  [sp+], r11
46         move.d  sp, r12
47         subq    4, sp
48         move    srp, [sp]
49         subq    4, sp
50         move.d  _fini, r13
51         move.d  r13, [sp]
52         move.d  _init, r13
53         /* Leave control to the libc */
54         jsr     __uClibc_main
55         nop
56         .size   _start, .-_start