]> sourceware.org Git - glibc.git/blob - sysdeps/s390/s390-64/elf/start.S
Update.
[glibc.git] / sysdeps / s390 / s390-64 / elf / start.S
1 /* Startup code compliant to the 64 bit S/390 ELF ABI.
2 Copyright (C) 2001 Free Software Foundation, Inc.
3 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If not,
18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 /*
22 This is the canonical entry point, usually the first thing in the text
23 segment. Most registers' values are unspecified, except for:
24
25 %r14 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 %r15 The stack contains the arguments and environment:
31 0(%r15) argc
32 8(%r15) argv[0]
33 ...
34 (8*argc)(%r15) NULL
35 (8*(argc+1))(%r15) envp[0]
36 ...
37 NULL
38 */
39
40 .text
41 .globl _start
42 .type _start,@function
43 _start:
44 /* Load argc and argv from stack. */
45 la %r4,8(%r15) # get argv
46 lg %r3,0(%r15) # get argc
47
48 /* Align the stack to a double word boundary. */
49 lghi %r0,-16
50 ngr %r15,%r0
51
52 /* Setup a stack frame and a parameter area. */
53 aghi %r15,-176 # make room on stack
54 xc 0(8,%r15),0(%r15) # clear back-chain
55
56 /* Set up arguments for __libc_start_main:
57 main, argc, argv, envp, _init, _fini, rtld_fini, stack_end
58 Note that envp will be determined later in __libc_start_main.
59 */
60 stmg %r14,%r15,160(%r15) # store rtld_fini/stack_end to parameter area
61 la %r7,160(%r15)
62 larl %r6,_fini # load pointer to _fini
63 larl %r5,_init # load pointer to _init
64 larl %r2,main # load pointer to main
65
66 /* Ok, now branch to the libc main routine. */
67 brasl %r14,__libc_start_main
68
69 /* Crash if __libc_start_main returns. */
70 .word 0
71
72 /* FIXME: FPU flags or what ?!? */
73
74 .section .rodata
75 .globl _fp_hw
76 .long 3
77 .size _fp_hw, 4
78
79 /* Define a symbol for the first piece of initialized data. */
80 .data
81 .globl __data_start
82 __data_start:
83 .long 0
84 .weak data_start
85 data_start = __data_start
This page took 0.04017 seconds and 5 git commands to generate.