Pipe's a strange syscall. Here is a fix for ia64. mh -- Martin Hicks Wild Open Source Inc. mort@wildopensource.com 613-266-2296 # This is a BitKeeper generated patch for the following project: # Project Name: The kernel C library # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.249 -> 1.250 # klibc/SYSCALLS 1.37 -> 1.38 # klibc/arch/ia64/Makefile.inc 1.3 -> 1.4 # (new) -> 1.1 klibc/arch/ia64/pipe.c # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/11/24 mort@green.i.bork.org 1.250 # The ia64 pipe syscall is a weird one. Fix it up. # -------------------------------------------- # diff -Nru a/klibc/SYSCALLS b/klibc/SYSCALLS --- a/klibc/SYSCALLS Mon Nov 24 16:39:39 2003 +++ b/klibc/SYSCALLS Mon Nov 24 16:39:39 2003 @@ -73,7 +73,7 @@ int chmod(const char *, mode_t) int mkdir(const char *, mode_t) int rmdir(const char *) -<!alpha,mips,mips64> int pipe(int *) +<!alpha,ia64,mips,mips64> int pipe(int *) mode_t umask(mode_t) int chroot(const char *) int symlink(const char *, const char *) diff -Nru a/klibc/arch/ia64/Makefile.inc b/klibc/arch/ia64/Makefile.inc --- a/klibc/arch/ia64/Makefile.inc Mon Nov 24 16:39:39 2003 +++ b/klibc/arch/ia64/Makefile.inc Mon Nov 24 16:39:39 2003 @@ -8,9 +8,11 @@ # ARCHOBJS = \ + arch/$(ARCH)/setjmp.o \ arch/$(ARCH)/sigjmp.o \ - arch/$(ARCH)/vfork.o \ - arch/$(ARCH)/setjmp.o + arch/$(ARCH)/pipe.o \ + arch/$(ARCH)/vfork.o + ARCHSOOBJS = $(patsubst %o,%.lo,%(ARCHOBJS)) diff -Nru a/klibc/arch/ia64/pipe.c b/klibc/arch/ia64/pipe.c --- /dev/null Wed Dec 31 16:00:00 1969 +++ b/klibc/arch/ia64/pipe.c Mon Nov 24 16:39:39 2003 @@ -0,0 +1,42 @@ +/* + * pipe.c + */ + +#include "syscommon.h" +#include <klibc/archsys.h> + +#define ASM_CLOBBERS ,"out2", "out3", "out4", "out5", "out6", "out7", \ + /* Non-stacked integer registers, minus r8, r9, r10, r15. */ \ + "r2", "r3", "r11", "r12", "r13", "r14", "r16", "r17", "r18", \ + "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", \ + "r28", "r29", "r30", "r31", \ + /* Predicate registers. */ \ + "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15", \ + /* Non-rotating fp registers. */ \ + "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ + /* Branch registers. */ \ + "b6", "b7" + +int pipe(int *filedes) +{ + register long _r8 asm("r8"); + register long _r9 asm("r9"); + register long _r10 asm("r10"); + register long _r15 asm("r15") = __NR_pipe; + register long _out0 asm ("out0") = (long)filedes; + long _retval; + __asm __volatile (__IA64_BREAK + : "=r" (_r8), "=r" (_r10), "=r" (_r15), + "=r" (_out0) + : "2" (_r15), "3" (_out0) + : "memory" ASM_CLOBBERS); + if (_r10 == -1) { + errno = _r8; + _retval = -1; + } else { + filedes[0] = _r8; + filedes[1] = _r9; + _retval = 0; + } + return _retval; +}