From 3a56aa0d3eb14aed7829c41df47b653a2f5c16f7 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Tue, 21 Apr 2015 15:47:58 -0700 Subject: [PATCH] runtime: check error codes for arm64 system calls Unlike linux arm32, linux arm64 does not set the condition codes to indicate whether a system call failed or not. We must check if the return value is in the error code range (the same as amd64 does). Fixes runtime.TestBadOpen test. Change-Id: I97a8b0a17b5f002a3215c535efa91d199cee3309 Reviewed-on: https://go-review.googlesource.com/9220 Reviewed-by: Russ Cox --- src/runtime/sys_linux_arm64.s | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/runtime/sys_linux_arm64.s b/src/runtime/sys_linux_arm64.s index 32404570fe..52b34e8f41 100644 --- a/src/runtime/sys_linux_arm64.s +++ b/src/runtime/sys_linux_arm64.s @@ -72,6 +72,7 @@ TEXT runtime·closefd(SB),NOSPLIT,$-8-12 MOVW fd+0(FP), R0 MOVD $SYS_close, R8 SVC + CMN $4095, R0 BCC done MOVW $-1, R0 done: @@ -84,6 +85,7 @@ TEXT runtime·write(SB),NOSPLIT,$-8-28 MOVW n+16(FP), R2 MOVD $SYS_write, R8 SVC + CMN $4095, R0 BCC done MOVW $-1, R0 done: @@ -96,6 +98,7 @@ TEXT runtime·read(SB),NOSPLIT,$-8-28 MOVW n+16(FP), R2 MOVD $SYS_read, R8 SVC + CMN $4095, R0 BCC done MOVW $-1, R0 done: -- 2.50.0