annotate src/ecrt0.c @ 105382:7cb911a9baab

* net/ange-ftp.el (ange-ftp-generate-passwd-key): Check, whether HOST and USER are strings. They are nil, when there are incomplete entries in ~/.netrc, for example. (ange-ftp-delete-directory): Implement RECURSIVE case. Change to root directory ("device busy" error otherwise).
author Michael Albinus <michael.albinus@gmx.de>
date Fri, 02 Oct 2009 13:20:14 +0000
parents e038c1a8307c
children 1d1d5d9bd884
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25844
Dave Love <fx@gnu.org>
parents:
diff changeset
1 /* C code startup routine.
75227
e90d04cd455a Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents: 68651
diff changeset
2 Copyright (C) 1985, 1986, 1992, 2001, 2002, 2003, 2004,
100951
e038c1a8307c Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 96984
diff changeset
3 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
25844
Dave Love <fx@gnu.org>
parents:
diff changeset
4
Dave Love <fx@gnu.org>
parents:
diff changeset
5 This file is part of GNU Emacs.
Dave Love <fx@gnu.org>
parents:
diff changeset
6
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
Dave Love <fx@gnu.org>
parents:
diff changeset
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
Dave Love <fx@gnu.org>
parents:
diff changeset
11
Dave Love <fx@gnu.org>
parents:
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
Dave Love <fx@gnu.org>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
Dave Love <fx@gnu.org>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Dave Love <fx@gnu.org>
parents:
diff changeset
15 GNU General Public License for more details.
Dave Love <fx@gnu.org>
parents:
diff changeset
16
Dave Love <fx@gnu.org>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
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
Dave Love <fx@gnu.org>
parents:
diff changeset
19
Dave Love <fx@gnu.org>
parents:
diff changeset
20
Dave Love <fx@gnu.org>
parents:
diff changeset
21 /* The standard Vax 4.2 Unix crt0.c cannot be used for Emacs
Dave Love <fx@gnu.org>
parents:
diff changeset
22 because it makes `environ' an initialized variable.
Dave Love <fx@gnu.org>
parents:
diff changeset
23 It is easiest to have a special crt0.c on all machines
Dave Love <fx@gnu.org>
parents:
diff changeset
24 though I don't know whether other machines actually need it. */
Dave Love <fx@gnu.org>
parents:
diff changeset
25
Dave Love <fx@gnu.org>
parents:
diff changeset
26 /* On the vax and 68000, in BSD4.2 and USG5.2,
Dave Love <fx@gnu.org>
parents:
diff changeset
27 this is the data format on startup:
Dave Love <fx@gnu.org>
parents:
diff changeset
28 (vax) ap and fp are unpredictable as far as I know; don't use them.
Dave Love <fx@gnu.org>
parents:
diff changeset
29 sp -> word containing argc
Dave Love <fx@gnu.org>
parents:
diff changeset
30 word pointing to first arg string
Dave Love <fx@gnu.org>
parents:
diff changeset
31 [word pointing to next arg string]... 0 or more times
Dave Love <fx@gnu.org>
parents:
diff changeset
32 0
Dave Love <fx@gnu.org>
parents:
diff changeset
33 Optionally:
Dave Love <fx@gnu.org>
parents:
diff changeset
34 [word pointing to environment variable]... 1 or more times
Dave Love <fx@gnu.org>
parents:
diff changeset
35 ...
Dave Love <fx@gnu.org>
parents:
diff changeset
36 0
Dave Love <fx@gnu.org>
parents:
diff changeset
37 And always:
Dave Love <fx@gnu.org>
parents:
diff changeset
38 first arg string
Dave Love <fx@gnu.org>
parents:
diff changeset
39 [next arg string]... 0 or more times
Dave Love <fx@gnu.org>
parents:
diff changeset
40 */
Dave Love <fx@gnu.org>
parents:
diff changeset
41
Dave Love <fx@gnu.org>
parents:
diff changeset
42 #ifdef emacs
Dave Love <fx@gnu.org>
parents:
diff changeset
43 #include <config.h>
Dave Love <fx@gnu.org>
parents:
diff changeset
44 #endif
Dave Love <fx@gnu.org>
parents:
diff changeset
45
Dave Love <fx@gnu.org>
parents:
diff changeset
46 /* ******** WARNING ********
Dave Love <fx@gnu.org>
parents:
diff changeset
47 Do not insert any data definitions before data_start!
Dave Love <fx@gnu.org>
parents:
diff changeset
48 Since this is the first file linked, the address of the following
Dave Love <fx@gnu.org>
parents:
diff changeset
49 variable should correspond to the start of initialized data space.
Dave Love <fx@gnu.org>
parents:
diff changeset
50 On some systems this is a constant that is independent of the text
Dave Love <fx@gnu.org>
parents:
diff changeset
51 size for shared executables. On others, it is a function of the
Dave Love <fx@gnu.org>
parents:
diff changeset
52 text size. In short, this seems to be the most portable way to
Dave Love <fx@gnu.org>
parents:
diff changeset
53 discover the start of initialized data space dynamically at runtime,
Dave Love <fx@gnu.org>
parents:
diff changeset
54 for either shared or unshared executables, on either swapping or
Dave Love <fx@gnu.org>
parents:
diff changeset
55 virtual systems. It only requires that the linker allocate objects
Dave Love <fx@gnu.org>
parents:
diff changeset
56 in the order encountered, a reasonable model for most Unix systems.
Dave Love <fx@gnu.org>
parents:
diff changeset
57 Similarly, note that the address of _start() should be the start
Dave Love <fx@gnu.org>
parents:
diff changeset
58 of text space. Fred Fish, UniSoft Systems Inc. */
Dave Love <fx@gnu.org>
parents:
diff changeset
59
Dave Love <fx@gnu.org>
parents:
diff changeset
60 int data_start = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
61
Dave Love <fx@gnu.org>
parents:
diff changeset
62 #ifdef NEED_ERRNO
Dave Love <fx@gnu.org>
parents:
diff changeset
63 int errno;
Dave Love <fx@gnu.org>
parents:
diff changeset
64 #endif
Dave Love <fx@gnu.org>
parents:
diff changeset
65
91702
b7a5a89054dc * configure.in (LIBX11_MACHINE, HAVE_XFREE386): Remove code
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87730
diff changeset
66 #ifndef MSDOS
25844
Dave Love <fx@gnu.org>
parents:
diff changeset
67 char **environ;
Dave Love <fx@gnu.org>
parents:
diff changeset
68 #endif
Dave Love <fx@gnu.org>
parents:
diff changeset
69
Dave Love <fx@gnu.org>
parents:
diff changeset
70 #ifndef static
Dave Love <fx@gnu.org>
parents:
diff changeset
71 /* On systems where the static storage class is usable, this function
Dave Love <fx@gnu.org>
parents:
diff changeset
72 should be declared as static. Otherwise, the static keyword has
Dave Love <fx@gnu.org>
parents:
diff changeset
73 been defined to be something else, and code for those systems must
Dave Love <fx@gnu.org>
parents:
diff changeset
74 take care of this declaration appropriately. */
Dave Love <fx@gnu.org>
parents:
diff changeset
75 static start1 ();
Dave Love <fx@gnu.org>
parents:
diff changeset
76 #endif
Dave Love <fx@gnu.org>
parents:
diff changeset
77
Dave Love <fx@gnu.org>
parents:
diff changeset
78 #ifdef CRT0_DUMMIES
Dave Love <fx@gnu.org>
parents:
diff changeset
79
Dave Love <fx@gnu.org>
parents:
diff changeset
80 /* Define symbol "start": here; some systems want that symbol. */
Dave Love <fx@gnu.org>
parents:
diff changeset
81 asm(" .text ");
Dave Love <fx@gnu.org>
parents:
diff changeset
82 asm(" .globl start ");
Dave Love <fx@gnu.org>
parents:
diff changeset
83 asm(" start: ");
Dave Love <fx@gnu.org>
parents:
diff changeset
84
Dave Love <fx@gnu.org>
parents:
diff changeset
85 _start ()
Dave Love <fx@gnu.org>
parents:
diff changeset
86 {
Dave Love <fx@gnu.org>
parents:
diff changeset
87 /* On vax, nothing is pushed here */
Dave Love <fx@gnu.org>
parents:
diff changeset
88 start1 ();
Dave Love <fx@gnu.org>
parents:
diff changeset
89 }
Dave Love <fx@gnu.org>
parents:
diff changeset
90
Dave Love <fx@gnu.org>
parents:
diff changeset
91 static
Dave Love <fx@gnu.org>
parents:
diff changeset
92 start1 (CRT0_DUMMIES argc, xargv)
Dave Love <fx@gnu.org>
parents:
diff changeset
93 int argc;
Dave Love <fx@gnu.org>
parents:
diff changeset
94 char *xargv;
Dave Love <fx@gnu.org>
parents:
diff changeset
95 {
Dave Love <fx@gnu.org>
parents:
diff changeset
96 register char **argv = &xargv;
Dave Love <fx@gnu.org>
parents:
diff changeset
97 environ = argv + argc + 1;
Dave Love <fx@gnu.org>
parents:
diff changeset
98
Dave Love <fx@gnu.org>
parents:
diff changeset
99 if ((char *)environ == xargv)
Dave Love <fx@gnu.org>
parents:
diff changeset
100 environ--;
Dave Love <fx@gnu.org>
parents:
diff changeset
101 exit (main (argc, argv, environ));
Dave Love <fx@gnu.org>
parents:
diff changeset
102
Dave Love <fx@gnu.org>
parents:
diff changeset
103 /* Refer to `start1' so GCC will not think it is never called
Dave Love <fx@gnu.org>
parents:
diff changeset
104 and optimize it out. */
Dave Love <fx@gnu.org>
parents:
diff changeset
105 (void) &start1;
Dave Love <fx@gnu.org>
parents:
diff changeset
106 }
Dave Love <fx@gnu.org>
parents:
diff changeset
107 #else /* not CRT0_DUMMIES */
Dave Love <fx@gnu.org>
parents:
diff changeset
108
96764
1307c33f5e9a * ecrt0.c: Remove code depending on m68000, not used anymore.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96545
diff changeset
109 /* This is a kludge. Now that the CRT0_DUMMIES mechanism above exists,
25844
Dave Love <fx@gnu.org>
parents:
diff changeset
110 most of these machines could use the vax code above
Dave Love <fx@gnu.org>
parents:
diff changeset
111 with some suitable definition of CRT0_DUMMIES.
Dave Love <fx@gnu.org>
parents:
diff changeset
112 Then the symbol m68k could be flushed.
Dave Love <fx@gnu.org>
parents:
diff changeset
113 But I don't want to risk breaking these machines
Dave Love <fx@gnu.org>
parents:
diff changeset
114 in a version 17 patch release, so that change is being put off. */
Dave Love <fx@gnu.org>
parents:
diff changeset
115
Dave Love <fx@gnu.org>
parents:
diff changeset
116 #ifdef m68k /* Can't do it all from C */
Dave Love <fx@gnu.org>
parents:
diff changeset
117 asm (" global _start");
Dave Love <fx@gnu.org>
parents:
diff changeset
118 asm (" text");
Dave Love <fx@gnu.org>
parents:
diff changeset
119 asm ("_start:");
Dave Love <fx@gnu.org>
parents:
diff changeset
120 asm (" comm splimit%,4");
Dave Love <fx@gnu.org>
parents:
diff changeset
121 asm (" global exit");
Dave Love <fx@gnu.org>
parents:
diff changeset
122 asm (" text");
Dave Love <fx@gnu.org>
parents:
diff changeset
123 asm (" mov.l %d0,splimit%");
Dave Love <fx@gnu.org>
parents:
diff changeset
124 asm (" jsr start1");
Dave Love <fx@gnu.org>
parents:
diff changeset
125 asm (" mov.l %d0,(%sp)");
Dave Love <fx@gnu.org>
parents:
diff changeset
126 asm (" jsr exit");
Dave Love <fx@gnu.org>
parents:
diff changeset
127 asm (" mov.l &1,%d0"); /* d0 = 1 => exit */
Dave Love <fx@gnu.org>
parents:
diff changeset
128 asm (" trap &0");
Dave Love <fx@gnu.org>
parents:
diff changeset
129
Dave Love <fx@gnu.org>
parents:
diff changeset
130 /* ignore takes care of skipping the a6 value pushed in start. */
Dave Love <fx@gnu.org>
parents:
diff changeset
131 static
Dave Love <fx@gnu.org>
parents:
diff changeset
132 start1 (argc, xargv)
Dave Love <fx@gnu.org>
parents:
diff changeset
133 int argc;
Dave Love <fx@gnu.org>
parents:
diff changeset
134 char *xargv;
Dave Love <fx@gnu.org>
parents:
diff changeset
135 {
Dave Love <fx@gnu.org>
parents:
diff changeset
136 register char **argv = &xargv;
Dave Love <fx@gnu.org>
parents:
diff changeset
137 environ = argv + argc + 1;
Dave Love <fx@gnu.org>
parents:
diff changeset
138
Dave Love <fx@gnu.org>
parents:
diff changeset
139 if ((char *)environ == xargv)
Dave Love <fx@gnu.org>
parents:
diff changeset
140 environ--;
Dave Love <fx@gnu.org>
parents:
diff changeset
141 exit (main (argc, argv, environ));
Dave Love <fx@gnu.org>
parents:
diff changeset
142 }
Dave Love <fx@gnu.org>
parents:
diff changeset
143
96764
1307c33f5e9a * ecrt0.c: Remove code depending on m68000, not used anymore.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96545
diff changeset
144 #endif /* m68k */
25844
Dave Love <fx@gnu.org>
parents:
diff changeset
145
Dave Love <fx@gnu.org>
parents:
diff changeset
146 #endif /* not CRT0_DUMMIES */
Dave Love <fx@gnu.org>
parents:
diff changeset
147
96545
4cb0e945175d Use __sparc__ rather than sparc. (Bug#507.)
Glenn Morris <rgm@gnu.org>
parents: 96303
diff changeset
148 #ifdef __sparc__
25844
Dave Love <fx@gnu.org>
parents:
diff changeset
149 asm (".global __start");
Dave Love <fx@gnu.org>
parents:
diff changeset
150 asm (".text");
Dave Love <fx@gnu.org>
parents:
diff changeset
151 asm ("__start:");
Dave Love <fx@gnu.org>
parents:
diff changeset
152 asm (" mov 0, %fp");
Dave Love <fx@gnu.org>
parents:
diff changeset
153 asm (" ld [%sp + 64], %o0");
Dave Love <fx@gnu.org>
parents:
diff changeset
154 asm (" add %sp, 68, %o1");
Dave Love <fx@gnu.org>
parents:
diff changeset
155 asm (" sll %o0, 2, %o2");
Dave Love <fx@gnu.org>
parents:
diff changeset
156 asm (" add %o2, 4, %o2");
Dave Love <fx@gnu.org>
parents:
diff changeset
157 asm (" add %o1, %o2, %o2");
Dave Love <fx@gnu.org>
parents:
diff changeset
158 asm (" sethi %hi(_environ), %o3");
Dave Love <fx@gnu.org>
parents:
diff changeset
159 asm (" st %o2, [%o3+%lo(_environ)]");
Dave Love <fx@gnu.org>
parents:
diff changeset
160 asm (" andn %sp, 7, %sp");
Dave Love <fx@gnu.org>
parents:
diff changeset
161 asm (" call _main");
Dave Love <fx@gnu.org>
parents:
diff changeset
162 asm (" sub %sp, 24, %sp");
Dave Love <fx@gnu.org>
parents:
diff changeset
163 asm (" call __exit");
Dave Love <fx@gnu.org>
parents:
diff changeset
164 asm (" nop");
Dave Love <fx@gnu.org>
parents:
diff changeset
165
96545
4cb0e945175d Use __sparc__ rather than sparc. (Bug#507.)
Glenn Morris <rgm@gnu.org>
parents: 96303
diff changeset
166 #endif /* __sparc__ */
25844
Dave Love <fx@gnu.org>
parents:
diff changeset
167
Dave Love <fx@gnu.org>
parents:
diff changeset
168 #if __FreeBSD__ == 2
Dave Love <fx@gnu.org>
parents:
diff changeset
169 char *__progname;
Dave Love <fx@gnu.org>
parents:
diff changeset
170 #endif
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
171
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
172 /* arch-tag: 4025c2fb-d6b1-4d29-b1b6-8100b6bd1e74
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
173 (do not change this comment) */