update from main archive 961203
[platform/upstream/glibc.git] / sysdeps / unix / alpha / sysdep.S
1 /* Copyright (C) 1993, 1996 Free Software Foundation, Inc.
2    Contributed by Brendan Kehoe (brendan@zen.org).
3
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.
8
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.
13
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.  */
18
19 #include <sysdep.h>
20 #include <features.h>
21
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
33         .text
34         .align 2
35
36 #ifdef  _LIBC_REENTRANT
37
38         .globl __syscall_error
39         .ent __syscall_error
40 __syscall_error:
41         ldgp    gp, 0(t12)
42         lda     sp, -16(sp)
43         .frame  sp, 16, ra, 0
44         stq     ra, 0(sp)
45         stq     v0, 8(sp)
46         .mask   0x4000001, -16
47         .prologue 1
48
49         /* Store into the "real" variable.  */
50         stl     v0, errno
51
52         /* Find our per-thread errno address  */
53         jsr     ra, __errno_location
54
55         /* Store the error value.  */
56         ldl     t0, 8(sp)
57         stl     t0, 0(v0)
58
59         /* And kick back a -1.  */
60         ldi     v0, -1
61
62         ldq     ra, 0(sp)
63         lda     sp, 16(sp)
64         ret
65         .end __syscall_error
66 #else
67
68 ENTRY(__syscall_error)
69         ldgp    gp, 0(t12)
70         .prologue 1
71
72         stl     v0, errno
73         lda     v0, -1
74         ret
75         END(__syscall_error)
76
77 #endif /* _LIBC_REENTRANT */