aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_freebsd_arm64.s
diff options
context:
space:
mode:
authorNikhil Benesch <nikhil.benesch@gmail.com>2020-12-09 15:14:59 -0500
committerAustin Clements <austin@google.com>2020-12-22 15:59:17 +0000
commit4d27c4c223ccb7de3876abbac79b58ad9579be1a (patch)
treef1b8cc8a73f86e689615d13f934659a20eec319f /src/runtime/sys_freebsd_arm64.s
parent9b6147120a30a8bc30a41c1651f369e8bcb80948 (diff)
downloadgo-4d27c4c223ccb7de3876abbac79b58ad9579be1a.tar.gz
go-4d27c4c223ccb7de3876abbac79b58ad9579be1a.zip
runtime: correct error handling in several FreeBSD syscall wrappers
The FreeBSD syscall convention uses the carry flag to indicate whether an error has occured. The sys_umtx_op, thr_new, and pipe2 syscall wrappers were failing to account for this convention and silently suppressing errors as a result. This commit corrects these wrappers by copying the pattern used by the other fallible syscall wrappers. Note that futexsleep1 must now explicitly ignore the ETIMEDOUT error from sys_umtx_op. Previously ETIMEDOUT was implicitly ignored because sys_umtx_op never returned an error. Fixes #43106. Change-Id: I9c422b87cf4c6d308003bf42c3b419f785578b5d Reviewed-on: https://go-review.googlesource.com/c/go/+/276892 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Austin Clements <austin@google.com> Trust: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/runtime/sys_freebsd_arm64.s')
-rw-r--r--src/runtime/sys_freebsd_arm64.s6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/runtime/sys_freebsd_arm64.s b/src/runtime/sys_freebsd_arm64.s
index 8a4f9b7fa1..1aa09e87ca 100644
--- a/src/runtime/sys_freebsd_arm64.s
+++ b/src/runtime/sys_freebsd_arm64.s
@@ -60,6 +60,9 @@ TEXT runtime·sys_umtx_op(SB),NOSPLIT,$0
MOVD ut+24(FP), R4
MOVD $SYS__umtx_op, R8
SVC
+ BCC ok
+ NEG R0, R0
+ok:
MOVW R0, ret+32(FP)
RET
@@ -69,6 +72,9 @@ TEXT runtime·thr_new(SB),NOSPLIT,$0
MOVW size+8(FP), R1
MOVD $SYS_thr_new, R8
SVC
+ BCC ok
+ NEG R0, R0
+ok:
MOVW R0, ret+16(FP)
RET