/ dll0.s (emx+gcc) -- Copyright (c) 1992-1993 by Eberhard Mattes

/ We're linking emxlibc.dll with dll0.obj, therefore we don't need
/ this module in emxlibc.dll
#if !defined (_LIBCDLL)

        .globl  __text
        .globl  ___syscall
        .globl  __data
        .globl  __heap_base
        .globl  __heap_brk
        .globl  __heap_end
        .globl  __init
        .globl  __osmode

        .text

__text:
        push    $__data
#if defined (OMF)
        call    Ldummy
#else
        call    __dos_init
#endif
        jmp     __init


___syscall:
#if defined (OMF)
        call    _emx_syscall
#else
        call    __dos_syscall
#endif
        ret

Ldummy: popl    %eax
        add     $4, %esp
        jmp     %eax

__init: cld
        pushl   %ebp
        movl    %esp, %ebp
        pushl   12(%ebp)
        pushl   8(%ebp)
        call    __DLL_InitTerm
        addl    $8, %esp
        popl    %ebp
        ret

        .data

/ The data segment starts with a table containing the start and end
/ addresses of the text, data and bss segments

__data:
#if defined (OMF)
        .long   0
        .long   0
        .long   0
        .long   0
        .long   0
        .long   0
#else
        .long   __text
        .long   __etext
        .long   __data
        .long   __edata
        .long   __edata
        .long   __end
#endif
__heap_base:
        .long   0                       / heap base address
__heap_end:
        .long   0                       / heap end address
__heap_brk:
        .long   0                       / heap brk address
        .long   0                       / heap offset
        .long   __os2dll                / list of OS/2 DLL references
        .long   0                       / stack base address
        .long   0                       / stack end address
#if defined (OMF)
        .long   0x01000003              / flags: DLL, OMF
#else
        .long   0x01000001              / flags: DLL
#endif
        .long   0                       / reserved
        .long   0                       / reserved
        .byte   0                       / options
        .space  63, 0

/ first element of vector (N_SETA|N_EXT == 21)

#if defined (OMF)
__os2dll:
        .long   0, 0
#else
        .stabs  "__os2dll", 21, 0, 0, 0xffffffff
#endif

        .stabs  "___CTOR_LIST__", 21, 0, 0, 0xffffffff
        .stabs  "___DTOR_LIST__", 21, 0, 0, 0xffffffff

__osmode:
        .byte   1                       / OS2_MODE

#endif
