From cc0a04d351c69a99f65342ad5822f2bba8b247d0 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 10 Feb 2016 21:46:51 -0800 Subject: runtime: fix errno sign for some mmap and mincore cases The caller of mmap expects it to return a positive errno value, but the linux-arm64 and nacl-386 system calls returned a negative errno value. Correct them to negate the errno value. The caller of mincore expects it to return a negative errno value (yes, this is inconsistent), but the linux-mips64x and linux-ppc64x system call returned a positive errno value. Correct them to negate the errno value. Add a test that mmap returns errno with the correct sign. Brad added a test for mincore's errno value in https://golang.org/cl/19457. Fixes #14297. Change-Id: I2b93f32e679bd1eae1c9aef9ae7bcf0ba39521b5 Reviewed-on: https://go-review.googlesource.com/19455 Reviewed-by: Brad Fitzpatrick Reviewed-by: Minux Ma Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot --- src/runtime/sys_linux_arm64.s | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/runtime/sys_linux_arm64.s') diff --git a/src/runtime/sys_linux_arm64.s b/src/runtime/sys_linux_arm64.s index ca0e07aaa4..94c101a3d4 100644 --- a/src/runtime/sys_linux_arm64.s +++ b/src/runtime/sys_linux_arm64.s @@ -269,6 +269,9 @@ TEXT runtime·mmap(SB),NOSPLIT,$-8 MOVD $SYS_mmap, R8 SVC + CMN $4095, R0 + BCC 2(PC) + NEG R0,R0 MOVD R0, ret+32(FP) RET -- cgit v1.3-5-g9baa