2005-12-27 Roland McGrath <roland@redhat.com>
[glibc-ports.git] / sysdeps / unix / am33 / sysdep.S
blobd6df22ed6e94c52373f7a446124f9bad963ea090
1 /* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001
2    Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4    Contributed by Alexandre Oliva <aoliva@redhat.com>.
5    Based on ../i386/sysdep.S.
7    The GNU C Library is free software; you can redistribute it and/or
8    modify it under the terms of the GNU Library General Public License as
9    published by the Free Software Foundation; either version 2 of the
10    License, or (at your option) any later version.
12    The GNU C Library is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    Library General Public License for more details.
17    You should have received a copy of the GNU Library General Public
18    License along with the GNU C Library; see the file COPYING.LIB.  If not,
19    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20    Boston, MA 02111-1307, USA.  */
22 #include <sysdep.h>
23 #define _ERRNO_H
24 #include <bits/errno.h>
26 .globl C_SYMBOL_NAME(errno)
27 .globl syscall_error
29 #undef syscall_error
30 #ifdef NO_UNDERSCORES
31 __syscall_error:
32 #else
33 syscall_error:
34 #endif
35 #if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
36         /* We translate the system's EWOULDBLOCK error into EAGAIN.
37            The GNU C library always defines EWOULDBLOCK==EAGAIN.
38            EWOULDBLOCK_sys is the original number.  */
39         cmp EWOULDBLOCK_sys,d0  /* Is it the old EWOULDBLOCK?  */
40         bne .Lnotb              /* Branch if not.  */
41         mov EAGAIN,d0           /* Yes; translate it to EAGAIN.  */
42 .Lnotb:
43 #endif
44 #ifndef PIC
45 # ifndef _LIBC_REENTRANT
46         mov d0,(C_SYMBOL_NAME (errno))
47 # else
48         movm [d2],(sp)
49         add -12,sp
50         mov d0,d2
51         call __errno_location,[],0
52         mov d2,(a0)
53         add 12,sp
54         movm (sp),[d2]
55 # endif
56 #else
57 # error "This shouldn't be assembled for PIC"
58 #endif
59         mov -1,d0
60         mov d0,a0
61         ret
63 #undef  __syscall_error
64 END (__syscall_error)