From 4f364be08de3c5b3d60a134ce9c9d24de834b42d Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 21 Oct 2019 09:55:23 -0700 Subject: [PATCH] runtime: correctly negate errno value for *BSD ARM Fixes #35037 Change-Id: I0b9bcd001556cd409994d83dabcdd6e32b001d28 Reviewed-on: https://go-review.googlesource.com/c/go/+/202441 Run-TryBot: Ian Lance Taylor Reviewed-by: Bryan C. Mills --- src/runtime/sys_freebsd_arm.s | 4 ++-- src/runtime/sys_netbsd_arm.s | 4 ++-- src/runtime/sys_openbsd_arm.s | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/runtime/sys_freebsd_arm.s b/src/runtime/sys_freebsd_arm.s index cdfecacfbc7..8da36dff178 100644 --- a/src/runtime/sys_freebsd_arm.s +++ b/src/runtime/sys_freebsd_arm.s @@ -117,7 +117,7 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0 MOVW n+8(FP), R2 // arg 3 count MOVW $SYS_read, R7 SWI $0 - SUB.CS $0, R0, R0 // caller expects negative errno + RSB.CS $0, R0 // caller expects negative errno MOVW R0, ret+12(FP) RET @@ -153,7 +153,7 @@ TEXT runtime·write1(SB),NOSPLIT|NOFRAME,$0 MOVW n+8(FP), R2 // arg 3 count MOVW $SYS_write, R7 SWI $0 - SUB.CS $0, R0, R0 // caller expects negative errno + RSB.CS $0, R0 // caller expects negative errno MOVW R0, ret+12(FP) RET diff --git a/src/runtime/sys_netbsd_arm.s b/src/runtime/sys_netbsd_arm.s index 423982b1158..c8ee262d59b 100644 --- a/src/runtime/sys_netbsd_arm.s +++ b/src/runtime/sys_netbsd_arm.s @@ -92,7 +92,7 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0 MOVW p+4(FP), R1 MOVW n+8(FP), R2 SWI $SYS_read - SUB.CS $0, R0, R0 // caller expects negative errno + RSB.CS $0, R0 // caller expects negative errno MOVW R0, ret+12(FP) RET @@ -125,7 +125,7 @@ TEXT runtime·write1(SB),NOSPLIT|NOFRAME,$0 MOVW p+4(FP), R1 // arg 2 - buf MOVW n+8(FP), R2 // arg 3 - nbyte SWI $SYS_write - SUB.CS $0, R0, R0 // caller expects negative errno + RSB.CS $0, R0 // caller expects negative errno MOVW R0, ret+12(FP) RET diff --git a/src/runtime/sys_openbsd_arm.s b/src/runtime/sys_openbsd_arm.s index 3736451ba2a..92ab3270bee 100644 --- a/src/runtime/sys_openbsd_arm.s +++ b/src/runtime/sys_openbsd_arm.s @@ -55,7 +55,7 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0 MOVW n+8(FP), R2 // arg 3 - nbyte MOVW $3, R12 // sys_read SWI $0 - SUB.CS $0, R0, R0 // caller expects negative errno + RSB.CS $0, R0 // caller expects negative errno MOVW R0, ret+12(FP) RET @@ -82,7 +82,7 @@ TEXT runtime·write1(SB),NOSPLIT|NOFRAME,$0 MOVW n+8(FP), R2 // arg 3 - nbyte MOVW $4, R12 // sys_write SWI $0 - SUB.CS $0, R0, R0 // caller expects negative errno + RSB.CS $0, R0 // caller expects negative errno MOVW R0, ret+12(FP) RET