diff options
author | H. Peter Anvin <hpa@zytor.com> | 2006-05-15 00:36:56 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2006-05-15 00:36:56 -0700 |
commit | 49e48b9e925b3f15c7e24c150f7be4d65e9d9fe7 (patch) | |
tree | 69fdbb687252ad54a7308fc329a3a98e9fe95844 | |
parent | 86e028bac1b6ee221b52c63694fd4674bf732c99 (diff) | |
download | klibc-49e48b9e925b3f15c7e24c150f7be4d65e9d9fe7.tar.gz |
[klibc] alpha: write pipe() system call in assemblyklibc-1.3.21
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>
-rw-r--r-- | usr/klibc/arch/alpha/pipe.S | 38 | ||||
-rw-r--r-- | usr/klibc/arch/alpha/pipe.c | 28 |
2 files changed, 38 insertions, 28 deletions
diff --git a/usr/klibc/arch/alpha/pipe.S b/usr/klibc/arch/alpha/pipe.S new file mode 100644 index 0000000000000..18244db6749f9 --- /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 ca243600abed8..0000000000000 --- 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; -} |