]> git.ipfire.org Git - thirdparty/glibc.git/blob - ports/sysdeps/am33/elf/start.S
Remove trailing whitespace in ports.
[thirdparty/glibc.git] / ports / sysdeps / am33 / elf / start.S
1 /* Startup code compliant to the ELF MN10300 ABI.
2 Copyright (C) 1995-2013 Free Software Foundation, Inc.
3 Contributed by Alexandre Oliva <aoliva@redhat.com>
4 Based on ../../i386/elf/start.S.
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 Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the 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 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library. If not, see
19 <http://www.gnu.org/licenses/>. */
20
21 /* This is the canonical entry point, usually the first thing in the text
22 segment. The SVR4/i386 ABI (pages 3-31, 3-32) says that when the entry
23 point runs, most registers' values are unspecified, except for:
24
25 a0 Contains a function pointer to be registered with `atexit'.
26 This is how the dynamic linker arranges to have DT_FINI
27 functions called for shared libraries that have been loaded
28 before this code runs.
29
30 sp The stack contains the arguments and environment:
31 (4,sp) argc
32 (8,sp) argv[0]
33 ...
34 (4*(argc+1),sp) NULL
35 (4*(argc+2),sp) envp[0]
36 ...
37 NULL
38 */
39
40 .text
41 .globl _start
42 .type _start,@function
43 _start:
44 /* Extract the arguments as encoded on the stack and set up
45 the arguments for `main': argc, argv. envp will be determined
46 later in __libc_start_main. */
47 mov sp,a3
48 add -32,sp
49
50 mov a3,(28,sp) /* stack_end. */
51 mov d0,(24,sp) /* rtld_fini. */
52 mov _fini, d3
53 mov d3,(20,sp) /* fini. */
54 mov _init, d2
55 mov d2,(16,sp) /* init. */
56 inc4 a3
57 mov a3,(12,sp) /* argv. */
58
59 /* Set the initial frame pointer as 0, so that the bottom of
60 the stack is clearly marked. */
61 mov 0,a3
62
63 mov (32,sp), d1 /* argc. */
64 mov main, d0 /* main. */
65
66 /* Call the user's main function, and exit with its value.
67 But let the libc call main. */
68 call __libc_start_main,[],0
69
70 call abort,[],0 /* Crash if somehow `exit' does return. */
71
72 /* Define a symbol for the first piece of initialized data. */
73 .data
74 .globl __data_start
75 __data_start:
76 .long 0
77 .weak data_start
78 data_start = __data_start