Update.
[glibc.git] / sysdeps / unix / alpha / sysdep.S
blobd79c48a9bf380e8935aef749955dfc9b46ef3c80
1 /* Copyright (C) 1993, 1996, 1998 Free Software Foundation, Inc.
2    Contributed by Brendan Kehoe (brendan@zen.org).
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Library General Public License as
6    published by the Free Software Foundation; either version 2 of the
7    License, or (at your option) any later version.
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Library General Public License for more details.
14    You should have received a copy of the GNU Library General Public
15    License along with the GNU C Library; see the file COPYING.LIB.  If
16    not, write to the Free Software Foundation, Inc.,
17    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
19 #include <sysdep.h>
20 #include <features.h>
22         .section .bss
23         .globl errno
24         .align 2
25 errno:  .space 4
26 #ifdef __ELF__
27         .type errno, @object
28         .size errno, 4
29 #endif
30         .globl __errno
31 __errno = errno
32         .globl _errno
33 _errno = errno
35         .text
36         .align 2
38 #ifdef  _LIBC_REENTRANT
40         .globl __syscall_error
41         .ent __syscall_error
42 __syscall_error:
43         ldgp    gp, 0(pv)
44         lda     sp, -16(sp)
45         .frame  sp, 16, ra, 0
46         stq     ra, 0(sp)
47         stq     v0, 8(sp)
48         .mask   0x4000001, -16
49         .prologue 1
51         /* Store into the "real" variable.  */
52         stl     v0, errno
54         /* Find our per-thread errno address  */
55         jsr     ra, __errno_location
57         /* Store the error value.  */
58         ldq     t0, 8(sp)
59         stl     t0, 0(v0)
61         /* And kick back a -1.  */
62         ldi     v0, -1
64         ldq     ra, 0(sp)
65         lda     sp, 16(sp)
66         ret
67         .end __syscall_error
68 #else
70 ENTRY(__syscall_error)
71         ldgp    gp, 0(t12)
72         .prologue 1
74         stl     v0, errno
75         lda     v0, -1
76         ret
77         END(__syscall_error)
79 #endif /* _LIBC_REENTRANT */