annotate src/ecrt0.c @ 249:83b3d10dcba9 r20-5b23

Import from CVS: tag r20-5b23
author cvs
date Mon, 13 Aug 2007 10:19:09 +0200
parents ac2d302a0011
children 8626e4521993
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* C code startup routine.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1985, 1986, 1992, 1993 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 /* Synched up with: FSF 19.30. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 /* The standard Vax 4.2 Unix crt0.c cannot be used for Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 because it makes `envron' an initialized variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 It is easiest to have a special crt0.c on all machines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 though I don't know whether other machines actually need it. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 /* On the vax and 68000, in BSD4.2 and USG5.2,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 this is the data format on startup:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (vax) ap and fp are unpredictable as far as I know; don't use them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 sp -> word containing argc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 word pointing to first arg string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 [word pointing to next arg string]... 0 or more times
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 Optionally:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 [word pointing to environment variable]... 1 or more times
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 And always:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 first arg string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 [next arg string]... 0 or more times
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 /* On the 16000, at least in the one 4.2 system I know about,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 the initial data format is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 sp -> word containing argc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 word containing argp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 word pointing to first arg string, and so on as above
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 #ifdef emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 #include <config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 #ifdef __GNUC__
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 #define asm __asm
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 /* Workaround for Sun cc 3.0, which doesn't handle asm's outside a fn. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 #if __SUNPRO_C >= 0x300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 #define no_toplevel_asm
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 /* ******** WARNING ********
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 Do not insert any data definitions before data_start!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 Since this is the first file linked, the address of the following
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 variable should correspond to the start of initialized data space.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 On some systems this is a constant that is independent of the text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 size for shared executables. On others, it is a function of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 text size. In short, this seems to be the most portable way to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 discover the start of initialized data space dynamically at runtime,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 for either shared or unshared executables, on either swapping or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 virtual systems. It only requires that the linker allocate objects
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 in the order encountered, a reasonable model for most Unix systems.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 Similarly, note that the address of _start() should be the start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 of text space. Fred Fish, UniSoft Systems Inc. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 int data_start = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 #ifdef NEED_ERRNO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 int errno;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 #ifndef DONT_NEED_ENVIRON
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 char **environ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 #ifndef static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 /* On systems where the static storage class is usable, this function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 should be declared as static. Otherwise, the static keyword has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 been defined to be something else, and code for those systems must
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 take care of this declaration appropriately. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 static start1 ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 #ifdef APOLLO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 extern char *malloc(), *realloc(), *(*_libc_malloc) (), *(*_libc_realloc)();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 extern void free(), (*_libc_free) (); extern int main();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 std_$call void unix_$main();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 _start()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 _libc_malloc = malloc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 _libc_realloc = realloc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 _libc_free = free;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 unix_$main(main); /* no return */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 #endif /* APOLLO */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 #if defined(orion) || defined(pyramid) || defined(celerity) || defined(ALLIANT) || defined(clipper) || defined(sps7)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 #if defined(sps7) && defined(V3x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 asm(" section 10");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 asm(" ds.b 0xb0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 #ifdef ALLIANT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 /* _start must initialize _curbrk and _minbrk on the first startup;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 when starting up after dumping, it must initialize them to what they were
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 before the dumping, since they are in the shared library and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 are not dumped. See ADJUST_EXEC_HEADER in m-alliant.h. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 extern unsigned char *_curbrk, *_minbrk;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 extern unsigned char end;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 unsigned char *_setbrk = &end;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 #ifdef ALLIANT_2800
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 unsigned char *_end = &end;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 #ifndef DUMMIES
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 #define DUMMIES
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 _start (DUMMIES argc, argv, envp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 int argc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 char **argv, **envp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 #ifdef ALLIANT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 #ifdef ALLIANT_2800
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 _curbrk = _end;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 _minbrk = _end;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 _curbrk = _setbrk;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 _minbrk = _setbrk;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 environ = envp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 exit (main (argc, argv, envp));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 #endif /* orion or pyramid or celerity or alliant or clipper */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 #if defined (ns16000) && !defined (sequent) && !defined (UMAX) && !defined (CRT0_DUMMIES)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 _start ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 /* On 16000, _start pushes fp onto stack */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 start1 ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 /* ignore takes care of skipping the fp value pushed in start. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 start1 (ignore, argc, argv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 int ignore;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 int argc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 char **argv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 environ = argv + argc + 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 if (environ == *argv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 environ--;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 exit (main (argc, argv, environ));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 #endif /* ns16000, not sequent and not UMAX, and not the CRT0_DUMMIES method */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 #ifdef UMAX
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 _start()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 asm(" exit [] # undo enter");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 asm(" .set exitsc,1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 asm(" .set sigcatchall,0x400");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 asm(" .globl _exit");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 asm(" .globl start");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 asm(" .globl __start");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 asm(" .globl _main");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 asm(" .globl _environ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 asm(" .globl _sigvec");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 asm(" .globl sigentry");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 asm("start:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 asm(" br .xstart");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 asm(" .org 0x20");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 asm(" .double p_glbl,0,0xf00000,0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 asm(" .org 0x30");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 asm(".xstart:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 asm(" adjspb $8");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 asm(" movd 8(sp),0(sp) # argc");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 asm(" addr 12(sp),r0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 asm(" movd r0,4(sp) # argv");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 asm("L1:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 asm(" movd r0,r1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 asm(" addqd $4,r0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 asm(" cmpqd $0,0(r1) # null args term ?");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 asm(" bne L1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 asm(" cmpd r0,0(4(sp)) # end of 'env' or 'argv' ?");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 asm(" blt L2");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 asm(" addqd $-4,r0 # envp's are in list");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 asm("L2:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 asm(" movd r0,8(sp) # env");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 asm(" movd r0,@_environ # indir is 0 if no env ; not 0 if env");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 asm(" movqd $0,tos # setup intermediate signal handler");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 asm(" addr @sv,tos");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 asm(" movzwd $sigcatchall,tos");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 asm(" jsr @_sigvec");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 asm(" adjspb $-12");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 asm(" jsr @_main");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 asm(" adjspb $-12");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 asm(" movd r0,tos");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 asm(" jsr @_exit");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 asm(" adjspb $-4");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 asm(" addr @exitsc,r0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 asm(" svc");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 asm(" .align 4 # sigvec arg");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 asm("sv:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 asm(" .double sigentry");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 asm(" .double 0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 asm(" .double 0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 asm(" .comm p_glbl,1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 #endif /* UMAX */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 #ifdef CRT0_DUMMIES
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 /* Define symbol "start": here; some systems want that symbol. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 #ifdef DOT_GLOBAL_START
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 asm(" .text ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 asm(" .globl start ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 asm(" start: ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 #endif /* DOT_GLOBAL_START */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 #ifdef NODOT_GLOBAL_START
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 asm(" text ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 asm(" global start ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 asm(" start: ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 #endif /* NODOT_GLOBAL_START */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 #ifdef m68000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 /* GCC 2.1, when optimization is turned off, seems to want to push a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 word of garbage on the stack, which screws up the CRT0_DUMMIES
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 hack. So we hand-code _start in assembly language. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 asm(".text ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 #ifndef sony_news
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 asm(" .even ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 #else /* sony_news (not gas) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 + asm(" .align 2 ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 #endif /* sony_news (not gas) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 asm(".globl __start ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 asm("__start: ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 asm(" link a6,#0 ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 asm(" jbsr _start1 ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 asm(" unlk a6 ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 asm(" rts ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 #else /* not m68000 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 _start ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 /* On vax, nothing is pushed here */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 /* On sequent, bogus fp is pushed here */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 start1 ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 #endif /* possibly m68000 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 #ifdef __bsdi__ /* for version number */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 #include <sys/param.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 #if defined(_BSDI_VERSION) && (_BSDI_VERSION >= 199501)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 char *__progname;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 start1 (CRT0_DUMMIES int argc, char *xargv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 char **argv = &xargv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 environ = argv + argc + 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 #if defined(_BSDI_VERSION) && (_BSDI_VERSION >= 199501)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 __progname = argv[0];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 if ((char *)environ == xargv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 environ--;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 exit (main (argc, argv, environ));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 /* Refer to `start1' so GCC will not think it is never called
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 and optimize it out. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (void) &start1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 #else /* not CRT0_DUMMIES */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 /* "m68k" and "m68000" both stand for m68000 processors,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 but with different program-entry conventions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 This is a kludge. Now that the CRT0_DUMMIES mechanism above exists,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 most of these machines could use the vax code above
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 with some suitable definition of CRT0_DUMMIES.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 Then the symbol m68k could be flushed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 But I don't want to risk breaking these machines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 in a version 17 patch release, so that change is being put off. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 #ifdef m68k /* Can't do it all from C */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 asm (" global _start");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 asm (" text");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 asm ("_start:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 #ifndef NU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 #ifdef STRIDE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 asm (" comm havefpu%,2");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 #else /* m68k, not STRIDE */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 asm (" comm splimit%,4");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 #endif /* STRIDE */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 asm (" global exit");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 asm (" text");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 #ifdef STRIDE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 asm (" trap &3");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 asm (" mov.w %d0,havefpu%");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 #else /* m68k, not STRIDE */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 asm (" mov.l %d0,splimit%");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 #endif /* STRIDE */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 #endif /* not NU */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 asm (" jsr start1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 asm (" mov.l %d0,(%sp)");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 asm (" jsr exit");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 asm (" mov.l &1,%d0"); /* d0 = 1 => exit */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 asm (" trap &0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 #else /* m68000, not m68k */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 #ifdef m68000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 #ifdef ISI68K
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 /* Added by ESM Sun May 24 12:44:02 1987 to get new ISI library to work */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 /* Edited by Ray Mon May 15 15:59:56 EST 1989 so we can compile with gcc */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 #if defined(BSD4_3) && !defined(__GNUC__)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 static foo () {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 asm (" .globl is68020");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 asm ("is68020:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 #ifndef BSD4_3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 asm (" .long 0x00000000");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 asm (" .long 0xffffffff");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 /* End of stuff added by ESM */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 asm (" .text");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 asm (" .globl __start");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 asm ("__start:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 asm (" .word 0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 asm (" link a6,#0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 asm (" jbsr _start1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 asm (" unlk a6");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 asm (" rts");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 #if defined(BSD4_3) && !defined(__GNUC__)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 #else /* not ISI68K */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 _start ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 #ifdef sun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 #ifdef LISP_FLOAT_TYPE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 finitfp_();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 /* On 68000, _start pushes a6 onto stack */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 start1 ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 #endif /* not ISI68k */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 #endif /* m68000 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 #endif /* m68k */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 #if defined(m68k) || defined(m68000)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 /* ignore takes care of skipping the a6 value pushed in start. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 #if defined(m68k)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 start1 (argc, xargv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 start1 (ignore, argc, xargv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 int argc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 char *xargv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 char **argv = &xargv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 environ = argv + argc + 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 if ((char *)environ == xargv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 environ--;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 #ifdef sun_68881
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 asm(" jsr f68881_used");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 #ifdef sun_fpa
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 asm(" jsr ffpa_used");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 #ifdef sun_soft
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 asm(" jsr start_float");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 exit (main (argc, argv, environ));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 #endif /* m68k or m68000 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 #endif /* not CRT0_DUMMIES */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 #ifdef hp9000s300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 int argc_value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 char **argv_value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 #ifdef OLD_HP_ASSEMBLER
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 asm(" text");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 asm(" globl __start");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 asm(" globl _exit");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 asm(" globl _main");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 asm("__start");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 asm(" dc.l 0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 asm(" subq.w #0x1,d0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 asm(" move.w d0,float_soft");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 asm(" move.l 0x4(a7),d0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 asm(" beq.s skip_1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 asm(" move.l d0,a0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 asm(" clr.l -0x4(a0)");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 asm("skip_1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 asm(" move.l a7,a0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 asm(" subq.l #0x8,a7");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 asm(" move.l (a0),(a7)");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 asm(" move.l (a0),_argc_value");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 asm(" addq.l #0x4,a0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 asm(" move.l a0,0x4(a7)");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 asm(" move.l a0,_argv_value");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 asm("incr_loop");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 asm(" tst.l (a0)+");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 asm(" bne.s incr_loop");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 asm(" move.l 0x4(a7),a1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 asm(" cmp.l (a1),a0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 asm(" blt.s skip_2");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 asm(" subq.l #0x4,a0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 asm("skip_2");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 asm(" move.l a0,0x8(a7)");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 asm(" move.l a0,_environ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 asm(" jsr _main");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 asm(" addq.l #0x8,a7");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 asm(" move.l d0,-(a7)");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 asm(" jsr _exit");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 asm(" move.w #0x1,d0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 asm(" trap #0x0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 asm(" comm float_soft,4");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 /* float_soft is allocated in this way because C would
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 put an underscore character in its name otherwise. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 #else /* new hp assembler */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 asm(" text");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 asm(" global float_loc");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 asm(" set float_loc,0xFFFFB000");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 asm(" global fpa_loc");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 asm(" set fpa_loc,0xfff08000");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 asm(" global __start");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 asm(" global _exit");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 asm(" global _main");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 asm("__start:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 asm(" byte 0,0,0,0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 asm(" subq.w &1,%d0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 asm(" mov.w %d0,float_soft");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 asm(" mov.w %d1,flag_68881");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 #ifndef HPUX_68010
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 asm(" beq.b skip_float");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 asm(" fmov.l &0x7400,%fpcr");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 /* asm(" fmov.l &0x7480,%fpcr"); */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 #endif /* HPUX_68010 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 asm("skip_float:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 asm(" mov.l %a0,%d0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 asm(" add.l %d0,%d0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 asm(" subx.w %d1,%d1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 asm(" mov.w %d1,flag_68010");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 asm(" add.l %d0,%d0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 asm(" subx.w %d1,%d1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 asm(" mov.w %d1,flag_fpa");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 asm(" tst.l %d2");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 asm(" ble.b skip_3");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 asm(" lsl flag_68881");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 asm(" lsl flag_fpa");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 asm("skip_3:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 asm(" mov.l 4(%a7),%d0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 asm(" beq.b skip_1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 asm(" mov.l %d0,%a0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 asm(" clr.l -4(%a0)");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 asm("skip_1:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 asm(" mov.l %a7,%a0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 asm(" subq.l &8,%a7");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 asm(" mov.l (%a0),(%a7)");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 asm(" mov.l (%a0),_argc_value");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 asm(" addq.l &4,%a0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 asm(" mov.l %a0,4(%a7)");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 asm(" mov.l %a0,_argv_value");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 asm("incr_loop:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 asm(" tst.l (%a0)+");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 asm(" bne.b incr_loop");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 asm(" mov.l 4(%a7),%a1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 asm(" cmp.l %a0,(%a1)");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 asm(" blt.b skip_2");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 asm(" subq.l &4,%a0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 asm("skip_2:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 asm(" mov.l %a0,8(%a7)");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 asm(" mov.l %a0,_environ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 asm(" jsr _main");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 asm(" addq.l &8,%a7");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 asm(" mov.l %d0,-(%a7)");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 asm(" jsr _exit");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 asm(" mov.w &1,%d0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 asm(" trap &0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 asm(" comm float_soft, 4");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 asm(" comm flag_68881, 4");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 asm(" comm flag_68010, 4");
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
524 asm(" comm flag_68040, 4");
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 asm(" comm flag_fpa, 4");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 #endif /* new hp assembler */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 #endif /* hp9000s300 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 #ifdef GOULD
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 /* startup code has to be in near text rather
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 than fartext as allocated by the C compiler. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 asm(" .text");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 asm(" .align 2");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 asm(" .globl __start");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 asm(" .text");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 asm("__start:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 /* setup base register b1 (function base). */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 asm(" .using b1,.");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 asm(" tpcbr b1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 /* setup base registers b3 through b7 (data references). */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 asm(" file basevals,b3");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 /* setup base register b2 (stack pointer); it should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 aligned on a 8-word boundary; but because it is pointing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 to argc, its value should be remembered (in r5). */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 asm(" movw b2,r4");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 asm(" movw b2,r5");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 asm(" andw #~0x1f,r4");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 asm(" movw r4,b2");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 /* allocate stack frame to do some work. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 asm(" subea 16w,b2");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 /* initialize signal catching for UTX/32 1.2; this is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 necessary to make restart from saved image work. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 asm(" movea sigcatch,r1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 asm(" movw r1,8w[b2]");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 asm(" svc #1,#150");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 /* setup address of argc for start1. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 asm(" movw r5,8w[b2]");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 asm(" func #1,_start1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 asm(" halt");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 /* space for ld to store base register initial values. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 asm(" .align 5");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 asm("basevals:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 asm(" .word __base3,__base4,__base5,__base6,__base7");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 start1 (xargc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 int *xargc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 int argc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 char **argv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 argc = *xargc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 argv = (char **)(xargc) + 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 environ = argv + argc + 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 if (environ == argv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 environ--;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 exit (main (argc, argv, environ));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 #endif /* GOULD */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 #ifdef elxsi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 #include <elxsi/argvcache.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 extern char **environ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 extern int errno;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 extern void _init_doscan(), _init_iob();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 extern char end[];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 char *_init_brk = end;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 _start()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 environ = exec_cache.ac_envp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 brk (_init_brk);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 errno = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 _init_doscan ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 _init_iob ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 _exit (exit (main (exec_cache.ac_argc,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 exec_cache.ac_argv,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 exec_cache.ac_envp)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 #endif /* elxsi */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 #ifdef sparc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 #ifdef no_toplevel_asm
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 static no_toplevel_asm_wrapper() {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 #ifdef USG5_4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 asm (".pushsection \".text\"");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 #endif /* USG5_4 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 #endif /* no_toplevel_asm */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 #ifdef USG5_4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 asm (".global _start");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 asm (".text");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 asm ("_start:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 asm (" mov 0, %fp");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 asm (" ld [%sp + 64], %o0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 asm (" add %sp, 68, %o1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 asm (" sll %o0, 2, %o2");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 asm (" add %o2, 4, %o2");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 asm (" add %o1, %o2, %o2");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 asm (" sethi %hi(_environ), %o3");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 asm (" st %o2, [%o3+%lo(_environ)]");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 asm (" andn %sp, 7, %sp");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 asm (" call main");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 asm (" sub %sp, 24, %sp");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 asm (" call _exit");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 asm (" nop");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 asm (".global __start");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 asm (".text");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 asm ("__start:");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 asm (" mov 0, %fp");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 asm (" ld [%sp + 64], %o0");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 asm (" add %sp, 68, %o1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 asm (" sll %o0, 2, %o2");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 asm (" add %o2, 4, %o2");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 asm (" add %o1, %o2, %o2");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 asm (" sethi %hi(_environ), %o3");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 asm (" st %o2, [%o3+%lo(_environ)]");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 asm (" andn %sp, 7, %sp");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 asm (" call _main");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 asm (" sub %sp, 24, %sp");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 asm (" call __exit");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 asm (" nop");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 #endif /* USG5_4 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 #ifdef no_toplevel_asm
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 #ifdef USG5_4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 asm (".popsection");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 #endif /* USG5_4 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 } /* no_toplevel_asm_wrapper() */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 #endif /* no_toplevel_asm */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 #endif /* sparc */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 #if __FreeBSD__ == 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 char *__progname;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 #ifdef __bsdi__
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 #include <sys/param.h> /* for version number */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 #if defined(_BSDI_VERSION) && (_BSDI_VERSION >= 199501)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 char *__progname;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 #endif /* __bsdi__ */