From: Russ Cox Date: Fri, 15 Mar 2013 03:42:11 +0000 (-0400) Subject: runtime: use 64-bit negative error code on 64-bit machines X-Git-Tag: go1.1rc2~498 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e3c7a9db83b98a936cd90c46f39d86080c30a0d6;p=gostls13.git runtime: use 64-bit negative error code on 64-bit machines NEGL does a negation of the bottom 32 bits and then zero-extends to 64 bits, resulting in a negative 32-bit number but a positive 64-bit number. NEGQ does a full 64-bit negation, so that the result is negative both as a 32-bit and as a 64-bit number. This doesn't matter for the functions that are declared to return int32. It only matters for the ones that return int64 or void* [sic]. This will fix the current incorrect error in the OpenBSD/amd64 build. The build will still be broken, but it won't report a bogus error. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/7536046 --- diff --git a/src/pkg/runtime/sys_darwin_amd64.s b/src/pkg/runtime/sys_darwin_amd64.s index 271d43a31b..c8a45439d1 100644 --- a/src/pkg/runtime/sys_darwin_amd64.s +++ b/src/pkg/runtime/sys_darwin_amd64.s @@ -289,7 +289,7 @@ TEXT runtime·bsdthread_create(SB),7,$0 MOVQ $(0x2000000+360), AX // bsdthread_create SYSCALL JCC 3(PC) - NEGL AX + NEGQ AX RET MOVL $0, AX RET @@ -342,7 +342,7 @@ TEXT runtime·bsdthread_register(SB),7,$0 MOVQ $(0x2000000+366), AX // bsdthread_register SYSCALL JCC 3(PC) - NEGL AX + NEGQ AX RET MOVL $0, AX RET @@ -435,7 +435,7 @@ TEXT runtime·sysctl(SB),7,$0 MOVL $(0x2000000+202), AX // syscall entry SYSCALL JCC 3(PC) - NEGL AX + NEGQ AX RET MOVL $0, AX RET @@ -448,7 +448,7 @@ TEXT runtime·kqueue(SB),7,$0 MOVL $(0x2000000+362), AX SYSCALL JCC 2(PC) - NEGL AX + NEGQ AX RET // int32 runtime·kevent(int kq, Kevent *changelist, int nchanges, Kevent *eventlist, int nevents, Timespec *timeout); @@ -462,7 +462,7 @@ TEXT runtime·kevent(SB),7,$0 MOVL $(0x2000000+363), AX SYSCALL JCC 2(PC) - NEGL AX + NEGQ AX RET // void runtime·closeonexec(int32 fd); diff --git a/src/pkg/runtime/sys_freebsd_amd64.s b/src/pkg/runtime/sys_freebsd_amd64.s index f393b87000..3738f16073 100644 --- a/src/pkg/runtime/sys_freebsd_amd64.s +++ b/src/pkg/runtime/sys_freebsd_amd64.s @@ -261,7 +261,7 @@ TEXT runtime·sysctl(SB),7,$0 MOVQ $202, AX // sys___sysctl SYSCALL JCC 3(PC) - NEGL AX + NEGQ AX RET MOVL $0, AX RET diff --git a/src/pkg/runtime/sys_netbsd_amd64.s b/src/pkg/runtime/sys_netbsd_amd64.s index 329373c858..958b97e601 100644 --- a/src/pkg/runtime/sys_netbsd_amd64.s +++ b/src/pkg/runtime/sys_netbsd_amd64.s @@ -16,7 +16,7 @@ TEXT runtime·lwp_create(SB),7,$0 MOVL $309, AX // sys__lwp_create SYSCALL JCC 2(PC) - NEGL AX + NEGQ AX RET TEXT runtime·lwp_tramp(SB),7,$0 @@ -254,7 +254,7 @@ TEXT runtime·mmap(SB),7,$0 MOVL $197, AX // sys_mmap SYSCALL JCC 2(PC) - NEGL AX + NEGQ AX ADDQ $16, SP RET @@ -306,7 +306,7 @@ TEXT runtime·sysctl(SB),7,$0 MOVQ $202, AX // sys___sysctl SYSCALL JCC 3(PC) - NEGL AX + NEGQ AX RET MOVL $0, AX RET diff --git a/src/pkg/runtime/sys_openbsd_amd64.s b/src/pkg/runtime/sys_openbsd_amd64.s index 5ec52dfccf..585fe47c2b 100644 --- a/src/pkg/runtime/sys_openbsd_amd64.s +++ b/src/pkg/runtime/sys_openbsd_amd64.s @@ -23,7 +23,7 @@ TEXT runtime·tfork(SB),7,$32 // Return if tfork syscall failed. JCC 3(PC) - NEGL AX + NEGQ AX RET // In parent, return. @@ -243,7 +243,7 @@ TEXT runtime·mmap(SB),7,$0 MOVL $197, AX SYSCALL JCC 2(PC) - NEGL AX + NEGQ AX ADDQ $16, SP RET @@ -294,7 +294,7 @@ TEXT runtime·sysctl(SB),7,$0 MOVQ $202, AX // sys___sysctl SYSCALL JCC 3(PC) - NEGL AX + NEGQ AX RET MOVL $0, AX RET