home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / LIBC / LIBC-4.6 / LIBC-4 / libc-linux / sysdeps / linux / m68k / crt / gcrt0.S < prev    next >
Encoding:
Text File  |  1994-09-17  |  3.5 KB  |  110 lines

  1. /*
  2.  * Copyright (c) 1993 Eric Youngdale, Peter MacDonald, David Engel
  3.  * and Hongjiu Lu.
  4.  *
  5.  * All rights reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  * 1. Redistributions of source code must retain the above copyright
  11.  *    notice, this list of conditions and the following disclaimer.
  12.  * 2. The name of the above contributors may not be
  13.  *    used to endorse or promote products derived from this software
  14.  *    without specific prior written permission.
  15.  *
  16.  * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
  17.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
  20.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  21.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  22.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  23.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  24.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  25.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  26.  * SUCH DAMAGE.
  27.  */
  28.  
  29. /* Notice of general intent:
  30.  *
  31.  * The linux operating system generally contains large amounts of code
  32.  * that fall under the GNU General Public License, or GPL for short.
  33.  * This file contains source code that by it's very nature would always
  34.  * be linked with an application program, and because of this a GPL type
  35.  * of copyright on this file would place restrictions upon the
  36.  * distribution of binary-only commercial software.  Since the goal of the
  37.  * Linux project as a whole is not to discourage the development and
  38.  * distribution of commercial software for Linux, this file has been placed
  39.  * under a more relaxed BSD-style of copyright.
  40.  *
  41.  * It is the general understanding of the above contributors that a
  42.  * program executable linked to a library containing code that falls
  43.  * under the GPL or GLPL style of license is not subject to the terms of
  44.  * the GPL or GLPL license if the program executable(s) that are supplied
  45.  * are linked to a shared library form of the GPL or GLPL library, and as long
  46.  * as the form of the shared library is such that it is possible for
  47.  * the end user to modify and rebuild the library and use it in
  48.  * conjunction with the program executable.
  49.  */
  50.  
  51.     .file "gcrt0.S"
  52.  
  53.     .text
  54. __entry:
  55. /*
  56.  * The first thing we do is try to load the shared library. If that
  57.  * fails, it won't return.
  58.  */
  59.     jbsr ___load_shared_libraries
  60. /*
  61.  *    This is important, and was missing from the new version...
  62.  */
  63.     moveq #45,d0
  64.     moveq #0,d1
  65.     trap  #0
  66.     movel d0,____brk_addr
  67. /*
  68.  *    Setup profiling
  69.  */
  70.     pea   __mcleanup
  71.     jbsr  _atexit
  72.     addql #4,sp
  73.     pea   _etext
  74.     pea   __entry
  75.     jbsr  _monstartup
  76.     addql #8,sp
  77. /*
  78.  *    Setup ___environ and call _main
  79.  */
  80.     movel sp@(8),___environ
  81.     movel ___fpu_control,sp@-
  82.     jbsr  ___setfpucw
  83.     addql #4,sp
  84. /* Some functions may be needed. */
  85.     jbsr  ___libc_init    
  86.     jbsr  _main
  87.     movel d0,sp@-
  88.     jbsr  _exit
  89. /*
  90.  *    Just in case _exit fails... We use trap #0 for __exit().
  91.  */
  92.     addql #4,sp
  93. done:
  94.     moveq #1,d0
  95.     trap  #0
  96.     bras  done
  97.  
  98.     .align    4
  99. ___shared_dummy__:
  100.     .asciz ""
  101.     .stabs "___SHARED_LIBRARIES__",25,0,0,___shared_dummy__
  102.  
  103.     .data
  104.     .align    4
  105. ___shared_dummy1__:
  106.     .long 0xfeeb1ed3  /* Magic number used by DLL code to make sure this
  107.                  is a real list */
  108.  
  109.     .stabs "__SHARABLE_CONFLICTS__",25,0,0,___shared_dummy1__
  110.