Mercurial > hg > xemacs-beta
comparison src/ecrt0.c @ 4759:aa5ed11f473b
Remove support for obsolete systems. See xemacs-patches message with ID
<870180fe0911101613m6b8efa4bpf083fd9013950807@mail.gmail.com>.
author | Jerry James <james@xemacs.org> |
---|---|
date | Wed, 18 Nov 2009 08:49:14 -0700 |
parents | 8b464283e891 |
children | 308d34e9f07d |
comparison
equal
deleted
inserted
replaced
4758:75975fd0b7fc | 4759:aa5ed11f473b |
---|---|
81 | 81 |
82 #ifdef NEED_ERRNO | 82 #ifdef NEED_ERRNO |
83 int errno; | 83 int errno; |
84 #endif | 84 #endif |
85 | 85 |
86 #ifndef DONT_NEED_ENVIRON | |
87 char **environ; | 86 char **environ; |
88 #endif | |
89 | 87 |
90 #ifndef static | 88 #ifndef static |
91 /* On systems where the static storage class is usable, this function | 89 /* On systems where the static storage class is usable, this function |
92 should be declared as static. Otherwise, the static keyword has | 90 should be declared as static. Otherwise, the static keyword has |
93 been defined to be something else, and code for those systems must | 91 been defined to be something else, and code for those systems must |
94 take care of this declaration appropriately. */ | 92 take care of this declaration appropriately. */ |
95 static start1 (); | 93 static start1 (); |
96 #endif | 94 #endif |
97 | |
98 #ifdef APOLLO | |
99 extern char *malloc(), *realloc(), *(*_libc_malloc) (), *(*_libc_realloc)(); | |
100 extern void free(), (*_libc_free) (); extern int main(); | |
101 std_$call void unix_$main(); | |
102 | |
103 _start() | |
104 { | |
105 _libc_malloc = malloc; | |
106 _libc_realloc = realloc; | |
107 _libc_free = free; | |
108 unix_$main(main); /* no return */ | |
109 } | |
110 #endif /* APOLLO */ | |
111 | |
112 #if defined(orion) || defined(pyramid) || defined(celerity) || defined(ALLIANT) || defined(clipper) || defined(sps7) | |
113 | |
114 #if defined(sps7) && defined(V3x) | |
115 asm(" section 10"); | |
116 asm(" ds.b 0xb0"); | |
117 #endif | |
118 | |
119 #ifdef ALLIANT | |
120 /* _start must initialize _curbrk and _minbrk on the first startup; | |
121 when starting up after dumping, it must initialize them to what they were | |
122 before the dumping, since they are in the shared library and | |
123 are not dumped. See ADJUST_EXEC_HEADER in m-alliant.h. */ | |
124 extern unsigned char *_curbrk, *_minbrk; | |
125 extern unsigned char end; | |
126 unsigned char *_setbrk = &end; | |
127 #ifdef ALLIANT_2800 | |
128 unsigned char *_end = &end; | |
129 #endif | |
130 #endif | |
131 | |
132 #ifndef DUMMIES | |
133 #define DUMMIES | |
134 #endif | |
135 | |
136 _start (DUMMIES argc, argv, envp) | |
137 int argc; | |
138 char **argv, **envp; | |
139 { | |
140 #ifdef ALLIANT | |
141 #ifdef ALLIANT_2800 | |
142 _curbrk = _end; | |
143 _minbrk = _end; | |
144 #else | |
145 _curbrk = _setbrk; | |
146 _minbrk = _setbrk; | |
147 #endif | |
148 #endif | |
149 | |
150 environ = envp; | |
151 | |
152 exit (main (argc, argv, envp)); | |
153 } | |
154 | |
155 #endif /* orion or pyramid or celerity or alliant or clipper */ | |
156 | |
157 #if defined (ns16000) && !defined (sequent) && !defined (UMAX) && !defined (CRT0_DUMMIES) | |
158 | |
159 _start () | |
160 { | |
161 /* On 16000, _start pushes fp onto stack */ | |
162 start1 (); | |
163 } | |
164 | |
165 /* ignore takes care of skipping the fp value pushed in start. */ | |
166 static | |
167 start1 (ignore, argc, argv) | |
168 int ignore; | |
169 int argc; | |
170 char **argv; | |
171 { | |
172 environ = argv + argc + 1; | |
173 | |
174 if (environ == *argv) | |
175 environ--; | |
176 exit (main (argc, argv, environ)); | |
177 } | |
178 #endif /* ns16000, not sequent and not UMAX, and not the CRT0_DUMMIES method */ | |
179 | |
180 #ifdef UMAX | |
181 _start() | |
182 { | |
183 asm(" exit [] # undo enter"); | |
184 asm(" .set exitsc,1"); | |
185 asm(" .set sigcatchall,0x400"); | |
186 | |
187 asm(" .globl _exit"); | |
188 asm(" .globl start"); | |
189 asm(" .globl __start"); | |
190 asm(" .globl _main"); | |
191 asm(" .globl _environ"); | |
192 asm(" .globl _sigvec"); | |
193 asm(" .globl sigentry"); | |
194 | |
195 asm("start:"); | |
196 asm(" br .xstart"); | |
197 asm(" .org 0x20"); | |
198 asm(" .double p_glbl,0,0xf00000,0"); | |
199 asm(" .org 0x30"); | |
200 asm(".xstart:"); | |
201 asm(" adjspb $8"); | |
202 asm(" movd 8(sp),0(sp) # argc"); | |
203 asm(" addr 12(sp),r0"); | |
204 asm(" movd r0,4(sp) # argv"); | |
205 asm("L1:"); | |
206 asm(" movd r0,r1"); | |
207 asm(" addqd $4,r0"); | |
208 asm(" cmpqd $0,0(r1) # null args term ?"); | |
209 asm(" bne L1"); | |
210 asm(" cmpd r0,0(4(sp)) # end of 'env' or 'argv' ?"); | |
211 asm(" blt L2"); | |
212 asm(" addqd $-4,r0 # envp's are in list"); | |
213 asm("L2:"); | |
214 asm(" movd r0,8(sp) # env"); | |
215 asm(" movd r0,@_environ # indir is 0 if no env ; not 0 if env"); | |
216 asm(" movqd $0,tos # setup intermediate signal handler"); | |
217 asm(" addr @sv,tos"); | |
218 asm(" movzwd $sigcatchall,tos"); | |
219 asm(" jsr @_sigvec"); | |
220 asm(" adjspb $-12"); | |
221 asm(" jsr @_main"); | |
222 asm(" adjspb $-12"); | |
223 asm(" movd r0,tos"); | |
224 asm(" jsr @_exit"); | |
225 asm(" adjspb $-4"); | |
226 asm(" addr @exitsc,r0"); | |
227 asm(" svc"); | |
228 asm(" .align 4 # sigvec arg"); | |
229 asm("sv:"); | |
230 asm(" .double sigentry"); | |
231 asm(" .double 0"); | |
232 asm(" .double 0"); | |
233 | |
234 asm(" .comm p_glbl,1"); | |
235 } | |
236 #endif /* UMAX */ | |
237 | 95 |
238 #ifdef CRT0_DUMMIES | 96 #ifdef CRT0_DUMMIES |
239 | 97 |
240 /* Define symbol "start": here; some systems want that symbol. */ | 98 /* Define symbol "start": here; some systems want that symbol. */ |
241 #ifdef DOT_GLOBAL_START | 99 #ifdef DOT_GLOBAL_START |
271 #else /* not m68000 */ | 129 #else /* not m68000 */ |
272 | 130 |
273 int | 131 int |
274 _start () | 132 _start () |
275 { | 133 { |
276 /* On vax, nothing is pushed here */ | |
277 /* On sequent, bogus fp is pushed here */ | |
278 start1 (); | 134 start1 (); |
279 } | 135 } |
280 | 136 |
281 #endif /* possibly m68000 */ | 137 #endif /* possibly m68000 */ |
282 | 138 |
339 asm (" mov.l &1,%d0"); /* d0 = 1 => exit */ | 195 asm (" mov.l &1,%d0"); /* d0 = 1 => exit */ |
340 asm (" trap &0"); | 196 asm (" trap &0"); |
341 #else /* m68000, not m68k */ | 197 #else /* m68000, not m68k */ |
342 | 198 |
343 #ifdef m68000 | 199 #ifdef m68000 |
344 | |
345 #ifdef ISI68K | |
346 /* Added by ESM Sun May 24 12:44:02 1987 to get new ISI library to work */ | |
347 /* Edited by Ray Mon May 15 15:59:56 EST 1989 so we can compile with gcc */ | |
348 #if defined(BSD4_3) && !defined(__GNUC__) | |
349 static foo () { | |
350 #endif | |
351 asm (" .globl is68020"); | |
352 asm ("is68020:"); | |
353 #ifndef BSD4_3 | |
354 asm (" .long 0x00000000"); | |
355 asm (" .long 0xffffffff"); | |
356 /* End of stuff added by ESM */ | |
357 #endif | |
358 asm (" .text"); | |
359 asm (" .globl __start"); | |
360 asm ("__start:"); | |
361 asm (" .word 0"); | |
362 asm (" link a6,#0"); | |
363 asm (" jbsr _start1"); | |
364 asm (" unlk a6"); | |
365 asm (" rts"); | |
366 #if defined(BSD4_3) && !defined(__GNUC__) | |
367 } | |
368 #endif | |
369 #else /* not ISI68K */ | |
370 | |
371 _start () | 200 _start () |
372 { | 201 { |
373 #ifdef sun | 202 #ifdef sun |
374 finitfp_(); | 203 finitfp_(); |
375 #endif | 204 #endif |
376 /* On 68000, _start pushes a6 onto stack */ | 205 /* On 68000, _start pushes a6 onto stack */ |
377 start1 (); | 206 start1 (); |
378 } | 207 } |
379 #endif /* not ISI68k */ | |
380 #endif /* m68000 */ | 208 #endif /* m68000 */ |
381 #endif /* m68k */ | 209 #endif /* m68k */ |
382 | 210 |
383 #if defined(m68k) || defined(m68000) | 211 #if defined(m68k) || defined(m68000) |
384 /* ignore takes care of skipping the a6 value pushed in start. */ | 212 /* ignore takes care of skipping the a6 value pushed in start. */ |
409 } | 237 } |
410 | 238 |
411 #endif /* m68k or m68000 */ | 239 #endif /* m68k or m68000 */ |
412 | 240 |
413 #endif /* not CRT0_DUMMIES */ | 241 #endif /* not CRT0_DUMMIES */ |
414 | |
415 #ifdef hp9000s300 | |
416 int argc_value; | |
417 char **argv_value; | |
418 #ifdef OLD_HP_ASSEMBLER | |
419 asm(" text"); | |
420 asm(" globl __start"); | |
421 asm(" globl _exit"); | |
422 asm(" globl _main"); | |
423 asm("__start"); | |
424 asm(" dc.l 0"); | |
425 asm(" subq.w #0x1,d0"); | |
426 asm(" move.w d0,float_soft"); | |
427 asm(" move.l 0x4(a7),d0"); | |
428 asm(" beq.s skip_1"); | |
429 asm(" move.l d0,a0"); | |
430 asm(" clr.l -0x4(a0)"); | |
431 asm("skip_1"); | |
432 asm(" move.l a7,a0"); | |
433 asm(" subq.l #0x8,a7"); | |
434 asm(" move.l (a0),(a7)"); | |
435 asm(" move.l (a0),_argc_value"); | |
436 asm(" addq.l #0x4,a0"); | |
437 asm(" move.l a0,0x4(a7)"); | |
438 asm(" move.l a0,_argv_value"); | |
439 asm("incr_loop"); | |
440 asm(" tst.l (a0)+"); | |
441 asm(" bne.s incr_loop"); | |
442 asm(" move.l 0x4(a7),a1"); | |
443 asm(" cmp.l (a1),a0"); | |
444 asm(" blt.s skip_2"); | |
445 asm(" subq.l #0x4,a0"); | |
446 asm("skip_2"); | |
447 asm(" move.l a0,0x8(a7)"); | |
448 asm(" move.l a0,_environ"); | |
449 asm(" jsr _main"); | |
450 asm(" addq.l #0x8,a7"); | |
451 asm(" move.l d0,-(a7)"); | |
452 asm(" jsr _exit"); | |
453 asm(" move.w #0x1,d0"); | |
454 asm(" trap #0x0"); | |
455 asm(" comm float_soft,4"); | |
456 /* float_soft is allocated in this way because C would | |
457 put an underscore character in its name otherwise. */ | |
458 | |
459 #else /* new hp assembler */ | |
460 | |
461 asm(" text"); | |
462 asm(" global float_loc"); | |
463 asm(" set float_loc,0xFFFFB000"); | |
464 asm(" global fpa_loc"); | |
465 asm(" set fpa_loc,0xfff08000"); | |
466 asm(" global __start"); | |
467 asm(" global _exit"); | |
468 asm(" global _main"); | |
469 asm("__start:"); | |
470 asm(" byte 0,0,0,0"); | |
471 asm(" subq.w &1,%d0"); | |
472 asm(" mov.w %d0,float_soft"); | |
473 asm(" mov.w %d1,flag_68881"); | |
474 #ifndef HPUX_68010 | |
475 asm(" beq.b skip_float"); | |
476 asm(" fmov.l &0x7400,%fpcr"); | |
477 /* asm(" fmov.l &0x7480,%fpcr"); */ | |
478 #endif /* HPUX_68010 */ | |
479 asm("skip_float:"); | |
480 asm(" mov.l %a0,%d0"); | |
481 asm(" add.l %d0,%d0"); | |
482 asm(" subx.w %d1,%d1"); | |
483 asm(" mov.w %d1,flag_68010"); | |
484 asm(" add.l %d0,%d0"); | |
485 asm(" subx.w %d1,%d1"); | |
486 asm(" mov.w %d1,flag_fpa"); | |
487 asm(" tst.l %d2"); | |
488 asm(" ble.b skip_3"); | |
489 asm(" lsl flag_68881"); | |
490 asm(" lsl flag_fpa"); | |
491 asm("skip_3:"); | |
492 asm(" mov.l 4(%a7),%d0"); | |
493 asm(" beq.b skip_1"); | |
494 asm(" mov.l %d0,%a0"); | |
495 asm(" clr.l -4(%a0)"); | |
496 asm("skip_1:"); | |
497 asm(" mov.l %a7,%a0"); | |
498 asm(" subq.l &8,%a7"); | |
499 asm(" mov.l (%a0),(%a7)"); | |
500 asm(" mov.l (%a0),_argc_value"); | |
501 asm(" addq.l &4,%a0"); | |
502 asm(" mov.l %a0,4(%a7)"); | |
503 asm(" mov.l %a0,_argv_value"); | |
504 asm("incr_loop:"); | |
505 asm(" tst.l (%a0)+"); | |
506 asm(" bne.b incr_loop"); | |
507 asm(" mov.l 4(%a7),%a1"); | |
508 asm(" cmp.l %a0,(%a1)"); | |
509 asm(" blt.b skip_2"); | |
510 asm(" subq.l &4,%a0"); | |
511 asm("skip_2:"); | |
512 asm(" mov.l %a0,8(%a7)"); | |
513 asm(" mov.l %a0,_environ"); | |
514 asm(" jsr _main"); | |
515 asm(" addq.l &8,%a7"); | |
516 asm(" mov.l %d0,-(%a7)"); | |
517 asm(" jsr _exit"); | |
518 asm(" mov.w &1,%d0"); | |
519 asm(" trap &0"); | |
520 asm(" comm float_soft, 4"); | |
521 asm(" comm flag_68881, 4"); | |
522 asm(" comm flag_68010, 4"); | |
523 asm(" comm flag_68040, 4"); | |
524 asm(" comm flag_fpa, 4"); | |
525 | |
526 #endif /* new hp assembler */ | |
527 #endif /* hp9000s300 */ | |
528 | |
529 #ifdef GOULD | |
530 | |
531 /* startup code has to be in near text rather | |
532 than fartext as allocated by the C compiler. */ | |
533 asm(" .text"); | |
534 asm(" .align 2"); | |
535 asm(" .globl __start"); | |
536 asm(" .text"); | |
537 asm("__start:"); | |
538 /* setup base register b1 (function base). */ | |
539 asm(" .using b1,."); | |
540 asm(" tpcbr b1"); | |
541 /* setup base registers b3 through b7 (data references). */ | |
542 asm(" file basevals,b3"); | |
543 /* setup base register b2 (stack pointer); it should be | |
544 aligned on a 8-word boundary; but because it is pointing | |
545 to argc, its value should be remembered (in r5). */ | |
546 asm(" movw b2,r4"); | |
547 asm(" movw b2,r5"); | |
548 asm(" andw #~0x1f,r4"); | |
549 asm(" movw r4,b2"); | |
550 /* allocate stack frame to do some work. */ | |
551 asm(" subea 16w,b2"); | |
552 /* initialize signal catching for UTX/32 1.2; this is | |
553 necessary to make restart from saved image work. */ | |
554 asm(" movea sigcatch,r1"); | |
555 asm(" movw r1,8w[b2]"); | |
556 asm(" svc #1,#150"); | |
557 /* setup address of argc for start1. */ | |
558 asm(" movw r5,8w[b2]"); | |
559 asm(" func #1,_start1"); | |
560 asm(" halt"); | |
561 /* space for ld to store base register initial values. */ | |
562 asm(" .align 5"); | |
563 asm("basevals:"); | |
564 asm(" .word __base3,__base4,__base5,__base6,__base7"); | |
565 | |
566 static | |
567 start1 (xargc) | |
568 int *xargc; | |
569 { | |
570 int argc; | |
571 char **argv; | |
572 | |
573 argc = *xargc; | |
574 argv = (char **)(xargc) + 1; | |
575 environ = argv + argc + 1; | |
576 | |
577 if (environ == argv) | |
578 environ--; | |
579 exit (main (argc, argv, environ)); | |
580 | |
581 } | |
582 | |
583 #endif /* GOULD */ | |
584 | |
585 #ifdef elxsi | |
586 #include <elxsi/argvcache.h> | |
587 | |
588 extern char **environ; | |
589 extern int errno; | |
590 extern void _init_doscan(), _init_iob(); | |
591 extern char end[]; | |
592 char *_init_brk = end; | |
593 | |
594 _start() | |
595 { | |
596 environ = exec_cache.ac_envp; | |
597 brk (_init_brk); | |
598 errno = 0; | |
599 _init_doscan (); | |
600 _init_iob (); | |
601 _exit (exit (main (exec_cache.ac_argc, | |
602 exec_cache.ac_argv, | |
603 exec_cache.ac_envp))); | |
604 } | |
605 #endif /* elxsi */ | |
606 | |
607 | 242 |
608 #ifdef sparc | 243 #ifdef sparc |
609 #ifdef no_toplevel_asm | 244 #ifdef no_toplevel_asm |
610 static no_toplevel_asm_wrapper() { | 245 static no_toplevel_asm_wrapper() { |
611 #ifdef USG5_4 | 246 #ifdef USG5_4 |