yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 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, write to the Free Software Foundation, |
| 19 | ; Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 | ; |
| 21 | |
| 22 | .text |
| 23 | |
| 24 | ;; On entry, the dynamic linker |
| 25 | ;; |
| 26 | ;; 0(sp) pad0 |
| 27 | ;; 4(sp) pad1 |
| 28 | ;; 8(sp) argc |
| 29 | ;; 12(sp) argv[0] |
| 30 | ;; ... |
| 31 | ;; (4*(argc+3))(sp) NULL |
| 32 | ;; (4*(argc+4))(sp) envp[0] |
| 33 | ;; ... |
| 34 | ;; NULL |
| 35 | |
| 36 | ;; Register values are unspecified, except: |
| 37 | ;; |
| 38 | ;; A4 --> pointer to rtld fini rountine |
| 39 | ;; B14 --> pointer to application DSBT table |
| 40 | |
| 41 | .global _start |
| 42 | _start: |
| 43 | .global _c_int00 |
| 44 | _c_int00: |
| 45 | ;; Things to do: |
| 46 | ;; |
| 47 | ;; * call __uClibc_main( |
| 48 | ;; int (*main)(int, char **, char **), A4 |
| 49 | ;; int argc, B4 |
| 50 | ;; char **argv, A6 |
| 51 | ;; void (*app_init)(void), B6 |
| 52 | ;; void (*app_fini)(void), A8 |
| 53 | ;; void (*rtld_fini)(void), B8 |
| 54 | ;; void *stack_end) A10 |
| 55 | |
| 56 | MV .D2X A4,B8 ; rtld_fini |
| 57 | |
| 58 | LDW .D2T1 *+B14($GOT(main)), A4 |
| 59 | LDW .D2T2 *+B14($GOT(_init)), B6 |
| 60 | B .S2 __uClibc_main |
| 61 | || LDW .D2T1 *+B14($GOT(_fini)), A8 |
| 62 | |
| 63 | LDW .D2T2 *+B15(8),B4 ; argc |
| 64 | ADDAW .D1X B15,3,A6 ; **argv |
| 65 | MV .D1X B15,A10 ; stack_end |
| 66 | || ZERO .L1 A15 ; clear FP |
| 67 | NOP 2 |