2 * crt0.S -- startup file for m68k-coff
4 * Copyright (c) 1995, 1996, 1998, 2001 Cygnus Support
6 * The authors hereby grant permission to use, copy, modify, distribute,
7 * and license this software and its documentation for any purpose, provided
8 * that existing copyright notices are retained in all copies and that this
9 * notice is included verbatim in any distributions. No written agreement,
10 * license, or royalty fee is required for any of the authorized uses.
11 * Modifications to this software may be copyrighted by their authors
12 * and need not follow the licensing terms described here, provided that
13 * the new terms are clearly indicated on the first page of each file where
19 .title "crt0.S for m68k-coff"
20 #define STACKSIZE 0x4000
23 * Define an empty environment.
34 * These symbols are defined in C code, so they need to always be
35 * named with SYM because of the difference between object file formats.
38 /* These are defined in C code. */
42 .extern SYM(__do_global_dtors)
45 * These values are set in the linker script, so they must be
46 * explicitly named here without SYM.
53 * set things up so the application will run. This *must* be called start.
58 /* See if user supplied their own stack (__stack != 0). If not, then
59 * default to using the value of %sp as set by the ROM monitor.
61 movel IMM(__stack), a0
66 /* set up initial stack frame */
70 * zero out the bss section.
72 movel IMM(__bss_start), d1
81 #if !defined(__mcoldfire__) && !defined(__mcf5200__)
94 * call the main routine from the application to get it going.
95 * main (argc, argv, environ)
96 * we pass argv as a pointer to NULL.
100 /* put __do_global_dtors in the atexit list so the destructors get run */
101 movel IMM (SYM(__do_global_dtors)),(sp)
104 movel IMM (__FINI_SECTION__),(sp)
107 PICCALL __INIT_SECTION__
110 PICPEA SYM (environ),a0
117 * drop down into exit incase the user doesn't. This should drop
118 * control back to the ROM monitor, if there is one. This calls the
119 * exit() from the C library so the C++ tables get cleaned up right.