Mercurial > emacs
annotate src/ecrt0.c @ 96303:ddedcecb18ef
* unexnext.c:
* m/ews4800.h:
* m/hp9000s300.h:
* m/ibm370aix.h:
* m/mips-siemens.h:
* m/ncr386.h:
* m/next.h:
* m/pmax.h:
* m/powerpcle.h:
* m/tandem-s2.h:
* s/386bsd.h:
* s/bsd386.h:
* s/bsd4-1.h:
* s/bsd4-2.h:
* s/bsdos2-1.h:
* s/bsdos2.h:
* s/bsdos3.h:
* s/bsdos4.h:
* s/nextstep.h:
* s/ultrix4-3.h:
* s/usg5-0.h:
* s/usg5-2-2.h:
* s/usg5-2.h:
* s/usg5-4-3.h:
* s/ux4800.h:
* s/uxpds.h:
* s/uxpv.h: Remove support for obsolete systems.
* s/hpux.h, s/hpux10.h, s/hpux8.h, s/hpux9.h, s/hpux9shr.h:
Remove, insert contents in s/hpux-10.20.h
* s/aix3-1.h, s/aix3-2-5.h, s/aix3-2.h, s/aix4-1.h, s/aix4.h:
Remove, insert contents in s/aix-4.2.h
* s/usg5-3.h: Remove, insert contents in s/usg5-4.h.
* s/bsd4-3.h: Rename to ..
* s/bsd-common.h: ... this.
* src/data.c:
* src/doc.c:
* src/ecrt0.c:
* src/emacs.c:
* src/fileio.c:
* src/floatfns.c:
* src/keyboard.c:
* src/mem-limits.h:
* src/print.c:
* src/process.c:
* src/sysdep.c:
* src/syssignal.h:
* src/systty.h:
* src/syswait.h:
* src/term.c:
* src/unexec.c:
* src/unexelf.c:
* src/unexhp9k800.c:
* src/m/hp800.h:
* src/m/ibmrs6000.h:
* src/m/mips.h:
* src/m/vax.h:
* src/s/darwin.h:
* src/s/freebsd.h:
* src/s/gnu.h:
* src/s/ms-w32.h:
* src/s/msdos.h:
* src/s/netbsd.h:
* src/s/template.h: Remove references to obsolete variables.
* Makefile.in: Add dependencies for all unexec files.
(admindir): Remove unused variable.
(UNEXEC_SRC): Remove references.
* config.nt: Remove reference to UNEXEC_SRC.
* lwlib.c: Remove references to obsolete variables.
* fakemail.c: Remove references to obsolete variables.
* os.texi: Remove references to obsolete systems.
* configure.in:
* configure: Remove references to obsolete systems.
| author | Dan Nicolaescu <dann@ics.uci.edu> |
|---|---|
| date | Thu, 26 Jun 2008 04:24:54 +0000 |
| parents | 8971ddf55736 |
| children | 4cb0e945175d |
| rev | line source |
|---|---|
| 25844 | 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 | 3 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
| 25844 | 4 |
| 5 This file is part of GNU Emacs. | |
| 6 | |
|
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91702
diff
changeset
|
7 GNU Emacs is free software: you can redistribute it and/or modify |
| 25844 | 8 it under the terms of the GNU General Public License as published by |
|
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91702
diff
changeset
|
9 the Free Software Foundation, either version 3 of the License, or |
|
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91702
diff
changeset
|
10 (at your option) any later version. |
| 25844 | 11 |
| 12 GNU Emacs is distributed in the hope that it will be useful, | |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 GNU General Public License for more details. | |
| 16 | |
| 17 You should have received a copy of the GNU General Public License | |
|
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91702
diff
changeset
|
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 25844 | 19 |
| 20 | |
| 21 /* The standard Vax 4.2 Unix crt0.c cannot be used for Emacs | |
| 22 because it makes `environ' an initialized variable. | |
| 23 It is easiest to have a special crt0.c on all machines | |
| 24 though I don't know whether other machines actually need it. */ | |
| 25 | |
| 26 /* On the vax and 68000, in BSD4.2 and USG5.2, | |
| 27 this is the data format on startup: | |
| 28 (vax) ap and fp are unpredictable as far as I know; don't use them. | |
| 29 sp -> word containing argc | |
| 30 word pointing to first arg string | |
| 31 [word pointing to next arg string]... 0 or more times | |
| 32 0 | |
| 33 Optionally: | |
| 34 [word pointing to environment variable]... 1 or more times | |
| 35 ... | |
| 36 0 | |
| 37 And always: | |
| 38 first arg string | |
| 39 [next arg string]... 0 or more times | |
| 40 */ | |
| 41 | |
| 42 /* On the 16000, at least in the one 4.2 system I know about, | |
| 43 the initial data format is | |
| 44 sp -> word containing argc | |
| 45 word containing argp | |
| 46 word pointing to first arg string, and so on as above | |
| 47 */ | |
| 48 | |
| 49 #ifdef emacs | |
| 50 #include <config.h> | |
| 51 #endif | |
| 52 | |
| 53 /* ******** WARNING ******** | |
| 54 Do not insert any data definitions before data_start! | |
| 55 Since this is the first file linked, the address of the following | |
| 56 variable should correspond to the start of initialized data space. | |
| 57 On some systems this is a constant that is independent of the text | |
| 58 size for shared executables. On others, it is a function of the | |
| 59 text size. In short, this seems to be the most portable way to | |
| 60 discover the start of initialized data space dynamically at runtime, | |
| 61 for either shared or unshared executables, on either swapping or | |
| 62 virtual systems. It only requires that the linker allocate objects | |
| 63 in the order encountered, a reasonable model for most Unix systems. | |
| 64 Similarly, note that the address of _start() should be the start | |
| 65 of text space. Fred Fish, UniSoft Systems Inc. */ | |
| 66 | |
| 67 int data_start = 0; | |
| 68 | |
| 69 #ifdef NEED_ERRNO | |
| 70 int errno; | |
| 71 #endif | |
| 72 | |
|
91702
b7a5a89054dc
* configure.in (LIBX11_MACHINE, HAVE_XFREE386): Remove code
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87730
diff
changeset
|
73 #ifndef MSDOS |
| 25844 | 74 char **environ; |
| 75 #endif | |
| 76 | |
| 77 #ifndef static | |
| 78 /* On systems where the static storage class is usable, this function | |
| 79 should be declared as static. Otherwise, the static keyword has | |
| 80 been defined to be something else, and code for those systems must | |
| 81 take care of this declaration appropriately. */ | |
| 82 static start1 (); | |
| 83 #endif | |
| 84 | |
| 85 #ifdef CRT0_DUMMIES | |
| 86 | |
| 87 /* Define symbol "start": here; some systems want that symbol. */ | |
| 88 #ifdef DOT_GLOBAL_START | |
| 89 asm(" .text "); | |
| 90 asm(" .globl start "); | |
| 91 asm(" start: "); | |
| 92 #endif /* DOT_GLOBAL_START */ | |
| 93 | |
| 94 #ifdef NODOT_GLOBAL_START | |
| 95 asm(" text "); | |
| 96 asm(" global start "); | |
| 97 asm(" start: "); | |
| 98 #endif /* NODOT_GLOBAL_START */ | |
| 99 | |
| 100 #ifdef m68000 | |
| 101 | |
| 102 /* GCC 2.1, when optimization is turned off, seems to want to push a | |
| 103 word of garbage on the stack, which screws up the CRT0_DUMMIES | |
| 104 hack. So we hand-code _start in assembly language. */ | |
| 105 asm(".text "); | |
| 106 asm(" .even "); | |
| 107 asm(".globl __start "); | |
| 108 asm("__start: "); | |
| 109 asm(" link a6,#0 "); | |
| 110 asm(" jbsr _start1 "); | |
| 111 asm(" unlk a6 "); | |
| 112 asm(" rts "); | |
| 113 | |
| 114 #else /* not m68000 */ | |
| 115 | |
| 116 _start () | |
| 117 { | |
| 118 /* On vax, nothing is pushed here */ | |
| 119 /* On sequent, bogus fp is pushed here */ | |
| 120 start1 (); | |
| 121 } | |
| 122 | |
| 123 #endif /* possibly m68000 */ | |
| 124 | |
| 125 static | |
| 126 start1 (CRT0_DUMMIES argc, xargv) | |
| 127 int argc; | |
| 128 char *xargv; | |
| 129 { | |
| 130 register char **argv = &xargv; | |
| 131 environ = argv + argc + 1; | |
| 132 | |
| 133 if ((char *)environ == xargv) | |
| 134 environ--; | |
| 135 exit (main (argc, argv, environ)); | |
| 136 | |
| 137 /* Refer to `start1' so GCC will not think it is never called | |
| 138 and optimize it out. */ | |
| 139 (void) &start1; | |
| 140 } | |
| 141 #else /* not CRT0_DUMMIES */ | |
| 142 | |
| 143 /* "m68k" and "m68000" both stand for m68000 processors, | |
| 144 but with different program-entry conventions. | |
| 145 This is a kludge. Now that the CRT0_DUMMIES mechanism above exists, | |
| 146 most of these machines could use the vax code above | |
| 147 with some suitable definition of CRT0_DUMMIES. | |
| 148 Then the symbol m68k could be flushed. | |
| 149 But I don't want to risk breaking these machines | |
| 150 in a version 17 patch release, so that change is being put off. */ | |
| 151 | |
| 152 #ifdef m68k /* Can't do it all from C */ | |
| 153 asm (" global _start"); | |
| 154 asm (" text"); | |
| 155 asm ("_start:"); | |
| 156 asm (" comm splimit%,4"); | |
| 157 asm (" global exit"); | |
| 158 asm (" text"); | |
| 159 asm (" mov.l %d0,splimit%"); | |
| 160 asm (" jsr start1"); | |
| 161 asm (" mov.l %d0,(%sp)"); | |
| 162 asm (" jsr exit"); | |
| 163 asm (" mov.l &1,%d0"); /* d0 = 1 => exit */ | |
| 164 asm (" trap &0"); | |
| 165 #else /* m68000, not m68k */ | |
| 166 | |
| 167 #ifdef m68000 | |
| 168 | |
| 169 _start () | |
| 170 { | |
| 171 #ifdef sun | |
| 172 finitfp_(); | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
27727
diff
changeset
|
173 #endif |
| 25844 | 174 /* On 68000, _start pushes a6 onto stack */ |
| 175 start1 (); | |
| 176 } | |
| 177 #endif /* m68000 */ | |
| 178 #endif /* m68k */ | |
| 179 | |
| 180 #if defined(m68k) || defined(m68000) | |
| 181 /* ignore takes care of skipping the a6 value pushed in start. */ | |
| 182 static | |
| 183 #if defined(m68k) | |
| 184 start1 (argc, xargv) | |
| 185 #else | |
| 186 start1 (ignore, argc, xargv) | |
| 187 #endif | |
| 188 int argc; | |
| 189 char *xargv; | |
| 190 { | |
| 191 register char **argv = &xargv; | |
| 192 environ = argv + argc + 1; | |
| 193 | |
| 194 if ((char *)environ == xargv) | |
| 195 environ--; | |
| 196 exit (main (argc, argv, environ)); | |
| 197 } | |
| 198 | |
| 199 #endif /* m68k or m68000 */ | |
| 200 | |
| 201 #endif /* not CRT0_DUMMIES */ | |
| 202 | |
| 203 #ifdef sparc | |
| 204 asm (".global __start"); | |
| 205 asm (".text"); | |
| 206 asm ("__start:"); | |
| 207 asm (" mov 0, %fp"); | |
| 208 asm (" ld [%sp + 64], %o0"); | |
| 209 asm (" add %sp, 68, %o1"); | |
| 210 asm (" sll %o0, 2, %o2"); | |
| 211 asm (" add %o2, 4, %o2"); | |
| 212 asm (" add %o1, %o2, %o2"); | |
| 213 asm (" sethi %hi(_environ), %o3"); | |
| 214 asm (" st %o2, [%o3+%lo(_environ)]"); | |
| 215 asm (" andn %sp, 7, %sp"); | |
| 216 asm (" call _main"); | |
| 217 asm (" sub %sp, 24, %sp"); | |
| 218 asm (" call __exit"); | |
| 219 asm (" nop"); | |
| 220 | |
| 221 #endif /* sparc */ | |
| 222 | |
| 223 #if __FreeBSD__ == 2 | |
| 224 char *__progname; | |
| 225 #endif | |
| 52401 | 226 |
| 227 /* arch-tag: 4025c2fb-d6b1-4d29-b1b6-8100b6bd1e74 | |
| 228 (do not change this comment) */ |
