1
0
mirror of https://github.com/golang/go synced 2024-11-13 18:30:26 -07:00

syscall: Plan9, amd64: fix syscall error handling in assembly

Syscalls return `-1' on error and the representation is always
32-bits. The `$-1' literal in 64-bit assembly is always the
64-bit representation. So this change makes sure that we
always do a 32-bit comparison when checking for error.
Also makes sure that in the error case, we return a 64-bit
`-1' from runtime.seek.

Fixes the arithmetic for handling the error-string in
runtime.Syscall6.

R=golang-dev, rminnich, rsc, ality, minux.ma
CC=golang-dev
https://golang.org/cl/7399052
This commit is contained in:
Akshat Kumar 2013-02-25 22:40:14 +01:00 committed by Ron Minnich
parent 4eb7ba743d
commit b6e322dcf5

View File

@ -28,7 +28,7 @@ TEXT ·Syscall(SB),7,$0
SYSCALL
MOVQ AX, r1+40(SP)
MOVQ $0, r2+48(SP)
CMPQ AX, $-1
CMPL AX, $-1
JNE ok3
SUBQ $16, SP
@ -67,7 +67,7 @@ TEXT ·Syscall6(SB),7,$0
SYSCALL
MOVQ AX, r1+64(SP)
MOVQ $0, r2+72(SP)
CMPQ AX, $-1
CMPL AX, $-1
JNE ok4
SUBQ $16, SP
@ -83,8 +83,8 @@ copyresult4:
LEAQ err+80(SP), DI
CLD
MOVSL
MOVSL
MOVSQ
MOVSQ
CALL runtime·exitsyscall(SB)
RET
@ -135,9 +135,9 @@ TEXT ·seek(SB),7,$0
MOVQ $SYS_SEEK, BP // syscall entry
SYSCALL
CMPQ AX, $-1
CMPL AX, $-1
JNE ok6
MOVQ AX, 40(SP) // newoffset
MOVQ $-1, newoffset+40(SP)
SUBQ $16, SP
CALL syscall·errstr(SB)