summaryrefslogtreecommitdiffstats
path: root/usr/klibc/arch/sh/pipe.S
blob: 01b055bc2636f0e5814d91fab6c9cef0b7bd1eb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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