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 / i386 / crt / chkrcrt0.S next >
Encoding:
Text File  |  1994-09-17  |  3.8 KB  |  120 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. /* Changes by Tristan Gingold 
  51.    * does not handle the shared libraries
  52.    * call __chkr_init_chkr before main
  53.  */
  54.  
  55.     .file "chkrcrt0.S"
  56.     .stabs "/libc-linux/sysdeps/linux/i386/crt/",100,0,0,__entry
  57.     .stabs "chkrcrt0.S",100,0,0,__entry
  58.     .text
  59.     .globl    ___crt_dummy__
  60. ___crt_dummy__:
  61. __entry:
  62. /*
  63.  *    This is important, and was missing from the new version...
  64.  */
  65.     movl $45,%eax
  66.     movl $0,%ebx
  67.     int  $0x80
  68.     movl %eax,____brk_addr
  69.  
  70. /*
  71.  *    just set the __chkr_maccess flag
  72.  */
  73.     movl %eax,___chkr_maccess
  74.  
  75. /*
  76.  *    ok, set up the 387 flags and ___environ.
  77.  */    
  78.     fldcw init_cw
  79.     movl 8(%esp),%eax
  80.     movl %eax,___environ
  81. /*
  82.  * The next thing we do is initialize Checker.
  83.  * Because 387 flags are set, Checker can use the FPU.
  84.  */
  85.     call ___chkr_init_chkr
  86. /*
  87.  * Now we can call __setfpucw and _main
  88.  */
  89.     movzwl ___fpu_control,%eax
  90.     call chkr_0_5_2_4_chkr        /* for the pushl */
  91.     pushl %eax
  92.     call ___setfpucw
  93.     addl $4,%esp
  94. /* Some functions may be needed. */
  95.     call ___libc_init
  96.     call chkr_0_5_0_4_chkr        /* for the call */
  97.     call _main
  98.     call chkr_0_5_2_4_chkr        /* for pushl */
  99.     pushl %eax
  100.     call _exit
  101. /*
  102.  *    Just in case _exit fails... We use int $0x80 for __exit().
  103.  */
  104.     popl %ebx
  105. done:
  106.     movl $1,%eax
  107.     int $0x80
  108.     jmp done
  109.  
  110.     .stabd 68,0,1
  111.     .stabs "__entry:F39",36,0,1,__entry
  112.  
  113. #ifdef __i486__
  114.     .align  4,0x90
  115. #else
  116.     .align  2,0x90
  117. #endif
  118. init_cw:
  119.     .word 0x1372
  120.