Commit e01e9176 authored by Ian Lance Taylor's avatar Ian Lance Taylor Committed by Tobias Klauser

runtime: use correct pipe call for mips/mips64 GNU/Linux

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: default avatarTobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent d960de0b
......@@ -19,10 +19,9 @@
#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
......@@ -115,7 +114,8 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0-28
// 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
......
......@@ -112,11 +112,19 @@ TEXT runtime·read(SB),NOSPLIT,$0-16
// 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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment