aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-03-22 12:57:36 -0700
committerIan Lance Taylor <iant@golang.org>2020-03-25 20:54:36 +0000
commit21f453b848405dee74e5d1d8863d28a3db4758f2 (patch)
tree4d8bc2af60c008ef292562c28324baa910b9c97c
parent74870669fc1d20ba44a32fd5e40fd3f3d7311a02 (diff)
downloadgo-21f453b848405dee74e5d1d8863d28a3db4758f2.tar.gz
go-21f453b848405dee74e5d1d8863d28a3db4758f2.zip
[release-branch.go1.14] runtime: negate errno value for mips pipe/pipe2
The callers expect negative errno values, so negate them when necessary. No test because there is no reasonable way to make pipe/pipe2 fail. This was reported on a system on which pipe2 returned ENOSYS. For #37997 Fixes #38005 Change-Id: I3ad6cbbc2521cf495f8df6ec991a3f781122b508 Reviewed-on: https://go-review.googlesource.com/c/go/+/224592 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> (cherry picked from commit 20b46c7c697ce9d833141abe9aa0ea6101f00ae2) Reviewed-on: https://go-review.googlesource.com/c/go/+/225419
-rw-r--r--src/runtime/sys_linux_mips64x.s4
-rw-r--r--src/runtime/sys_linux_mipsx.s3
2 files changed, 7 insertions, 0 deletions
diff --git a/src/runtime/sys_linux_mips64x.s b/src/runtime/sys_linux_mips64x.s
index 723cfe43d9..6668a0fd86 100644
--- a/src/runtime/sys_linux_mips64x.s
+++ b/src/runtime/sys_linux_mips64x.s
@@ -117,6 +117,8 @@ TEXT runtime·pipe(SB),NOSPLIT|NOFRAME,$0-12
MOVV R0, R5
MOVV $SYS_pipe2, R2
SYSCALL
+ BEQ R7, 2(PC)
+ SUBVU R2, R0, R2 // caller expects negative errno
MOVW R2, errno+8(FP)
RET
@@ -126,6 +128,8 @@ TEXT runtime·pipe2(SB),NOSPLIT|NOFRAME,$0-20
MOVW flags+0(FP), R5
MOVV $SYS_pipe2, R2
SYSCALL
+ BEQ R7, 2(PC)
+ SUBVU R2, R0, R2 // caller expects negative errno
MOVW R2, errno+16(FP)
RET
diff --git a/src/runtime/sys_linux_mipsx.s b/src/runtime/sys_linux_mipsx.s
index 15893a7a28..fab2ab3892 100644
--- a/src/runtime/sys_linux_mipsx.s
+++ b/src/runtime/sys_linux_mipsx.s
@@ -118,6 +118,7 @@ TEXT runtime·pipe(SB),NOSPLIT,$0-12
MOVW $-1, R1
MOVW R1, r+0(FP)
MOVW R1, w+4(FP)
+ SUBU R2, R0, R2 // caller expects negative errno
MOVW R2, errno+8(FP)
RET
pipeok:
@@ -132,6 +133,8 @@ TEXT runtime·pipe2(SB),NOSPLIT,$0-16
MOVW flags+0(FP), R5
MOVW $SYS_pipe2, R2
SYSCALL
+ BEQ R7, 2(PC)
+ SUBU R2, R0, R2 // caller expects negative errno
MOVW R2, errno+12(FP)
RET