[klibc] ia64: Replace pipe.c with pipe.S
There is a concern that use of macros inside "C" versions of
system call stubs could have licensing consequences. Remove
any doubt by re-writing the stub in assember.
[ hpa: specifically, the origin of this particular file is a bit murky
so avoid any and all concerns by just replacing it; all other IA64
system calls are already in pure assembly. ]
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
diff --git a/usr/klibc/arch/ia64/pipe.S b/usr/klibc/arch/ia64/pipe.S
new file mode 100644
index 0000000..8ecd972
--- /dev/null
+++ b/usr/klibc/arch/ia64/pipe.S
@@ -0,0 +1,29 @@
+#include <asm/unistd.h>
+ .align 32
+ .proc pipe
+ .global pipe
+pipe:
+ alloc r16 = ar.pfs, 1, 0, 8, 0
+ mov r33 = r32
+ mov r15=__NR_pipe
+ ;;
+ break 0x100000 // Do the syscall
+ ;;
+
+ cmp.ne p6, p7 = -1, r10
+ mov r15 = r0
+ ;;
+(p7) addl r14 = @ltoffx(errno), r1
+
+(p6) st4 [r32] = r8, 4
+(p7) addl r15 = -1, r0
+ ;;
+
+(p7) ld8.mov r14 = [r14], errno
+(p6) st4 [r32] = r9
+ ;;
+
+(p7) st4 [r14] = r8
+ mov r8 = r15
+ br.ret.sptk.many b0
+ .endp pipe
diff --git a/usr/klibc/arch/ia64/pipe.c b/usr/klibc/arch/ia64/pipe.c
deleted file mode 100644
index 1335032..0000000
--- a/usr/klibc/arch/ia64/pipe.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * pipe.c
- */
-
-#include <sys/syscall.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("break 0x100000;;\n\t"
- :"=r"(_r8), "=r"(_r10), "=r"(_r15),
- "=r"(_out0), "=r"(_r9)
- :"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;
-}