/ _errno.s (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes

#include <emx/asm386.h>

#if defined (__MT__)

        .globl  __errno
        .globl  __errno_fun

        .text

        ALIGN

__errno:
__errno_fun:
        cmpb    $0, __osmode            /* _osmode == DOS_MODE? */
        je      1f                      /* Yes -> */
        fs
        movl    12, %eax                /* ptib2 */
        movl    0(%eax), %eax           /* TID */
        movl    __thread_tab(,%eax,4), %eax
/       addl    $0, %eax                /* address of errno */
Lreturn:EPILOGUE(_errno)

        ALIGN

1:      movl    __thread_tab+4, %eax
/       addl    $0, %eax                /* address of errno */
        jmp     Lreturn

#else

        .globl  __errno

        .text

        ALIGN

__errno:
        movl    $_errno, %eax
        EPILOGUE(_errno)

#endif
