1 /* Startup code compliant to the ELF MN10300 ABI.
2 Copyright (C) 1995,1996,1997,1998,2000,2001 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.
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.
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.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, write to the Free
19 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 /* This is the canonical entry point, usually the first thing in the text
23 segment. The SVR4/i386 ABI (pages 3-31, 3-32) says that when the entry
24 point runs, most registers' values are unspecified, except for:
26 a0 Contains a function pointer to be registered with `atexit'.
27 This is how the dynamic linker arranges to have DT_FINI
28 functions called for shared libraries that have been loaded
29 before this code runs.
31 sp The stack contains the arguments and environment:
36 (4*(argc+2),sp) envp[0]
45 .type _start,@function
47 /* Extract the arguments as encoded on the stack and set up
48 the arguments for `main': argc, argv. envp will be determined
49 later in __libc_start_main. */
53 mov a3,(28,sp) /* stack_end. */
54 mov d0,(24,sp) /* rtld_fini. */
56 mov d3,(20,sp) /* fini. */
58 mov d2,(16,sp) /* init. */
60 mov a3,(12,sp) /* argv. */
62 /* Set the initial frame pointer as 0, so that the bottom of
63 the stack is clearly marked. */
66 mov (32,sp), d1 /* argc. */
67 mov BP_SYM (main), d0 /* main. */
69 /* Call the user's main function, and exit with its value.
70 But let the libc call main. */
71 call BP_SYM (__libc_start_main),[],0
73 call BP_SYM (abort),[],0 /* Crash if somehow `exit' does return. */
75 /* Define a symbol for the first piece of initialized data. */
81 data_start = __data_start