home *** CD-ROM | disk | FTP | other *** search
/ Total Destruction / Total_Destruction.iso / addons / Lccwin32.exe / Lccwin32 / lccpub / lib / libcrt0.asm < prev    next >
Encoding:
Assembly Source File  |  1997-09-21  |  7.8 KB  |  484 lines

  1.     .text
  2.     .extern    _RtlUnwind@16
  3.     .extern    _printf
  4.     .globl    _main
  5. _main:
  6.     mov    $1,%eax
  7.     ret
  8. _$unknownTrap:
  9.     xor     %eax,%eax
  10.     incl    %eax
  11.     movl    4(%esp),%ecx
  12.     testl   $6,4(%ecx)
  13.     jz      _$unknownTrapLabel1
  14.     movl    8(%esp),%eax
  15.     movl    16(%esp),%edx
  16.     movl    %eax,(%edx)
  17.     movl    $3,%eax
  18. _$unknownTrapLabel1:
  19.     ret
  20. _$local_unwind2:
  21.     pushl   %ebx
  22.     pushl   %esi
  23.     pushl   %edi
  24.     movl    16(%esp),%eax
  25.     pushl   %eax
  26.     pushl   $0xfffffffe
  27.     pushl   $_$unknownTrap
  28.     .byte   100
  29.     .byte   255
  30.     .byte   53
  31.     .long   0
  32.     .byte   100
  33.     .byte   137
  34.     .byte   37
  35.     .long   0
  36. _$local_unwindLabel0:
  37.     movl    32(%esp),%eax
  38.     movl    8(%eax),%ebx
  39.     movl    12(%eax),%esi
  40.     cmpl    $0xffffffff,%esi
  41.     jz      _$local_unwindLabel1
  42.     cmpl    36(%esp),%esi
  43.     jz      _$local_unwindLabel1
  44.     leal    (%esi,%esi,2),%esi
  45.     movl    (%ebx,%esi,4),%ecx
  46.     movl    8(%esp),%ecx
  47.     movl    12(%eax),%ecx
  48.     cmpl    $0,4(%ebx,%esi,4)
  49.     jnz     _$local_unwindLabel0
  50.     call    8(%ebx,%esi,4)
  51.     jmp     _$local_unwindLabel0
  52. _$local_unwindLabel1:
  53.     .byte   100
  54.     .byte   143
  55.     .byte   5
  56.     .long   0
  57.     addl    $12,%esp
  58.     pop     %edi
  59.     pop     %esi
  60.     pop     %ebx
  61.     ret
  62. __global_unwind2:
  63.     pushl   %ebp
  64.     movl    %esp,%ebp
  65.     pushl   %ebx
  66.     pushl   %esi
  67.     pushl   %edi
  68.     pushl   %ebp
  69.     pushl   $0
  70.     pushl   $0
  71.     pushl   $_$beyond
  72.     pushl   8(%ebp)
  73.     call    _RtlUnwind@16
  74. _$beyond:
  75.     pop     %ebp
  76.     pop     %edi
  77.     pop     %esi
  78.     pop     %ebx
  79.     mov     %ebp,%esp
  80.     pop     %ebp
  81.     ret
  82.     .globl    __except_handler3
  83. __except_handler3:
  84.     cld
  85.     pushl   %ebp
  86.     movl    %esp,%ebp
  87.     subl    $8,%esp
  88.     pushl   %ebx
  89.     pushl   %esi
  90.     pushl   %edi
  91.     pushl   %ebp
  92.     movl    12(%ebp),%ebx
  93.     movl    8(%ebp),%eax
  94.     testl   $6,4(%eax)
  95.     jne     exceptionHandler3label2
  96.     movl    %eax,-8(%ebp)
  97.     movl    16(%ebp),%eax
  98.     movl    %eax,-4(%ebp)
  99.     leal    -8(%ebp),%eax
  100.     movl    %eax,-4(%ebx)
  101.     movl    12(%ebx),%esi
  102.     movl    8(%ebx),%edi
  103. _$exceptionHandler3LOOP:
  104.     cmp      $0xffffffff,%esi
  105.     jz      _$RetTr
  106.     leal    (%esi,%esi,2),%ecx
  107.     cmpl    $0,4(%edi,%ecx,4)
  108.     jz      exceptionHandler3label3
  109.     pushl   %esi
  110.     pushl   %ebp
  111.     leal    16(%ebx),%ebp
  112.     call    4(%edi,%ecx,4)
  113.     popl    %ebp
  114.     popl    %esi
  115.     movl    12(%ebp),%ebx
  116.     orl     %eax,%eax
  117.     jz      exceptionHandler3label3
  118.     js      exceptionHandler3label4
  119.     movl    8(%ebx),%edi
  120.     pushl   %ebx
  121.     call    __global_unwind2
  122.     addl    $4,%esp
  123.     leal    16(%ebx),%ebp
  124.     pushl   %esi
  125.     pushl   %ebx
  126.     call    _$local_unwind2
  127.     addl    $8,%esp
  128.     leal    (%esi,%esi,2),%ecx
  129.     movl    (%edi,%ecx,4),%eax
  130.     movl    12(%ebx),%eax
  131.     call    8(%edi,%ecx,4)
  132. exceptionHandler3label3:
  133.     movl    8(%ebx),%edi
  134.     leal    (%esi,%esi,2),%ecx
  135.     movl    (%edi,%ecx,4),%esi
  136.     jmp     _$exceptionHandler3LOOP
  137. exceptionHandler3label4:
  138.     xorl    %eax,%eax
  139.     jmp       exceptionHandler3Exit
  140. exceptionHandler3label2:
  141.     pushl   %ebp
  142.     leal    16(%ebx),%ebp
  143.     pushl   $0xffffffff
  144.     pushl   %ebx
  145.     call    _$local_unwind2
  146.     addl    $12,%esp
  147. _$RetTr:
  148.     pushl    $11
  149.     call    _raise
  150.     addl    $4,%esp
  151. exceptionHandler3Exit:
  152.     popl    %ebp
  153.     popl    %edi
  154.     popl    %esi
  155.     popl    %ebx
  156.     movl    %ebp,%esp
  157.     popl    %ebp
  158.     ret
  159.  
  160.     .globl    __crtLibMain@12
  161. __crtLibMain@12:
  162.     push    %ebp
  163.     mov    %esp,%ebp
  164.     push    %ebx
  165.     push    %esi
  166.     push    %edi
  167.         cmp     $1,12(%ebp)
  168.         jne     _$skipit
  169.     call    __init_stdhandles
  170. _$skipit:
  171.     cmp    $0,12(%ebp)
  172.     jne    _$Skipit1
  173.     call    __close_stdhandles
  174. _$Skipit1:
  175.     push    16(%ebp)
  176.     push    12(%ebp)
  177.     push    8(%ebp)
  178.     mov    __UserEntryPoint,%eax
  179.     call    %eax
  180. _$FailedInit:
  181.     pop    %edi
  182.     pop    %esi
  183.     pop    %ebx
  184.     leave
  185.     ret    $12
  186.     .globl    __init_stdhandles
  187.     .type    __init_stdhandles,function
  188. __init_stdhandles:
  189.     pushl    %ebp
  190.     movl    %esp,%ebp
  191.     subl    $12,%esp
  192.     pushl    %edi
  193.     pushl    $0
  194.     pushl    $0xfffffff6
  195.     call    _open_osfhandle
  196.     movl    %eax,-8(%ebp)
  197.     pushl    $0
  198.     pushl    $0xfffffff5
  199.     call    _open_osfhandle
  200.     movl    %eax,-4(%ebp)
  201.     pushl    $0
  202.     pushl    $0xfffffff4
  203.     call    _open_osfhandle
  204.     movl    %eax,-12(%ebp)
  205.     pushl    $_$73
  206.     pushl    -8(%ebp)
  207.     call    _fdopen
  208.     movl    %eax,_stdin
  209.     pushl    $_$74
  210.     pushl    -4(%ebp)
  211.     call    _fdopen
  212.     movl    %eax,_stdout
  213.     pushl    $_$74
  214.     pushl    -12(%ebp)
  215.     call    _fdopen
  216.     addl    $48,%esp
  217.     movl    %eax,_stderr
  218.     movl    _stdout,%edi
  219.     or    %edi,%edi
  220.     je    _$75
  221.     pushl    $0x0
  222.     pushl    %edi
  223.     call    _setbuf
  224.     addl    $8,%esp
  225. _$75:
  226.     .line    138
  227.     movl    _stderr,%edi
  228.     or    %edi,%edi
  229.     je    _$77
  230.     .line    139
  231.     pushl    $0x0
  232.     pushl    %edi
  233.     call    _setbuf
  234.     addl    $8,%esp
  235.     call    __Setenvironment
  236. _$77:
  237. _$72:
  238.     .line    140
  239.     popl    %edi
  240.     leave
  241.     ret
  242. _$85:
  243.     .size    __init_stdhandles,_$85-__init_stdhandles
  244.     .type    __close_stdhandles,function
  245. __close_stdhandles:
  246.     movl    _stderr,%eax
  247.     or    %eax,%eax
  248.     je    _$87
  249.     .line    156
  250.     pushl    %eax
  251.     call    _fclose
  252.     pop    %ecx
  253. _$87:
  254.     movl    _stdin,%eax
  255.     or    %eax,%eax
  256.     je    _$89
  257.     pushl    %eax
  258.     call    _fclose
  259.     pop    %ecx
  260. _$89:
  261.     .line    159
  262.     movl    _stdout,%eax
  263.     or    %eax,%eax
  264.     je    _$91
  265.     pushl    %eax
  266.     call    _fclose
  267.     pop    %ecx
  268. _$91:
  269.     .line    161
  270.     ret
  271.     .align    2
  272.     .globl    __ftol
  273. __ftol:
  274.     push    %ebp
  275.     movl    %esp,%ebp
  276.     addl    $0xfffffff4,%esp
  277.     fnstcw    -2(%ebp)
  278.     movw    -2(%ebp),%ax
  279.     or    $0xc,%ah
  280.     movw    %ax,-4(%ebp)
  281.     fldcw    -4(%ebp)
  282.     fistpl    -12(%ebp)
  283.     fldcw    -2(%ebp)
  284.     movl    -12(%ebp),%eax
  285.     leave
  286.     ret
  287.     .align    2
  288. _$93:
  289.     .size    __close_stdhandles,_$93-__close_stdhandles
  290.     .extern    _open_osfhandle
  291.  
  292.     .text
  293.     .type    __Setenvironment,function
  294. __Setenvironment:
  295.     pushl    %ebp
  296.     movl    %esp,%ebp
  297.     subl    $20,%esp
  298.     pushl    %ebx
  299.     pushl    %esi
  300.     pushl    %edi
  301.     .line    8
  302.     .line    15
  303.     movl    $0,-12(%ebp)
  304.     .line    17
  305.     call    _GetEnvironmentStringsA@0
  306.     movl    %eax,%ebx
  307.     movl    %ebx,-16(%ebp)
  308.     jmp    _$SetEnv3
  309. _$SetEnv2:
  310.     .line    19
  311.     cmpb    $61,(,%ebx)
  312.     je    _$SetEnv5
  313.     .line    20
  314.     incl    -12(%ebp)
  315. _$SetEnv5:
  316.     .line    21
  317.     movl    %ebx,%edi
  318.     xor    %eax,%eax
  319.     stc
  320.     sbb    %ecx,%ecx
  321.     repne
  322.     scasb
  323.     neg    %ecx
  324.     leal    -2(%ecx),%eax
  325.     movl    %eax,%edi
  326.     incl    %edi
  327.     leal    (%ebx,%edi),%ebx
  328. _$SetEnv3:
  329.     .line    18
  330.     cmpb    $0,(,%ebx)
  331.     jne    _$SetEnv2
  332.     .line    24
  333.     movl    -12(%ebp),%edi
  334.     incl    %edi
  335.     leal    (,%edi,4),%edi
  336.     movl    %edi,-20(%ebp)
  337.     .line    25
  338.     pushl    -20(%ebp)
  339.     call    _malloc
  340.     pop    %ecx
  341.     movl    %eax,-8(%ebp)
  342.     movl    %eax,__environ
  343.     .line    26
  344.     cmpl    $0,-8(%ebp)
  345.     jne    _$SetEnv7
  346.     xor    %eax,%eax
  347.     jmp    _$SetEnv1
  348. _$SetEnv7:
  349.     .line    29
  350.     movl    -16(%ebp),%ebx
  351.     jmp    _$SetEnv12
  352. _$SetEnv9:
  353.     .line    30
  354.     movl    %ebx,%edi
  355.     xor    %eax,%eax
  356.     stc
  357.     sbb    %ecx,%ecx
  358.     repne
  359.     scasb
  360.     neg    %ecx
  361.     leal    -2(%ecx),%eax
  362.     movl    %eax,%edi
  363.     incl    %edi
  364.     movl    %edi,-4(%ebp)
  365.     cmpb    $61,(,%ebx)
  366.     je    _$SetEnv13
  367.     pushl    -4(%ebp)
  368.     call    _malloc
  369.     pop    %ecx
  370.     movl    -8(%ebp),%esi
  371.     movl    %eax,(,%esi)
  372.     or    %eax,%eax
  373.     jne    _$SetEnv15
  374.     jmp    _$SetEnv1
  375. _$SetEnv15:
  376.     .line    35
  377.     pushl    %ebx
  378.     movl    -8(%ebp),%edi
  379.     pushl    (,%edi)
  380.     call    _strcpy
  381.     addl    $8,%esp
  382.     .line    36
  383.     addl    $4,-8(%ebp)
  384. _$SetEnv13:
  385.     .line    29
  386.     movl    -4(%ebp),%edx
  387.     leal    (%ebx,%edx),%ebx
  388. _$SetEnv12:
  389.     cmpb    $0,(,%ebx)
  390.     jne    _$SetEnv9
  391.     .line    41
  392.     movl    -8(%ebp),%edx
  393.     movl    $0,(,%edx)
  394.     movl    $1,%eax
  395. _$SetEnv1:
  396.     .line    42
  397.     popl    %edi
  398.     popl    %esi
  399.     popl    %ebx
  400.     leave
  401.     ret
  402. _$SetEnv22:
  403.     .size    __Setenvironment,_$SetEnv22-__Setenvironment
  404.     .data
  405.     .globl    __environ
  406.     .bss
  407.     .extern    _strcpy
  408.     .extern    _malloc
  409.     .extern    _GetEnvironmentStringsA@0
  410.     .text
  411.     .extern    _cexit
  412.     .extern    _ExitProcess@4
  413.     .extern    _setbuf
  414.     .extern    _fdopen
  415.     .extern    _fclose
  416.     .extern    _raise
  417.     .globl    _stdout
  418.     .globl    _stdin
  419.     .globl    _stderr
  420.     .globl    __environ
  421.     .data
  422.     .align    4
  423. __UserEntryPoint:
  424.     .long    0
  425. _stdout:
  426.     .long    0
  427. _stdin:
  428.     .long    0
  429. _stderr:
  430.     .long    0
  431. __environ:
  432.     .long    0
  433. _$ExcepData:
  434.     .long    0
  435.     .align    1
  436. _$2:    .byte    37,115,0
  437.     .align    1
  438. _$74:
  439.     .byte    119,0
  440.     .align    1
  441. _$73:
  442.     .byte    114,0
  443.     .section .idata$3
  444.     .long   0
  445.     .long   0
  446.     .long   0
  447.     .long   0
  448.     .long   0
  449.     .long   0
  450.     .long   0
  451.     .long   0
  452.     .long   0
  453.     .long   0
  454.     .long   0
  455.     .long   0
  456.     .long   0
  457.     .long   0
  458.     .long   0
  459.     .long   0
  460.     .section .idata$6
  461.     .long   0
  462.     .section .rdata
  463.     .long   0
  464.     .long   0
  465.     .long   1
  466.     .long   1
  467.     .long   0
  468.     .long   0
  469.     .long   0
  470.     .long   0
  471.     .long   0
  472.     .long   0
  473.     .long   0
  474.     .long   0
  475.     .long   0
  476.     .long   0
  477.     .long   0
  478.     .long   0
  479.     .long   0
  480.     .long   0
  481.     .long   0
  482.     .long   0
  483.     .long   0
  484.