]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/c6x/crt1.S
Update
[l4.git] / l4 / pkg / l4re-core / uclibc / lib / contrib / uclibc / libc / sysdeps / linux / c6x / crt1.S
1 ;
2 ; Port of uClibc for TMS320C6000 DSP architecture
3
4 ; Copyright (C) 2010 Texas Instruments Incorporated
5 ; Mark Salter <msalter@redhat.com>
6 ;
7 ; This program is free software; you can redistribute it and/or modify it
8 ; under the terms of the GNU Library General Public License as published by
9 ; the Free Software Foundation; either version 2 of the License, or (at your
10 ; option) any later version.
11 ;
12 ; This program is distributed in the hope that it will be useful, but WITHOUT
13 ; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 ; FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
15 ; for more details.
16 ;
17 ; You should have received a copy of the GNU Library General Public License
18 ; along with this program; if not, see <http://www.gnu.org/licenses/>.
19 ;
20
21        .text
22
23         ;; On entry, the dynamic linker
24         ;;
25         ;;      0(sp)                   pad0
26         ;;      4(sp)                   pad1
27         ;;      8(sp)                   argc
28         ;;      12(sp)                  argv[0]
29         ;;      ...
30         ;;      (4*(argc+3))(sp)        NULL
31         ;;      (4*(argc+4))(sp)        envp[0]
32         ;;      ...
33         ;;                              NULL
34
35         ;; Register values are unspecified, except:
36         ;;
37         ;;      A4  --> pointer to rtld fini rountine
38         ;;      B14 --> pointer to application DSBT table
39
40         .global _start
41 _start:
42         .global _c_int00
43 _c_int00:
44         ;; Things to do:
45         ;;
46         ;;      * call __uClibc_main(
47         ;;              int (*main)(int, char **, char **),     A4
48         ;;              int argc,                               B4
49         ;;              char **argv,                            A6
50         ;;              void (*app_init)(void),                 B6
51         ;;              void (*app_fini)(void),                 A8
52         ;;              void (*rtld_fini)(void),                B8
53         ;;              void *stack_end)                        A10
54
55         MV .D2X A4,B8           ; rtld_fini
56
57         LDW .D2T1       *+B14($GOT(main)), A4
58         LDW .D2T2       *+B14($GOT(_init)), B6
59         B .S2           __uClibc_main
60 ||      LDW .D2T1       *+B14($GOT(_fini)), A8
61
62         LDW .D2T2       *+B15(8),B4     ; argc
63         ADDAW .D1X      B15,3,A6        ; **argv
64         MV .D1X         B15,A10         ; stack_end
65 ||      ZERO .L1        A15             ; clear FP
66         NOP             2