]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use correct pipe call for mips/mips64 GNU/Linux
authorIan Lance Taylor <iant@golang.org>
Mon, 21 Oct 2019 09:04:14 +0000 (02:04 -0700)
committerTobias Klauser <tobias.klauser@gmail.com>
Mon, 21 Oct 2019 11:41:11 +0000 (11:41 +0000)
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>

src/runtime/sys_linux_mips64x.s
src/runtime/sys_linux_mipsx.s

index 37e4842f08912182f199c8b4cdb9b4ba96c97657..b0cb0672faa49492433b054d8b68a8e1a13b6913 100644 (file)
 #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
index b1cfafb4c95ef6db4d029e74b5832816eefc0870..77f932f50aeb94ec3266388209629405c3ea44fa 100644 (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