summary refs log tree commit diff
path: root/sysdeps/unix/alpha/sysdep.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/alpha/sysdep.S')
-rw-r--r--sysdeps/unix/alpha/sysdep.S56
1 files changed, 50 insertions, 6 deletions
diff --git a/sysdeps/unix/alpha/sysdep.S b/sysdeps/unix/alpha/sysdep.S
index 336eb02029..8d70bda21e 100644
--- a/sysdeps/unix/alpha/sysdep.S
+++ b/sysdeps/unix/alpha/sysdep.S
@@ -17,8 +17,7 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
 #include <sysdep.h>
-#define _ERRNO_H
-#include <errnos.h>
+#include <features.h>
 
 	.section .bss
 	.globl errno
@@ -30,15 +29,60 @@ errno:	.space 4
 #endif
 
 	.text
-LEAF(__syscall_error, 0)
+	.align 2
+
+#ifdef	_LIBC_REENTRANT
+
+	.globl __syscall_error
+	.ent __syscall_error
+__syscall_error:
 	ldgp	gp, 0(t12)
+	lda	sp, -16(sp)
+	.frame	sp, 16, ra, 0
+	stq	ra, 0(sp)
+	stq	v0, 8(sp)
+	.mask	0x4000001, -16
 	.prologue 1
 
-	/* Store return value in errno... */
-	stl	v0, errno
+	/* Find our pre-thread errno address  */
+	jsr	ra, __errno_location
+
+	/* Store the error value.  */
+	ldl	t0, 8(sp)
+	stl	t0, 0(v0)
 
-	/* And just kick back a -1.  */
+	/* And kick back a -1.  */
 	ldi	v0, -1
+
+	ldq	ra, 0(sp)
+	lda	sp, 16(sp)
 	ret
+	.end __syscall_error
+
+/* A default non-threaded version of __errno_location that just returns
+   the address of errno.  */
+
+	.weak	__errno_location
+	.ent	__errno_location
+__errno_location:
+	.frame	sp, 0, ra
+	ldgp	gp, 0(t12)
+	.mask	0, 0
+	.prologue 1
 
+	lda	v0, errno
+	ret
+	.end __errno_location
+
+#else
+
+ENTRY(__syscall_error)
+	ldgp	gp, 0(t12)
+	.prologue 1
+
+	stl	v0, errno
+	lda	v0, -1
+	ret
 	END(__syscall_error)
+
+#endif /* _LIBC_REENTRANT */