144 call atexit /* atexit(__Crun::do_exit_code()) */
145 addl $4,%esp
146 1:
147
148 /*
149 * End of destructor handling code
150 */
151
152 /*
153 * Calculate the location of the envp array by adding the size of
154 * the argv array to the start of the argv array.
155 */
156
157 movl 8(%ebp),%eax /* argc */
158 movl _environ, %edx /* fixed bug 4302802 */
159 testl %edx, %edx /* check if _enviorn==0 */
160 jne 1f /* fixed bug 4203802 */
161 leal 16(%ebp,%eax,4),%edx /* envp */
162 movl %edx,_environ /* copy to _environ */
163 1:
164 andl $-16,%esp /* make main() and exit() be called with */
165 subl $4,%esp /* a 16-byte aligned stack pointer */
166 pushl %edx
167 leal 12(%ebp),%edx /* argv */
168 movl %edx,___Argv
169 pushl %edx
170 pushl %eax /* argc */
171 call __fpstart
172 call __fsr /* support for ftrap/fround/fprecision */
173 call _init
174 call main /* main(argc,argv,envp) */
175 movl %eax,(%esp) /* return value from main, for exit() */
176 movl %eax,4(%esp) /* remember it for _exit(), below */
177 call exit
178 movl 4(%esp),%eax /* if user redefined exit, call _exit */
179 movl %eax,(%esp)
180 call _exit
181 hlt
182 .size _start, .-_start
183
184 #include "fsr.s"
185
|
144 call atexit /* atexit(__Crun::do_exit_code()) */
145 addl $4,%esp
146 1:
147
148 /*
149 * End of destructor handling code
150 */
151
152 /*
153 * Calculate the location of the envp array by adding the size of
154 * the argv array to the start of the argv array.
155 */
156
157 movl 8(%ebp),%eax /* argc */
158 movl _environ, %edx /* fixed bug 4302802 */
159 testl %edx, %edx /* check if _enviorn==0 */
160 jne 1f /* fixed bug 4203802 */
161 leal 16(%ebp,%eax,4),%edx /* envp */
162 movl %edx,_environ /* copy to _environ */
163 1:
164 /*
165 * The stack needs to be 16-byte aligned with a 4-byte bias. See
166 * comment in lib/libc/i386/gen/makectxt.c.
167 *
168 * Note: If you change it, you need to change it in the following
169 * files as well:
170 *
171 * - lib/libc/i386/threads/machdep.c
172 * - lib/libc/i386/gen/makectxt.c
173 * - lib/common/i386/crti.s
174 */
175 andl $-16,%esp /* make main() and exit() be called with */
176 subl $4,%esp /* a properly aligned stack pointer */
177 pushl %edx
178 leal 12(%ebp),%edx /* argv */
179 movl %edx,___Argv
180 pushl %edx
181 pushl %eax /* argc */
182 call __fpstart
183 call __fsr /* support for ftrap/fround/fprecision */
184 call _init
185 call main /* main(argc,argv,envp) */
186 movl %eax,(%esp) /* return value from main, for exit() */
187 movl %eax,4(%esp) /* remember it for _exit(), below */
188 call exit
189 movl 4(%esp),%eax /* if user redefined exit, call _exit */
190 movl %eax,(%esp)
191 call _exit
192 hlt
193 .size _start, .-_start
194
195 #include "fsr.s"
196
|