Skip to content

Commit

Permalink
runtime: check error codes for arm64 system calls
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
randall77 committed Apr 22, 2015
1 parent a76099f commit 3a56aa0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/runtime/sys_linux_arm64.s
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 3a56aa0

Please sign in to comment.