123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- #include <sysdep.h>
- #define _ERRNO_H
- #include <bits/errno.h>
- #include <bp-asm.h>
- #include <bp-sym.h>
- #ifdef IS_IN_rtld
- # include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */
- #endif
- .globl C_SYMBOL_NAME(errno)
- .globl syscall_error
- #undef syscall_error
- #ifdef NO_UNDERSCORES
- __syscall_error:
- #else
- syscall_error:
- #endif
- #if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
-
- cmpl $EWOULDBLOCK_sys, %eax
- jne notb
- movl $EAGAIN, %eax
- notb:
- #endif
- #ifndef PIC
- # if USE___THREAD
- # ifndef NO_TLS_DIRECT_SEG_REFS
- movl %eax, %gs:C_SYMBOL_NAME(errno@NTPOFF)
- # else
- movl %gs:0, %ecx
- movl %eax, C_SYMBOL_NAME(errno@NTPOFF)(%ecx)
- # endif
- # elif !defined _LIBC_REENTRANT
- movl %eax, C_SYMBOL_NAME(errno)
- # else
- pushl %eax
- PUSH_ERRNO_LOCATION_RETURN
- call BP_SYM (PAL(__errno_location))
- POP_ERRNO_LOCATION_RETURN
- popl %ecx
- movl %ecx, (%eax)
- # endif
- #else
-
- # if USE___THREAD
- movl C_SYMBOL_NAME(errno@GOTNTPOFF)(%ebx), %ecx
-
- popl %ebx
- # ifndef NO_TLS_DIRECT_SEG_REFS
- addl %gs:0, %ecx
- movl %eax, (%ecx)
- # else
- movl %eax, %gs:0(%ecx)
- # endif
- # elif RTLD_PRIVATE_ERRNO
- movl %eax, C_SYMBOL_NAME(rtld_errno@GOTOFF)(%ebx)
-
- popl %ebx
- # elif !defined _LIBC_REENTRANT
- movl C_SYMBOL_NAME(errno@GOT)(%ebx), %ecx
-
- popl %ebx
- movl %eax, (%ecx)
- # else
- pushl %eax
- PUSH_ERRNO_LOCATION_RETURN
- call C_SYMBOL_NAME (BP_SYM (PAL(__errno_location))@PLT)
- POP_ERRNO_LOCATION_RETURN
- popl %ecx
-
- popl %ebx
- movl %ecx, (%eax)
- # endif
- #endif
- movl $-1, %eax
- ret
- #undef __syscall_error
- END (__syscall_error)
|