diff options
Diffstat (limited to 'src/ecrt0.c')
| -rw-r--r-- | src/ecrt0.c | 266 |
1 files changed, 0 insertions, 266 deletions
diff --git a/src/ecrt0.c b/src/ecrt0.c index 36f6caeceb9..41bd1c8b323 100644 --- a/src/ecrt0.c +++ b/src/ecrt0.c | |||
| @@ -84,146 +84,6 @@ char **environ; | |||
| 84 | static start1 (); | 84 | static start1 (); |
| 85 | #endif | 85 | #endif |
| 86 | 86 | ||
| 87 | #ifdef APOLLO | ||
| 88 | extern char *malloc(), *realloc(), *(*_libc_malloc) (), *(*_libc_realloc)(); | ||
| 89 | extern void free(), (*_libc_free) (); extern int main(); | ||
| 90 | std_$call void unix_$main(); | ||
| 91 | |||
| 92 | _start() | ||
| 93 | { | ||
| 94 | _libc_malloc = malloc; | ||
| 95 | _libc_realloc = realloc; | ||
| 96 | _libc_free = free; | ||
| 97 | unix_$main(main); /* no return */ | ||
| 98 | } | ||
| 99 | #endif /* APOLLO */ | ||
| 100 | |||
| 101 | #if defined(orion) || defined(pyramid) || defined(celerity) || defined(ALLIANT) || defined(clipper) || defined(sps7) | ||
| 102 | |||
| 103 | #if defined(sps7) && defined(V3x) | ||
| 104 | asm(" section 10"); | ||
| 105 | asm(" ds.b 0xb0"); | ||
| 106 | #endif | ||
| 107 | |||
| 108 | #ifdef ALLIANT | ||
| 109 | /* _start must initialize _curbrk and _minbrk on the first startup; | ||
| 110 | when starting up after dumping, it must initialize them to what they were | ||
| 111 | before the dumping, since they are in the shared library and | ||
| 112 | are not dumped. See ADJUST_EXEC_HEADER in m-alliant.h. */ | ||
| 113 | extern unsigned char *_curbrk, *_minbrk; | ||
| 114 | extern unsigned char end; | ||
| 115 | unsigned char *_setbrk = &end; | ||
| 116 | #ifdef ALLIANT_2800 | ||
| 117 | unsigned char *_end = &end; | ||
| 118 | #endif | ||
| 119 | #endif | ||
| 120 | |||
| 121 | #ifndef DUMMIES | ||
| 122 | #define DUMMIES | ||
| 123 | #endif | ||
| 124 | |||
| 125 | _start (DUMMIES argc, argv, envp) | ||
| 126 | int argc; | ||
| 127 | char **argv, **envp; | ||
| 128 | { | ||
| 129 | #ifdef ALLIANT | ||
| 130 | #ifdef ALLIANT_2800 | ||
| 131 | _curbrk = _end; | ||
| 132 | _minbrk = _end; | ||
| 133 | #else | ||
| 134 | _curbrk = _setbrk; | ||
| 135 | _minbrk = _setbrk; | ||
| 136 | #endif | ||
| 137 | #endif | ||
| 138 | |||
| 139 | environ = envp; | ||
| 140 | |||
| 141 | exit (main (argc, argv, envp)); | ||
| 142 | } | ||
| 143 | |||
| 144 | #endif /* orion or pyramid or celerity or alliant or clipper */ | ||
| 145 | |||
| 146 | #if defined (ns16000) && !defined (sequent) && !defined (UMAX) && !defined (CRT0_DUMMIES) | ||
| 147 | |||
| 148 | _start () | ||
| 149 | { | ||
| 150 | /* On 16000, _start pushes fp onto stack */ | ||
| 151 | start1 (); | ||
| 152 | } | ||
| 153 | |||
| 154 | /* ignore takes care of skipping the fp value pushed in start. */ | ||
| 155 | static | ||
| 156 | start1 (ignore, argc, argv) | ||
| 157 | int ignore; | ||
| 158 | int argc; | ||
| 159 | register char **argv; | ||
| 160 | { | ||
| 161 | environ = argv + argc + 1; | ||
| 162 | |||
| 163 | if (environ == *argv) | ||
| 164 | environ--; | ||
| 165 | exit (main (argc, argv, environ)); | ||
| 166 | } | ||
| 167 | #endif /* ns16000, not sequent and not UMAX, and not the CRT0_DUMMIES method */ | ||
| 168 | |||
| 169 | #ifdef UMAX | ||
| 170 | _start() | ||
| 171 | { | ||
| 172 | asm(" exit [] # undo enter"); | ||
| 173 | asm(" .set exitsc,1"); | ||
| 174 | asm(" .set sigcatchall,0x400"); | ||
| 175 | |||
| 176 | asm(" .globl _exit"); | ||
| 177 | asm(" .globl start"); | ||
| 178 | asm(" .globl __start"); | ||
| 179 | asm(" .globl _main"); | ||
| 180 | asm(" .globl _environ"); | ||
| 181 | asm(" .globl _sigvec"); | ||
| 182 | asm(" .globl sigentry"); | ||
| 183 | |||
| 184 | asm("start:"); | ||
| 185 | asm(" br .xstart"); | ||
| 186 | asm(" .org 0x20"); | ||
| 187 | asm(" .double p_glbl,0,0xf00000,0"); | ||
| 188 | asm(" .org 0x30"); | ||
| 189 | asm(".xstart:"); | ||
| 190 | asm(" adjspb $8"); | ||
| 191 | asm(" movd 8(sp),0(sp) # argc"); | ||
| 192 | asm(" addr 12(sp),r0"); | ||
| 193 | asm(" movd r0,4(sp) # argv"); | ||
| 194 | asm("L1:"); | ||
| 195 | asm(" movd r0,r1"); | ||
| 196 | asm(" addqd $4,r0"); | ||
| 197 | asm(" cmpqd $0,0(r1) # null args term ?"); | ||
| 198 | asm(" bne L1"); | ||
| 199 | asm(" cmpd r0,0(4(sp)) # end of 'env' or 'argv' ?"); | ||
| 200 | asm(" blt L2"); | ||
| 201 | asm(" addqd $-4,r0 # envp's are in list"); | ||
| 202 | asm("L2:"); | ||
| 203 | asm(" movd r0,8(sp) # env"); | ||
| 204 | asm(" movd r0,@_environ # indir is 0 if no env ; not 0 if env"); | ||
| 205 | asm(" movqd $0,tos # setup intermediate signal handler"); | ||
| 206 | asm(" addr @sv,tos"); | ||
| 207 | asm(" movzwd $sigcatchall,tos"); | ||
| 208 | asm(" jsr @_sigvec"); | ||
| 209 | asm(" adjspb $-12"); | ||
| 210 | asm(" jsr @_main"); | ||
| 211 | asm(" adjspb $-12"); | ||
| 212 | asm(" movd r0,tos"); | ||
| 213 | asm(" jsr @_exit"); | ||
| 214 | asm(" adjspb $-4"); | ||
| 215 | asm(" addr @exitsc,r0"); | ||
| 216 | asm(" svc"); | ||
| 217 | asm(" .align 4 # sigvec arg"); | ||
| 218 | asm("sv:"); | ||
| 219 | asm(" .double sigentry"); | ||
| 220 | asm(" .double 0"); | ||
| 221 | asm(" .double 0"); | ||
| 222 | |||
| 223 | asm(" .comm p_glbl,1"); | ||
| 224 | } | ||
| 225 | #endif /* UMAX */ | ||
| 226 | |||
| 227 | #ifdef CRT0_DUMMIES | 87 | #ifdef CRT0_DUMMIES |
| 228 | 88 | ||
| 229 | /* Define symbol "start": here; some systems want that symbol. */ | 89 | /* Define symbol "start": here; some systems want that symbol. */ |
| @@ -295,21 +155,10 @@ start1 (CRT0_DUMMIES argc, xargv) | |||
| 295 | asm (" global _start"); | 155 | asm (" global _start"); |
| 296 | asm (" text"); | 156 | asm (" text"); |
| 297 | asm ("_start:"); | 157 | asm ("_start:"); |
| 298 | #ifndef NU | ||
| 299 | #ifdef STRIDE | ||
| 300 | asm (" comm havefpu%,2"); | ||
| 301 | #else /* m68k, not STRIDE */ | ||
| 302 | asm (" comm splimit%,4"); | 158 | asm (" comm splimit%,4"); |
| 303 | #endif /* STRIDE */ | ||
| 304 | asm (" global exit"); | 159 | asm (" global exit"); |
| 305 | asm (" text"); | 160 | asm (" text"); |
| 306 | #ifdef STRIDE | ||
| 307 | asm (" trap &3"); | ||
| 308 | asm (" mov.w %d0,havefpu%"); | ||
| 309 | #else /* m68k, not STRIDE */ | ||
| 310 | asm (" mov.l %d0,splimit%"); | 161 | asm (" mov.l %d0,splimit%"); |
| 311 | #endif /* STRIDE */ | ||
| 312 | #endif /* not NU */ | ||
| 313 | asm (" jsr start1"); | 162 | asm (" jsr start1"); |
| 314 | asm (" mov.l %d0,(%sp)"); | 163 | asm (" mov.l %d0,(%sp)"); |
| 315 | asm (" jsr exit"); | 164 | asm (" jsr exit"); |
| @@ -319,32 +168,6 @@ start1 (CRT0_DUMMIES argc, xargv) | |||
| 319 | 168 | ||
| 320 | #ifdef m68000 | 169 | #ifdef m68000 |
| 321 | 170 | ||
| 322 | #ifdef ISI68K | ||
| 323 | /* Added by ESM Sun May 24 12:44:02 1987 to get new ISI library to work */ | ||
| 324 | /* Edited by Ray Mon May 15 15:59:56 EST 1989 so we can compile with gcc */ | ||
| 325 | #if defined(BSD4_3) && !defined(__GNUC__) | ||
| 326 | static foo () { | ||
| 327 | #endif | ||
| 328 | asm (" .globl is68020"); | ||
| 329 | asm ("is68020:"); | ||
| 330 | #ifndef BSD4_3 | ||
| 331 | asm (" .long 0x00000000"); | ||
| 332 | asm (" .long 0xffffffff"); | ||
| 333 | /* End of stuff added by ESM */ | ||
| 334 | #endif | ||
| 335 | asm (" .text"); | ||
| 336 | asm (" .globl __start"); | ||
| 337 | asm ("__start:"); | ||
| 338 | asm (" .word 0"); | ||
| 339 | asm (" link a6,#0"); | ||
| 340 | asm (" jbsr _start1"); | ||
| 341 | asm (" unlk a6"); | ||
| 342 | asm (" rts"); | ||
| 343 | #if defined(BSD4_3) && !defined(__GNUC__) | ||
| 344 | } | ||
| 345 | #endif | ||
| 346 | #else /* not ISI68K */ | ||
| 347 | |||
| 348 | _start () | 171 | _start () |
| 349 | { | 172 | { |
| 350 | #ifdef sun | 173 | #ifdef sun |
| @@ -353,7 +176,6 @@ _start () | |||
| 353 | /* On 68000, _start pushes a6 onto stack */ | 176 | /* On 68000, _start pushes a6 onto stack */ |
| 354 | start1 (); | 177 | start1 (); |
| 355 | } | 178 | } |
| 356 | #endif /* not ISI68k */ | ||
| 357 | #endif /* m68000 */ | 179 | #endif /* m68000 */ |
| 358 | #endif /* m68k */ | 180 | #endif /* m68k */ |
| 359 | 181 | ||
| @@ -373,15 +195,6 @@ start1 (ignore, argc, xargv) | |||
| 373 | 195 | ||
| 374 | if ((char *)environ == xargv) | 196 | if ((char *)environ == xargv) |
| 375 | environ--; | 197 | environ--; |
| 376 | #ifdef sun_68881 | ||
| 377 | asm(" jsr f68881_used"); | ||
| 378 | #endif | ||
| 379 | #ifdef sun_fpa | ||
| 380 | asm(" jsr ffpa_used"); | ||
| 381 | #endif | ||
| 382 | #ifdef sun_soft | ||
| 383 | asm(" jsr start_float"); | ||
| 384 | #endif | ||
| 385 | exit (main (argc, argv, environ)); | 198 | exit (main (argc, argv, environ)); |
| 386 | } | 199 | } |
| 387 | 200 | ||
| @@ -503,85 +316,6 @@ char **argv_value; | |||
| 503 | #endif /* new hp assembler */ | 316 | #endif /* new hp assembler */ |
| 504 | #endif /* hp9000s300 */ | 317 | #endif /* hp9000s300 */ |
| 505 | 318 | ||
| 506 | #ifdef GOULD | ||
| 507 | |||
| 508 | /* startup code has to be in near text rather | ||
| 509 | than fartext as allocated by the C compiler. */ | ||
| 510 | asm(" .text"); | ||
| 511 | asm(" .align 2"); | ||
| 512 | asm(" .globl __start"); | ||
| 513 | asm(" .text"); | ||
| 514 | asm("__start:"); | ||
| 515 | /* setup base register b1 (function base). */ | ||
| 516 | asm(" .using b1,."); | ||
| 517 | asm(" tpcbr b1"); | ||
| 518 | /* setup base registers b3 through b7 (data references). */ | ||
| 519 | asm(" file basevals,b3"); | ||
| 520 | /* setup base register b2 (stack pointer); it should be | ||
| 521 | aligned on a 8-word boundary; but because it is pointing | ||
| 522 | to argc, its value should be remembered (in r5). */ | ||
| 523 | asm(" movw b2,r4"); | ||
| 524 | asm(" movw b2,r5"); | ||
| 525 | asm(" andw #~0x1f,r4"); | ||
| 526 | asm(" movw r4,b2"); | ||
| 527 | /* allocate stack frame to do some work. */ | ||
| 528 | asm(" subea 16w,b2"); | ||
| 529 | /* initialize signal catching for UTX/32 1.2; this is | ||
| 530 | necessary to make restart from saved image work. */ | ||
| 531 | asm(" movea sigcatch,r1"); | ||
| 532 | asm(" movw r1,8w[b2]"); | ||
| 533 | asm(" svc #1,#150"); | ||
| 534 | /* setup address of argc for start1. */ | ||
| 535 | asm(" movw r5,8w[b2]"); | ||
| 536 | asm(" func #1,_start1"); | ||
| 537 | asm(" halt"); | ||
| 538 | /* space for ld to store base register initial values. */ | ||
| 539 | asm(" .align 5"); | ||
| 540 | asm("basevals:"); | ||
| 541 | asm(" .word __base3,__base4,__base5,__base6,__base7"); | ||
| 542 | |||
| 543 | static | ||
| 544 | start1 (xargc) | ||
| 545 | int *xargc; | ||
| 546 | { | ||
| 547 | register int argc; | ||
| 548 | register char **argv; | ||
| 549 | |||
| 550 | argc = *xargc; | ||
| 551 | argv = (char **)(xargc) + 1; | ||
| 552 | environ = argv + argc + 1; | ||
| 553 | |||
| 554 | if (environ == argv) | ||
| 555 | environ--; | ||
| 556 | exit (main (argc, argv, environ)); | ||
| 557 | |||
| 558 | } | ||
| 559 | |||
| 560 | #endif /* GOULD */ | ||
| 561 | |||
| 562 | #ifdef elxsi | ||
| 563 | #include <elxsi/argvcache.h> | ||
| 564 | |||
| 565 | extern char **environ; | ||
| 566 | extern int errno; | ||
| 567 | extern void _init_doscan(), _init_iob(); | ||
| 568 | extern char end[]; | ||
| 569 | char *_init_brk = end; | ||
| 570 | |||
| 571 | _start() | ||
| 572 | { | ||
| 573 | environ = exec_cache.ac_envp; | ||
| 574 | brk (_init_brk); | ||
| 575 | errno = 0; | ||
| 576 | _init_doscan (); | ||
| 577 | _init_iob (); | ||
| 578 | _exit (exit (main (exec_cache.ac_argc, | ||
| 579 | exec_cache.ac_argv, | ||
| 580 | exec_cache.ac_envp))); | ||
| 581 | } | ||
| 582 | #endif /* elxsi */ | ||
| 583 | |||
| 584 | |||
| 585 | #ifdef sparc | 319 | #ifdef sparc |
| 586 | asm (".global __start"); | 320 | asm (".global __start"); |
| 587 | asm (".text"); | 321 | asm (".text"); |