summaryrefslogtreecommitdiffstats
path: root/usr/klibc/arch/sh/pipe.S
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/arch/sh/pipe.S')
-rw-r--r--usr/klibc/arch/sh/pipe.S35
1 files changed, 35 insertions, 0 deletions
diff --git a/usr/klibc/arch/sh/pipe.S b/usr/klibc/arch/sh/pipe.S
new file mode 100644
index 0000000..01b055b
--- /dev/null
+++ b/usr/klibc/arch/sh/pipe.S
@@ -0,0 +1,35 @@
+/*
+ * arch/sh/pipe.S
+ *
+ * The pipe system call is special on sh: it returns
+ * the two file descriptors in r0 and r1.
+ */
+
+#include <asm/unistd.h>
+
+ .section ".text.syscall","ax"
+ .align 2
+ .globl pipe
+ .type pipe,@function
+pipe:
+ mov #__NR_pipe, r3
+ trapa #0x10
+ mov.l 1f,r2
+ cmp/hs r0,r2
+ bt/s 3f
+ neg r0,r2
+ mov.l 2f,r3
+ mov.l r2,@r3
+ rts
+ mov #-1,r0
+3:
+ mov.l r0, @r4
+ mov.l r1, @(4, r4)
+ rts
+ mov #0,r0
+
+ .align 2
+1: .long -4096 /* Errno limit */
+2: .long errno
+
+ .size pipe,.-pipe