~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/rtl/linux/arm/cprt0.as

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Startup code for ARM & ELF
 
2
   Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
 
3
   This file is part of the GNU C Library.
 
4
 
 
5
   The GNU C Library is free software; you can redistribute it and/or
 
6
   modify it under the terms of the GNU Lesser General Public
 
7
   License as published by the Free Software Foundation; either
 
8
   version 2.1 of the License, or (at your option) any later version.
 
9
 
 
10
   The GNU C Library is distributed in the hope that it will be useful,
 
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
   Lesser General Public License for more details.
 
14
 
 
15
   You should have received a copy of the GNU Lesser General Public
 
16
   License along with the GNU C Library; if not, write to the Free
 
17
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
18
   02111-1307 USA.  */
 
19
 
 
20
/* This is the canonical entry point, usually the first thing in the text
 
21
   segment.
 
22
 
 
23
        Note that the code in the .init section has already been run.
 
24
        This includes _init and _libc_init
 
25
 
 
26
 
 
27
        At this entry point, most registers' values are unspecified, except:
 
28
 
 
29
   a1           Contains a function pointer to be registered with `atexit'.
 
30
                This is how the dynamic linker arranges to have DT_FINI
 
31
                functions called for shared libraries that have been loaded
 
32
                before this code runs.
 
33
 
 
34
   sp           The stack contains the arguments and environment:
 
35
                0(sp)                   argc
 
36
                4(sp)                   argv[0]
 
37
                ...
 
38
                (4*argc)(sp)            NULL
 
39
                (4*(argc+1))(sp)        envp[0]
 
40
                ...
 
41
                                        NULL
 
42
*/
 
43
 
 
44
        .text
 
45
        .globl _start
 
46
        .type _start,#function
 
47
_start:
 
48
        /* Clear the frame pointer since this is the outermost frame.  */
 
49
        mov fp, #0
 
50
        ldmia   sp!, {a2}
 
51
 
 
52
        /* Pop argc off the stack and save a pointer to argv */
 
53
        ldr ip,=operatingsystem_parameter_argc
 
54
        ldr a3,=operatingsystem_parameter_argv
 
55
        str a2,[ip]
 
56
 
 
57
        /* calc envp */
 
58
        add a4,a2,#1
 
59
        add a4,sp,a4,LSL #2
 
60
        ldr ip,=operatingsystem_parameter_envp
 
61
 
 
62
        str sp,[a3]
 
63
        str a4,[ip]
 
64
 
 
65
        /* Save initial stackpointer */
 
66
        ldr ip,=__stkptr
 
67
        str sp,[ip]
 
68
 
 
69
        /* Fetch address of fini */
 
70
        ldr ip, =_fini
 
71
 
 
72
        /* argc already loaded to a2*/
 
73
 
 
74
        /* load argv */
 
75
        mov a3, sp
 
76
 
 
77
        /* Push stack limit */
 
78
        str a3, [sp, #-4]!
 
79
 
 
80
        /* Push rtld_fini */
 
81
        str a1, [sp, #-4]!
 
82
 
 
83
        /* Set up the other arguments in registers */
 
84
        ldr a1, =PASCALMAIN
 
85
        ldr a4, =_init
 
86
 
 
87
        /* Push fini */
 
88
        str ip, [sp, #-4]!
 
89
 
 
90
        /* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
 
91
 
 
92
        /* Let the libc call main and exit with its return code.  */
 
93
        bl __libc_start_main
 
94
 
 
95
        /* should never get here....*/
 
96
        bl abort
 
97
 
 
98
        .globl  _haltproc
 
99
    .type   _haltproc,#function
 
100
_haltproc:
 
101
        ldr r0,=operatingsystem_result
 
102
        ldrb r0,[r0]
 
103
        swi 0x900001
 
104
        b _haltproc
 
105
 
 
106
        /* Define a symbol for the first piece of initialized data.  */
 
107
        .data
 
108
        .globl __data_start
 
109
__data_start:
 
110
        .long 0
 
111
        .weak data_start
 
112
        data_start = __data_start
 
113
 
 
114
.bss
 
115
        .comm __stkptr,4
 
116
 
 
117
        .comm operatingsystem_parameter_envp,4
 
118
        .comm operatingsystem_parameter_argc,4
 
119
        .comm operatingsystem_parameter_argv,4
 
120
 
 
121
        .section ".comment"
 
122
        .byte 0
 
123
        .ascii "generated by FPC http://www.freepascal.org\0"
 
124
 
 
125
/* We need this stuff to make gdb behave itself, otherwise
 
126
   gdb will chokes with SIGILL when trying to debug apps.
 
127
*/
 
128
        .section ".note.ABI-tag", "a"
 
129
        .align 4
 
130
        .long 1f - 0f
 
131
        .long 3f - 2f
 
132
        .long  1
 
133
0:      .asciz "GNU"
 
134
1:      .align 4
 
135
2:      .long 0
 
136
        .long 2,0,0
 
137
3:      .align 4