annotate src/ecrt0.c @ 93062:079f34f8306f

(tramp-drop-volume-letter): Evaluate when compiling.
author Glenn Morris <rgm@gnu.org>
date Wed, 19 Mar 2008 07:10:36 +0000
parents b7a5a89054dc
children 8971ddf55736
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25844
Dave Love <fx@gnu.org>
parents:
diff changeset
1 /* C code startup routine.
75227
e90d04cd455a Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents: 68651
diff changeset
2 Copyright (C) 1985, 1986, 1992, 2001, 2002, 2003, 2004,
79759
fc2bcd2a8aad Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78260
diff changeset
3 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
25844
Dave Love <fx@gnu.org>
parents:
diff changeset
4
Dave Love <fx@gnu.org>
parents:
diff changeset
5 This file is part of GNU Emacs.
Dave Love <fx@gnu.org>
parents:
diff changeset
6
Dave Love <fx@gnu.org>
parents:
diff changeset
7 GNU Emacs is free software; you can redistribute it and/or modify
Dave Love <fx@gnu.org>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
78260
922696f363b0 Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
9 the Free Software Foundation; either version 3, or (at your option)
25844
Dave Love <fx@gnu.org>
parents:
diff changeset
10 any later version.
Dave Love <fx@gnu.org>
parents:
diff changeset
11
Dave Love <fx@gnu.org>
parents:
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
Dave Love <fx@gnu.org>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
Dave Love <fx@gnu.org>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Dave Love <fx@gnu.org>
parents:
diff changeset
15 GNU General Public License for more details.
Dave Love <fx@gnu.org>
parents:
diff changeset
16
Dave Love <fx@gnu.org>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
Dave Love <fx@gnu.org>
parents:
diff changeset
18 along with GNU Emacs; see the file COPYING. If not, write to
64084
a8fa7c632ee4 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
a8fa7c632ee4 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
20 Boston, MA 02110-1301, USA. */
25844
Dave Love <fx@gnu.org>
parents:
diff changeset
21
Dave Love <fx@gnu.org>
parents:
diff changeset
22
Dave Love <fx@gnu.org>
parents:
diff changeset
23 /* The standard Vax 4.2 Unix crt0.c cannot be used for Emacs
Dave Love <fx@gnu.org>
parents:
diff changeset
24 because it makes `environ' an initialized variable.
Dave Love <fx@gnu.org>
parents:
diff changeset
25 It is easiest to have a special crt0.c on all machines
Dave Love <fx@gnu.org>
parents:
diff changeset
26 though I don't know whether other machines actually need it. */
Dave Love <fx@gnu.org>
parents:
diff changeset
27
Dave Love <fx@gnu.org>
parents:
diff changeset
28 /* On the vax and 68000, in BSD4.2 and USG5.2,
Dave Love <fx@gnu.org>
parents:
diff changeset
29 this is the data format on startup:
Dave Love <fx@gnu.org>
parents:
diff changeset
30 (vax) ap and fp are unpredictable as far as I know; don't use them.
Dave Love <fx@gnu.org>
parents:
diff changeset
31 sp -> word containing argc
Dave Love <fx@gnu.org>
parents:
diff changeset
32 word pointing to first arg string
Dave Love <fx@gnu.org>
parents:
diff changeset
33 [word pointing to next arg string]... 0 or more times
Dave Love <fx@gnu.org>
parents:
diff changeset
34 0
Dave Love <fx@gnu.org>
parents:
diff changeset
35 Optionally:
Dave Love <fx@gnu.org>
parents:
diff changeset
36 [word pointing to environment variable]... 1 or more times
Dave Love <fx@gnu.org>
parents:
diff changeset
37 ...
Dave Love <fx@gnu.org>
parents:
diff changeset
38 0
Dave Love <fx@gnu.org>
parents:
diff changeset
39 And always:
Dave Love <fx@gnu.org>
parents:
diff changeset
40 first arg string
Dave Love <fx@gnu.org>
parents:
diff changeset
41 [next arg string]... 0 or more times
Dave Love <fx@gnu.org>
parents:
diff changeset
42 */
Dave Love <fx@gnu.org>
parents:
diff changeset
43
Dave Love <fx@gnu.org>
parents:
diff changeset
44 /* On the 16000, at least in the one 4.2 system I know about,
Dave Love <fx@gnu.org>
parents:
diff changeset
45 the initial data format is
Dave Love <fx@gnu.org>
parents:
diff changeset
46 sp -> word containing argc
Dave Love <fx@gnu.org>
parents:
diff changeset
47 word containing argp
Dave Love <fx@gnu.org>
parents:
diff changeset
48 word pointing to first arg string, and so on as above
Dave Love <fx@gnu.org>
parents:
diff changeset
49 */
Dave Love <fx@gnu.org>
parents:
diff changeset
50
Dave Love <fx@gnu.org>
parents:
diff changeset
51 #ifdef emacs
Dave Love <fx@gnu.org>
parents:
diff changeset
52 #include <config.h>
Dave Love <fx@gnu.org>
parents:
diff changeset
53 #endif
Dave Love <fx@gnu.org>
parents:
diff changeset
54
Dave Love <fx@gnu.org>
parents:
diff changeset
55 /* ******** WARNING ********
Dave Love <fx@gnu.org>
parents:
diff changeset
56 Do not insert any data definitions before data_start!
Dave Love <fx@gnu.org>
parents:
diff changeset
57 Since this is the first file linked, the address of the following
Dave Love <fx@gnu.org>
parents:
diff changeset
58 variable should correspond to the start of initialized data space.
Dave Love <fx@gnu.org>
parents:
diff changeset
59 On some systems this is a constant that is independent of the text
Dave Love <fx@gnu.org>
parents:
diff changeset
60 size for shared executables. On others, it is a function of the
Dave Love <fx@gnu.org>
parents:
diff changeset
61 text size. In short, this seems to be the most portable way to
Dave Love <fx@gnu.org>
parents:
diff changeset
62 discover the start of initialized data space dynamically at runtime,
Dave Love <fx@gnu.org>
parents:
diff changeset
63 for either shared or unshared executables, on either swapping or
Dave Love <fx@gnu.org>
parents:
diff changeset
64 virtual systems. It only requires that the linker allocate objects
Dave Love <fx@gnu.org>
parents:
diff changeset
65 in the order encountered, a reasonable model for most Unix systems.
Dave Love <fx@gnu.org>
parents:
diff changeset
66 Similarly, note that the address of _start() should be the start
Dave Love <fx@gnu.org>
parents:
diff changeset
67 of text space. Fred Fish, UniSoft Systems Inc. */
Dave Love <fx@gnu.org>
parents:
diff changeset
68
Dave Love <fx@gnu.org>
parents:
diff changeset
69 int data_start = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
70
Dave Love <fx@gnu.org>
parents:
diff changeset
71 #ifdef NEED_ERRNO
Dave Love <fx@gnu.org>
parents:
diff changeset
72 int errno;
Dave Love <fx@gnu.org>
parents:
diff changeset
73 #endif
Dave Love <fx@gnu.org>
parents:
diff changeset
74
91702
b7a5a89054dc * configure.in (LIBX11_MACHINE, HAVE_XFREE386): Remove code
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87730
diff changeset
75 #ifndef MSDOS
25844
Dave Love <fx@gnu.org>
parents:
diff changeset
76 char **environ;
Dave Love <fx@gnu.org>
parents:
diff changeset
77 #endif
Dave Love <fx@gnu.org>
parents:
diff changeset
78
Dave Love <fx@gnu.org>
parents:
diff changeset
79 #ifndef static
Dave Love <fx@gnu.org>
parents:
diff changeset
80 /* On systems where the static storage class is usable, this function
Dave Love <fx@gnu.org>
parents:
diff changeset
81 should be declared as static. Otherwise, the static keyword has
Dave Love <fx@gnu.org>
parents:
diff changeset
82 been defined to be something else, and code for those systems must
Dave Love <fx@gnu.org>
parents:
diff changeset
83 take care of this declaration appropriately. */
Dave Love <fx@gnu.org>
parents:
diff changeset
84 static start1 ();
Dave Love <fx@gnu.org>
parents:
diff changeset
85 #endif
Dave Love <fx@gnu.org>
parents:
diff changeset
86
Dave Love <fx@gnu.org>
parents:
diff changeset
87 #ifdef CRT0_DUMMIES
Dave Love <fx@gnu.org>
parents:
diff changeset
88
Dave Love <fx@gnu.org>
parents:
diff changeset
89 /* Define symbol "start": here; some systems want that symbol. */
Dave Love <fx@gnu.org>
parents:
diff changeset
90 #ifdef DOT_GLOBAL_START
Dave Love <fx@gnu.org>
parents:
diff changeset
91 asm(" .text ");
Dave Love <fx@gnu.org>
parents:
diff changeset
92 asm(" .globl start ");
Dave Love <fx@gnu.org>
parents:
diff changeset
93 asm(" start: ");
Dave Love <fx@gnu.org>
parents:
diff changeset
94 #endif /* DOT_GLOBAL_START */
Dave Love <fx@gnu.org>
parents:
diff changeset
95
Dave Love <fx@gnu.org>
parents:
diff changeset
96 #ifdef NODOT_GLOBAL_START
Dave Love <fx@gnu.org>
parents:
diff changeset
97 asm(" text ");
Dave Love <fx@gnu.org>
parents:
diff changeset
98 asm(" global start ");
Dave Love <fx@gnu.org>
parents:
diff changeset
99 asm(" start: ");
Dave Love <fx@gnu.org>
parents:
diff changeset
100 #endif /* NODOT_GLOBAL_START */
Dave Love <fx@gnu.org>
parents:
diff changeset
101
Dave Love <fx@gnu.org>
parents:
diff changeset
102 #ifdef m68000
Dave Love <fx@gnu.org>
parents:
diff changeset
103
Dave Love <fx@gnu.org>
parents:
diff changeset
104 /* GCC 2.1, when optimization is turned off, seems to want to push a
Dave Love <fx@gnu.org>
parents:
diff changeset
105 word of garbage on the stack, which screws up the CRT0_DUMMIES
Dave Love <fx@gnu.org>
parents:
diff changeset
106 hack. So we hand-code _start in assembly language. */
Dave Love <fx@gnu.org>
parents:
diff changeset
107 asm(".text ");
Dave Love <fx@gnu.org>
parents:
diff changeset
108 asm(" .even ");
Dave Love <fx@gnu.org>
parents:
diff changeset
109 asm(".globl __start ");
Dave Love <fx@gnu.org>
parents:
diff changeset
110 asm("__start: ");
Dave Love <fx@gnu.org>
parents:
diff changeset
111 asm(" link a6,#0 ");
Dave Love <fx@gnu.org>
parents:
diff changeset
112 asm(" jbsr _start1 ");
Dave Love <fx@gnu.org>
parents:
diff changeset
113 asm(" unlk a6 ");
Dave Love <fx@gnu.org>
parents:
diff changeset
114 asm(" rts ");
Dave Love <fx@gnu.org>
parents:
diff changeset
115
Dave Love <fx@gnu.org>
parents:
diff changeset
116 #else /* not m68000 */
Dave Love <fx@gnu.org>
parents:
diff changeset
117
Dave Love <fx@gnu.org>
parents:
diff changeset
118 _start ()
Dave Love <fx@gnu.org>
parents:
diff changeset
119 {
Dave Love <fx@gnu.org>
parents:
diff changeset
120 /* On vax, nothing is pushed here */
Dave Love <fx@gnu.org>
parents:
diff changeset
121 /* On sequent, bogus fp is pushed here */
Dave Love <fx@gnu.org>
parents:
diff changeset
122 start1 ();
Dave Love <fx@gnu.org>
parents:
diff changeset
123 }
Dave Love <fx@gnu.org>
parents:
diff changeset
124
Dave Love <fx@gnu.org>
parents:
diff changeset
125 #endif /* possibly m68000 */
Dave Love <fx@gnu.org>
parents:
diff changeset
126
Dave Love <fx@gnu.org>
parents:
diff changeset
127 static
Dave Love <fx@gnu.org>
parents:
diff changeset
128 start1 (CRT0_DUMMIES argc, xargv)
Dave Love <fx@gnu.org>
parents:
diff changeset
129 int argc;
Dave Love <fx@gnu.org>
parents:
diff changeset
130 char *xargv;
Dave Love <fx@gnu.org>
parents:
diff changeset
131 {
Dave Love <fx@gnu.org>
parents:
diff changeset
132 register char **argv = &xargv;
Dave Love <fx@gnu.org>
parents:
diff changeset
133 environ = argv + argc + 1;
Dave Love <fx@gnu.org>
parents:
diff changeset
134
Dave Love <fx@gnu.org>
parents:
diff changeset
135 if ((char *)environ == xargv)
Dave Love <fx@gnu.org>
parents:
diff changeset
136 environ--;
Dave Love <fx@gnu.org>
parents:
diff changeset
137 exit (main (argc, argv, environ));
Dave Love <fx@gnu.org>
parents:
diff changeset
138
Dave Love <fx@gnu.org>
parents:
diff changeset
139 /* Refer to `start1' so GCC will not think it is never called
Dave Love <fx@gnu.org>
parents:
diff changeset
140 and optimize it out. */
Dave Love <fx@gnu.org>
parents:
diff changeset
141 (void) &start1;
Dave Love <fx@gnu.org>
parents:
diff changeset
142 }
Dave Love <fx@gnu.org>
parents:
diff changeset
143 #else /* not CRT0_DUMMIES */
Dave Love <fx@gnu.org>
parents:
diff changeset
144
Dave Love <fx@gnu.org>
parents:
diff changeset
145 /* "m68k" and "m68000" both stand for m68000 processors,
Dave Love <fx@gnu.org>
parents:
diff changeset
146 but with different program-entry conventions.
Dave Love <fx@gnu.org>
parents:
diff changeset
147 This is a kludge. Now that the CRT0_DUMMIES mechanism above exists,
Dave Love <fx@gnu.org>
parents:
diff changeset
148 most of these machines could use the vax code above
Dave Love <fx@gnu.org>
parents:
diff changeset
149 with some suitable definition of CRT0_DUMMIES.
Dave Love <fx@gnu.org>
parents:
diff changeset
150 Then the symbol m68k could be flushed.
Dave Love <fx@gnu.org>
parents:
diff changeset
151 But I don't want to risk breaking these machines
Dave Love <fx@gnu.org>
parents:
diff changeset
152 in a version 17 patch release, so that change is being put off. */
Dave Love <fx@gnu.org>
parents:
diff changeset
153
Dave Love <fx@gnu.org>
parents:
diff changeset
154 #ifdef m68k /* Can't do it all from C */
Dave Love <fx@gnu.org>
parents:
diff changeset
155 asm (" global _start");
Dave Love <fx@gnu.org>
parents:
diff changeset
156 asm (" text");
Dave Love <fx@gnu.org>
parents:
diff changeset
157 asm ("_start:");
Dave Love <fx@gnu.org>
parents:
diff changeset
158 asm (" comm splimit%,4");
Dave Love <fx@gnu.org>
parents:
diff changeset
159 asm (" global exit");
Dave Love <fx@gnu.org>
parents:
diff changeset
160 asm (" text");
Dave Love <fx@gnu.org>
parents:
diff changeset
161 asm (" mov.l %d0,splimit%");
Dave Love <fx@gnu.org>
parents:
diff changeset
162 asm (" jsr start1");
Dave Love <fx@gnu.org>
parents:
diff changeset
163 asm (" mov.l %d0,(%sp)");
Dave Love <fx@gnu.org>
parents:
diff changeset
164 asm (" jsr exit");
Dave Love <fx@gnu.org>
parents:
diff changeset
165 asm (" mov.l &1,%d0"); /* d0 = 1 => exit */
Dave Love <fx@gnu.org>
parents:
diff changeset
166 asm (" trap &0");
Dave Love <fx@gnu.org>
parents:
diff changeset
167 #else /* m68000, not m68k */
Dave Love <fx@gnu.org>
parents:
diff changeset
168
Dave Love <fx@gnu.org>
parents:
diff changeset
169 #ifdef m68000
Dave Love <fx@gnu.org>
parents:
diff changeset
170
Dave Love <fx@gnu.org>
parents:
diff changeset
171 _start ()
Dave Love <fx@gnu.org>
parents:
diff changeset
172 {
Dave Love <fx@gnu.org>
parents:
diff changeset
173 #ifdef sun
Dave Love <fx@gnu.org>
parents:
diff changeset
174 finitfp_();
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 27727
diff changeset
175 #endif
25844
Dave Love <fx@gnu.org>
parents:
diff changeset
176 /* On 68000, _start pushes a6 onto stack */
Dave Love <fx@gnu.org>
parents:
diff changeset
177 start1 ();
Dave Love <fx@gnu.org>
parents:
diff changeset
178 }
Dave Love <fx@gnu.org>
parents:
diff changeset
179 #endif /* m68000 */
Dave Love <fx@gnu.org>
parents:
diff changeset
180 #endif /* m68k */
Dave Love <fx@gnu.org>
parents:
diff changeset
181
Dave Love <fx@gnu.org>
parents:
diff changeset
182 #if defined(m68k) || defined(m68000)
Dave Love <fx@gnu.org>
parents:
diff changeset
183 /* ignore takes care of skipping the a6 value pushed in start. */
Dave Love <fx@gnu.org>
parents:
diff changeset
184 static
Dave Love <fx@gnu.org>
parents:
diff changeset
185 #if defined(m68k)
Dave Love <fx@gnu.org>
parents:
diff changeset
186 start1 (argc, xargv)
Dave Love <fx@gnu.org>
parents:
diff changeset
187 #else
Dave Love <fx@gnu.org>
parents:
diff changeset
188 start1 (ignore, argc, xargv)
Dave Love <fx@gnu.org>
parents:
diff changeset
189 #endif
Dave Love <fx@gnu.org>
parents:
diff changeset
190 int argc;
Dave Love <fx@gnu.org>
parents:
diff changeset
191 char *xargv;
Dave Love <fx@gnu.org>
parents:
diff changeset
192 {
Dave Love <fx@gnu.org>
parents:
diff changeset
193 register char **argv = &xargv;
Dave Love <fx@gnu.org>
parents:
diff changeset
194 environ = argv + argc + 1;
Dave Love <fx@gnu.org>
parents:
diff changeset
195
Dave Love <fx@gnu.org>
parents:
diff changeset
196 if ((char *)environ == xargv)
Dave Love <fx@gnu.org>
parents:
diff changeset
197 environ--;
Dave Love <fx@gnu.org>
parents:
diff changeset
198 exit (main (argc, argv, environ));
Dave Love <fx@gnu.org>
parents:
diff changeset
199 }
Dave Love <fx@gnu.org>
parents:
diff changeset
200
Dave Love <fx@gnu.org>
parents:
diff changeset
201 #endif /* m68k or m68000 */
Dave Love <fx@gnu.org>
parents:
diff changeset
202
Dave Love <fx@gnu.org>
parents:
diff changeset
203 #endif /* not CRT0_DUMMIES */
Dave Love <fx@gnu.org>
parents:
diff changeset
204
Dave Love <fx@gnu.org>
parents:
diff changeset
205 #ifdef hp9000s300
Dave Love <fx@gnu.org>
parents:
diff changeset
206 int argc_value;
Dave Love <fx@gnu.org>
parents:
diff changeset
207 char **argv_value;
Dave Love <fx@gnu.org>
parents:
diff changeset
208 #ifdef OLD_HP_ASSEMBLER
Dave Love <fx@gnu.org>
parents:
diff changeset
209 asm(" text");
Dave Love <fx@gnu.org>
parents:
diff changeset
210 asm(" globl __start");
Dave Love <fx@gnu.org>
parents:
diff changeset
211 asm(" globl _exit");
Dave Love <fx@gnu.org>
parents:
diff changeset
212 asm(" globl _main");
Dave Love <fx@gnu.org>
parents:
diff changeset
213 asm("__start");
Dave Love <fx@gnu.org>
parents:
diff changeset
214 asm(" dc.l 0");
Dave Love <fx@gnu.org>
parents:
diff changeset
215 asm(" subq.w #0x1,d0");
Dave Love <fx@gnu.org>
parents:
diff changeset
216 asm(" move.w d0,float_soft");
Dave Love <fx@gnu.org>
parents:
diff changeset
217 asm(" move.l 0x4(a7),d0");
Dave Love <fx@gnu.org>
parents:
diff changeset
218 asm(" beq.s skip_1");
Dave Love <fx@gnu.org>
parents:
diff changeset
219 asm(" move.l d0,a0");
Dave Love <fx@gnu.org>
parents:
diff changeset
220 asm(" clr.l -0x4(a0)");
Dave Love <fx@gnu.org>
parents:
diff changeset
221 asm("skip_1");
Dave Love <fx@gnu.org>
parents:
diff changeset
222 asm(" move.l a7,a0");
Dave Love <fx@gnu.org>
parents:
diff changeset
223 asm(" subq.l #0x8,a7");
Dave Love <fx@gnu.org>
parents:
diff changeset
224 asm(" move.l (a0),(a7)");
Dave Love <fx@gnu.org>
parents:
diff changeset
225 asm(" move.l (a0),_argc_value");
Dave Love <fx@gnu.org>
parents:
diff changeset
226 asm(" addq.l #0x4,a0");
Dave Love <fx@gnu.org>
parents:
diff changeset
227 asm(" move.l a0,0x4(a7)");
Dave Love <fx@gnu.org>
parents:
diff changeset
228 asm(" move.l a0,_argv_value");
Dave Love <fx@gnu.org>
parents:
diff changeset
229 asm("incr_loop");
Dave Love <fx@gnu.org>
parents:
diff changeset
230 asm(" tst.l (a0)+");
Dave Love <fx@gnu.org>
parents:
diff changeset
231 asm(" bne.s incr_loop");
Dave Love <fx@gnu.org>
parents:
diff changeset
232 asm(" move.l 0x4(a7),a1");
Dave Love <fx@gnu.org>
parents:
diff changeset
233 asm(" cmp.l (a1),a0");
Dave Love <fx@gnu.org>
parents:
diff changeset
234 asm(" blt.s skip_2");
Dave Love <fx@gnu.org>
parents:
diff changeset
235 asm(" subq.l #0x4,a0");
Dave Love <fx@gnu.org>
parents:
diff changeset
236 asm("skip_2");
Dave Love <fx@gnu.org>
parents:
diff changeset
237 asm(" move.l a0,0x8(a7)");
Dave Love <fx@gnu.org>
parents:
diff changeset
238 asm(" move.l a0,_environ");
Dave Love <fx@gnu.org>
parents:
diff changeset
239 asm(" jsr _main");
Dave Love <fx@gnu.org>
parents:
diff changeset
240 asm(" addq.l #0x8,a7");
Dave Love <fx@gnu.org>
parents:
diff changeset
241 asm(" move.l d0,-(a7)");
Dave Love <fx@gnu.org>
parents:
diff changeset
242 asm(" jsr _exit");
Dave Love <fx@gnu.org>
parents:
diff changeset
243 asm(" move.w #0x1,d0");
Dave Love <fx@gnu.org>
parents:
diff changeset
244 asm(" trap #0x0");
Dave Love <fx@gnu.org>
parents:
diff changeset
245 asm(" comm float_soft,4");
Dave Love <fx@gnu.org>
parents:
diff changeset
246 /* float_soft is allocated in this way because C would
Dave Love <fx@gnu.org>
parents:
diff changeset
247 put an underscore character in its name otherwise. */
Dave Love <fx@gnu.org>
parents:
diff changeset
248
Dave Love <fx@gnu.org>
parents:
diff changeset
249 #else /* new hp assembler */
Dave Love <fx@gnu.org>
parents:
diff changeset
250
Dave Love <fx@gnu.org>
parents:
diff changeset
251 asm(" text");
Dave Love <fx@gnu.org>
parents:
diff changeset
252 asm(" global float_loc");
Dave Love <fx@gnu.org>
parents:
diff changeset
253 asm(" set float_loc,0xFFFFB000");
Dave Love <fx@gnu.org>
parents:
diff changeset
254 asm(" global fpa_loc");
Dave Love <fx@gnu.org>
parents:
diff changeset
255 asm(" set fpa_loc,0xfff08000");
Dave Love <fx@gnu.org>
parents:
diff changeset
256 asm(" global __start");
Dave Love <fx@gnu.org>
parents:
diff changeset
257 asm(" global _exit");
Dave Love <fx@gnu.org>
parents:
diff changeset
258 asm(" global _main");
Dave Love <fx@gnu.org>
parents:
diff changeset
259 asm("__start:");
Dave Love <fx@gnu.org>
parents:
diff changeset
260 asm(" byte 0,0,0,0");
Dave Love <fx@gnu.org>
parents:
diff changeset
261 asm(" subq.w &1,%d0");
Dave Love <fx@gnu.org>
parents:
diff changeset
262 asm(" mov.w %d0,float_soft");
Dave Love <fx@gnu.org>
parents:
diff changeset
263 asm(" mov.w %d1,flag_68881");
Dave Love <fx@gnu.org>
parents:
diff changeset
264 #ifndef HPUX_68010
Dave Love <fx@gnu.org>
parents:
diff changeset
265 asm(" beq.b skip_float");
Dave Love <fx@gnu.org>
parents:
diff changeset
266 asm(" fmov.l &0x7400,%fpcr");
Dave Love <fx@gnu.org>
parents:
diff changeset
267 /* asm(" fmov.l &0x7480,%fpcr"); */
Dave Love <fx@gnu.org>
parents:
diff changeset
268 #endif /* HPUX_68010 */
Dave Love <fx@gnu.org>
parents:
diff changeset
269 asm("skip_float:");
Dave Love <fx@gnu.org>
parents:
diff changeset
270 asm(" mov.l %a0,%d0");
Dave Love <fx@gnu.org>
parents:
diff changeset
271 asm(" add.l %d0,%d0");
Dave Love <fx@gnu.org>
parents:
diff changeset
272 asm(" subx.w %d1,%d1");
Dave Love <fx@gnu.org>
parents:
diff changeset
273 asm(" mov.w %d1,flag_68010");
Dave Love <fx@gnu.org>
parents:
diff changeset
274 asm(" add.l %d0,%d0");
Dave Love <fx@gnu.org>
parents:
diff changeset
275 asm(" subx.w %d1,%d1");
Dave Love <fx@gnu.org>
parents:
diff changeset
276 asm(" mov.w %d1,flag_fpa");
Dave Love <fx@gnu.org>
parents:
diff changeset
277 asm(" tst.l %d2");
Dave Love <fx@gnu.org>
parents:
diff changeset
278 asm(" ble.b skip_3");
Dave Love <fx@gnu.org>
parents:
diff changeset
279 asm(" lsl flag_68881");
Dave Love <fx@gnu.org>
parents:
diff changeset
280 asm(" lsl flag_fpa");
Dave Love <fx@gnu.org>
parents:
diff changeset
281 asm("skip_3:");
Dave Love <fx@gnu.org>
parents:
diff changeset
282 asm(" mov.l 4(%a7),%d0");
Dave Love <fx@gnu.org>
parents:
diff changeset
283 asm(" beq.b skip_1");
Dave Love <fx@gnu.org>
parents:
diff changeset
284 asm(" mov.l %d0,%a0");
Dave Love <fx@gnu.org>
parents:
diff changeset
285 asm(" clr.l -4(%a0)");
Dave Love <fx@gnu.org>
parents:
diff changeset
286 asm("skip_1:");
Dave Love <fx@gnu.org>
parents:
diff changeset
287 asm(" mov.l %a7,%a0");
Dave Love <fx@gnu.org>
parents:
diff changeset
288 asm(" subq.l &8,%a7");
Dave Love <fx@gnu.org>
parents:
diff changeset
289 asm(" mov.l (%a0),(%a7)");
Dave Love <fx@gnu.org>
parents:
diff changeset
290 asm(" mov.l (%a0),_argc_value");
Dave Love <fx@gnu.org>
parents:
diff changeset
291 asm(" addq.l &4,%a0");
Dave Love <fx@gnu.org>
parents:
diff changeset
292 asm(" mov.l %a0,4(%a7)");
Dave Love <fx@gnu.org>
parents:
diff changeset
293 asm(" mov.l %a0,_argv_value");
Dave Love <fx@gnu.org>
parents:
diff changeset
294 asm("incr_loop:");
Dave Love <fx@gnu.org>
parents:
diff changeset
295 asm(" tst.l (%a0)+");
Dave Love <fx@gnu.org>
parents:
diff changeset
296 asm(" bne.b incr_loop");
Dave Love <fx@gnu.org>
parents:
diff changeset
297 asm(" mov.l 4(%a7),%a1");
Dave Love <fx@gnu.org>
parents:
diff changeset
298 asm(" cmp.l %a0,(%a1)");
Dave Love <fx@gnu.org>
parents:
diff changeset
299 asm(" blt.b skip_2");
Dave Love <fx@gnu.org>
parents:
diff changeset
300 asm(" subq.l &4,%a0");
Dave Love <fx@gnu.org>
parents:
diff changeset
301 asm("skip_2:");
Dave Love <fx@gnu.org>
parents:
diff changeset
302 asm(" mov.l %a0,8(%a7)");
Dave Love <fx@gnu.org>
parents:
diff changeset
303 asm(" mov.l %a0,_environ");
Dave Love <fx@gnu.org>
parents:
diff changeset
304 asm(" jsr _main");
Dave Love <fx@gnu.org>
parents:
diff changeset
305 asm(" addq.l &8,%a7");
Dave Love <fx@gnu.org>
parents:
diff changeset
306 asm(" mov.l %d0,-(%a7)");
Dave Love <fx@gnu.org>
parents:
diff changeset
307 asm(" jsr _exit");
Dave Love <fx@gnu.org>
parents:
diff changeset
308 asm(" mov.w &1,%d0");
Dave Love <fx@gnu.org>
parents:
diff changeset
309 asm(" trap &0");
Dave Love <fx@gnu.org>
parents:
diff changeset
310 asm(" comm float_soft, 4");
Dave Love <fx@gnu.org>
parents:
diff changeset
311 asm(" comm flag_68881, 4");
Dave Love <fx@gnu.org>
parents:
diff changeset
312 asm(" comm flag_68010, 4");
Dave Love <fx@gnu.org>
parents:
diff changeset
313 asm(" comm flag_68040, 4");
Dave Love <fx@gnu.org>
parents:
diff changeset
314 asm(" comm flag_fpa, 4");
Dave Love <fx@gnu.org>
parents:
diff changeset
315
Dave Love <fx@gnu.org>
parents:
diff changeset
316 #endif /* new hp assembler */
Dave Love <fx@gnu.org>
parents:
diff changeset
317 #endif /* hp9000s300 */
Dave Love <fx@gnu.org>
parents:
diff changeset
318
Dave Love <fx@gnu.org>
parents:
diff changeset
319 #ifdef sparc
Dave Love <fx@gnu.org>
parents:
diff changeset
320 asm (".global __start");
Dave Love <fx@gnu.org>
parents:
diff changeset
321 asm (".text");
Dave Love <fx@gnu.org>
parents:
diff changeset
322 asm ("__start:");
Dave Love <fx@gnu.org>
parents:
diff changeset
323 asm (" mov 0, %fp");
Dave Love <fx@gnu.org>
parents:
diff changeset
324 asm (" ld [%sp + 64], %o0");
Dave Love <fx@gnu.org>
parents:
diff changeset
325 asm (" add %sp, 68, %o1");
Dave Love <fx@gnu.org>
parents:
diff changeset
326 asm (" sll %o0, 2, %o2");
Dave Love <fx@gnu.org>
parents:
diff changeset
327 asm (" add %o2, 4, %o2");
Dave Love <fx@gnu.org>
parents:
diff changeset
328 asm (" add %o1, %o2, %o2");
Dave Love <fx@gnu.org>
parents:
diff changeset
329 asm (" sethi %hi(_environ), %o3");
Dave Love <fx@gnu.org>
parents:
diff changeset
330 asm (" st %o2, [%o3+%lo(_environ)]");
Dave Love <fx@gnu.org>
parents:
diff changeset
331 asm (" andn %sp, 7, %sp");
Dave Love <fx@gnu.org>
parents:
diff changeset
332 asm (" call _main");
Dave Love <fx@gnu.org>
parents:
diff changeset
333 asm (" sub %sp, 24, %sp");
Dave Love <fx@gnu.org>
parents:
diff changeset
334 asm (" call __exit");
Dave Love <fx@gnu.org>
parents:
diff changeset
335 asm (" nop");
Dave Love <fx@gnu.org>
parents:
diff changeset
336
Dave Love <fx@gnu.org>
parents:
diff changeset
337 #endif /* sparc */
Dave Love <fx@gnu.org>
parents:
diff changeset
338
Dave Love <fx@gnu.org>
parents:
diff changeset
339 #if __FreeBSD__ == 2
Dave Love <fx@gnu.org>
parents:
diff changeset
340 char *__progname;
Dave Love <fx@gnu.org>
parents:
diff changeset
341 #endif
Dave Love <fx@gnu.org>
parents:
diff changeset
342 #ifdef __bsdi__
Dave Love <fx@gnu.org>
parents:
diff changeset
343 #include <sys/param.h> /* for version number */
Dave Love <fx@gnu.org>
parents:
diff changeset
344 #if defined(_BSDI_VERSION) && (_BSDI_VERSION >= 199501)
Dave Love <fx@gnu.org>
parents:
diff changeset
345 char *__progname;
Dave Love <fx@gnu.org>
parents:
diff changeset
346 #endif
Dave Love <fx@gnu.org>
parents:
diff changeset
347 #endif /* __bsdi__ */
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
348
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
349 /* arch-tag: 4025c2fb-d6b1-4d29-b1b6-8100b6bd1e74
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
350 (do not change this comment) */