On MIPS, pipe returns two values rather than taking a pointer.
On MIPS64, call pipe2 rather than pipe.
Also, use the correct system call number for fcntl on mips64.
Change-Id: Ie72acdefeb593f44cb98735fc40eac99cf73509e
Reviewed-on: https://go-review.googlesource.com/c/go/+/202417
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
#define SYS_read 5000
#define SYS_write 5001
#define SYS_close 5003
-#define SYS_pipe 5021
#define SYS_getpid 5038
#define SYS_kill 5060
-#define SYS_fcntl 5080
+#define SYS_fcntl 5070
#define SYS_mmap 5009
#define SYS_munmap 5011
#define SYS_setitimer 5036
// func pipe() (r, w int32, errno int32)
TEXT runtime·pipe(SB),NOSPLIT|NOFRAME,$0-12
MOVV $r+0(FP), R4
- MOVV $SYS_pipe, R2
+ MOVV R0, R5
+ MOVV $SYS_pipe2, R2
SYSCALL
MOVW R2, errno+8(FP)
RET
// func pipe() (r, w int32, errno int32)
TEXT runtime·pipe(SB),NOSPLIT,$0-12
- MOVW $r+0(FP), R4
MOVW $SYS_pipe, R2
SYSCALL
+ BEQ R7, pipeok
+ MOVW $-1, R1
+ MOVW R1, r+0(FP)
+ MOVW R1, w+4(FP)
MOVW R2, errno+8(FP)
RET
+pipeok:
+ MOVW R2, r+0(FP)
+ MOVW R3, w+4(FP)
+ MOVW R0, errno+8(FP)
+ RET
// func pipe2(flags int32) (r, w int32, errno int32)
TEXT runtime·pipe2(SB),NOSPLIT,$0-16