[klibc] alpha: write pipe() system call in assembly

pipe() was written in C, but the implementation used macros from
the kernel which are no longer good.  Just write the danged thing
all in assembly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
diff --git a/usr/klibc/arch/alpha/pipe.S b/usr/klibc/arch/alpha/pipe.S
new file mode 100644
index 0000000..18244db
--- /dev/null
+++ b/usr/klibc/arch/alpha/pipe.S
@@ -0,0 +1,38 @@
+#
+# arch/alpha/pipe.S
+#
+
+#
+# pipe() on alpha returns both file descriptors in registers --
+# $0 (v0) and $20 (a4) respectively.  This is unlike any other system call,
+# as far as I can tell.
+#
+
+#include <asm/unistd.h>
+#include <machine/asm.h>
+
+	.text
+	.align	3
+	.type	pipe, @function
+	.ent	pipe, 0
+	.globl	pipe
+pipe:
+	.frame	sp,0,ra,0
+	lda	v0, __NR_pipe
+	callsys
+	beq	a3, 1f
+	br	pv, 2f			# pv <- pc
+2:
+	ldgp	gp, 0(pv)
+	lda	a1, errno
+	lda	v0, -1(zero)
+	stl	a3, 0(a1)
+	ret	zero,(ra),1
+1:
+	stl	v0, 0(a0)
+	mov	v0, zero
+	stl	a3, 4(a0)
+	ret	zero,(ra),1
+
+	.size	__syscall_dual1,.-__syscall_dual1
+	.end	__syscall_dual1
diff --git a/usr/klibc/arch/alpha/pipe.c b/usr/klibc/arch/alpha/pipe.c
deleted file mode 100644
index ca24360..0000000
--- a/usr/klibc/arch/alpha/pipe.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <unistd.h>
-#include <sys/syscall.h>
-
-/* pipe() on alpha returns both file descriptors in registers --
-   $0 and $20 respectively.  This is unlike any other system call,
-   as far as I can tell. */
-
-int pipe(int *fds)
-{
-	register long sc_0 __asm__("$0");
-	register long sc_19 __asm__("$19");
-	register long sc_20 __asm__("$20");
-
-	sc_0 = __NR_pipe;
-	asm volatile ("callsys":"=r" (sc_0), "=r"(sc_19), "=r"(sc_20)
-		      :"0"(sc_0)
-		      :_syscall_clobbers);
-
-	if (sc_19) {
-		errno = sc_19;
-		return -1;
-	}
-
-	fds[0] = sc_0;
-	fds[1] = sc_20;
-
-	return 0;
-}