]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/i386/sysdep.S
update from main archive 960906
[thirdparty/glibc.git] / sysdeps / unix / i386 / sysdep.S
CommitLineData
edf5b2d7 1/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
28f540f4
RM
2This file is part of the GNU C Library.
3
4The GNU C Library is free software; you can redistribute it and/or
5modify it under the terms of the GNU Library General Public License as
6published by the Free Software Foundation; either version 2 of the
7License, or (at your option) any later version.
8
9The GNU C Library is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12Library General Public License for more details.
13
14You should have received a copy of the GNU Library General Public
15License along with the GNU C Library; see the file COPYING.LIB. If
16not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17Cambridge, MA 02139, USA. */
18
19#include <sysdep.h>
20#define _ERRNO_H
21#include <errnos.h>
22
23.globl C_SYMBOL_NAME(errno)
24.globl syscall_error
25
26#undef syscall_error
27#ifdef NO_UNDERSCORES
28__syscall_error:
29#else
30syscall_error:
31#endif
32#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
33 /* We translate the system's EWOULDBLOCK error into EAGAIN.
34 The GNU C library always defines EWOULDBLOCK==EAGAIN.
35 EWOULDBLOCK_sys is the original number. */
36 cmpl $EWOULDBLOCK_sys, %eax /* Is it the old EWOULDBLOCK? */
37 jne notb /* Branch if not. */
38 movl $EAGAIN, %eax /* Yes; translate it to EAGAIN. */
439d1d45 39notb:
edf5b2d7 40#endif
439d1d45
RM
41#ifndef PIC
42 movl %eax, C_SYMBOL_NAME(errno)
edf5b2d7
UD
43#ifdef _LIBC_REENTRANT
44 pushl %eax
45 call __errno_location
46 popl %ecx
47 movl %ecx, (%eax)
48#endif
439d1d45 49#else
1d234146
RM
50 /* The caller has pushed %ebx and then set it up to
51 point to the GOT before calling us through the PLT. */
52 movl C_SYMBOL_NAME(errno@GOT)(%ebx), %ecx
edf5b2d7
UD
53
54#ifndef _LIBC_REENTRANT
1d234146
RM
55 /* Pop %ebx value saved before jumping here. */
56 popl %ebx
439d1d45 57 movl %eax, (%ecx)
edf5b2d7
UD
58#else
59 movl %eax, (%ecx)
60 pushl %eax
61 call C_SYMBOL_NAME(__errno_location@PLT)
62 popl %ecx
63 /* Pop %ebx value saved before jumping here. */
64 popl %ebx
65 movl %ecx, (%eax)
66#endif
439d1d45 67#endif
28f540f4
RM
68 movl $-1, %eax
69 ret
edf5b2d7
UD
70
71#ifdef __ELF__
72#undef __syscall_error
73.Lfe2:
74 .size __syscall_error, .Lfe2-__syscall_error
75#endif