1
0
mirror of https://github.com/golang/go synced 2024-11-17 22:14:43 -07:00

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: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Ian Lance Taylor 2019-10-21 02:04:14 -07:00 committed by Tobias Klauser
parent d960de0b6f
commit e01e917687
2 changed files with 12 additions and 4 deletions

View File

@ -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

View File

@ -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