]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/sh64/crt1.S
Update
[l4.git] / l4 / pkg / l4re-core / uclibc / lib / contrib / uclibc / libc / sysdeps / linux / sh64 / crt1.S
1 /* Startup code for SH5 & ELF.
2    Copyright (C) 1999 Free Software Foundation, Inc.
3    Copyright (C) 2001 Hewlett-Packard Australia
4
5    This file is part of the GNU C Library.
6
7    The GNU C Library is free software; you can redistribute it and/or
8    modify it under the terms of the GNU Library General Public License as
9    published by the Free Software Foundation; either version 2 of the
10    License, or (at your option) any later version.
11
12    The GNU C Library is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    Library General Public License for more details.
16
17    You should have received a copy of the GNU Library General Public
18    License along with the GNU C Library; see the file COPYING.LIB.  If not,
19    see <http://www.gnu.org/licenses/>.  */
20
21 /* This is the canonical entry point, usually the first thing in the text
22    segment.
23
24         At this entry point, most registers' values are unspecified, except:
25
26    sp           The stack contains the arguments and environment:
27                 0(sp)                   argc
28                 4(sp)                   argv[0]
29                 ...
30                 (4*argc)(sp)            NULL
31                 (4*(argc+1))(sp)        envp[0]
32                 ...
33                                         NULL
34 */
35
36         .file   "crt1.S"
37
38         .globl  _start
39         .type   _start,%function
40         .type   main,%function
41
42         .section .text64,"xa"
43         .align 2        /* 2^2 = 4 */
44
45 _start:
46         /* __uClibc_main (main, argc, argv, init, fini) */
47         movi    __main, r18
48         or      r2, r63, r18    
49
50         /* Pop argc off the stack and save a pointer to argv */
51         ld.l    r15, 0, r3      /* argc */
52         addi    r15, 4, r4      /* argv */
53
54         movi    _init, r5
55         movi    _fini, r6
56
57         /* call main() */
58         movi    __uClibc_main, r17
59         ptabs/l r17, tr0
60         blink   tr0, r18
61
62         /* should never get here....*/
63         movi    abort, r17
64         ptabs/l r17, tr0
65         blink   tr0, r63        /* call abort() => (r63) do not come back ... */
66
67 /*
68  *      The following is a stub to stop the GNU toolchain
69  *      from calling its C-RTL initialization routines.
70  */
71 __main:
72         movi    main, r18
73         ptabs/l r18, tr0
74         blink   tr0, r63
75
76 /* Define a symbol for the first piece of initialized data.  */
77         .data
78         .globl __data_start
79 __data_start:
80         .long 0
81         .weak data_start
82         data_start = __data_start