1
0
mirror of https://github.com/golang/go synced 2024-11-11 20:20:23 -07:00

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
This commit is contained in:
Russ Cox 2013-03-14 23:42:11 -04:00
parent b7f29e259d
commit e3c7a9db83
4 changed files with 12 additions and 12 deletions

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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