2 * crt0.S -- startup file for m68k-coff
4 * Copyright (c) 1995, 1996, 1998 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. */
41 .extern SYM (hardware_init_hook)
42 .extern SYM (software_init_hook)
44 .extern SYM(__do_global_dtors)
47 * These values are set in the linker script, so they must be
48 * explicitly named here without SYM.
55 * set things up so the application will run. This *must* be called start.
61 * put any hardware init code here
64 /* See if user supplied their own stack (__stack != 0). If not, then
65 * default to using the value of %sp as set by the ROM monitor.
67 movel IMM(__stack), a0
72 /* set up initial stack frame */
76 * zero out the bss section.
78 movel IMM(__bss_start), d1
87 #if !defined(__mcoldfire__) && !defined(__mcf5200__)
100 * initialize target specific stuff. Only execute these
101 * functions it they exist.
103 PICLEA SYM (hardware_init_hook), a0
109 PICLEA SYM (software_init_hook), a0
116 * call the main routine from the application to get it going.
117 * main (argc, argv, environ)
118 * we pass argv as a pointer to NULL.
122 /* put __do_global_dtors in the atexit list so the destructors get run */
123 movel IMM (SYM(__do_global_dtors)),(sp)
126 movel IMM (__FINI_SECTION__),(sp)
129 PICCALL __INIT_SECTION__
132 PICPEA SYM (environ),a0
139 * drop down into exit incase the user doesn't. This should drop
140 * control back to the ROM monitor, if there is one. This calls the
141 * exit() from the C library so the C++ tables get cleaned up right.