Commit a68b713e authored by Keith Randall's avatar Keith Randall

runtime: load errno as signed 32-bit

the function libc_errno returns a pointer to a signed-32 bit quantity,
not a 64-bit quantity.

Fixes #27004

Change-Id: I0623835ee34fd9655532251f096022a5accb58cd
Reviewed-on: https://go-review.googlesource.com/129475
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 6502c112
...@@ -306,7 +306,7 @@ TEXT runtime·mmap_trampoline(SB),NOSPLIT,$0 ...@@ -306,7 +306,7 @@ TEXT runtime·mmap_trampoline(SB),NOSPLIT,$0
CMPQ AX, $-1 CMPQ AX, $-1
JNE ok JNE ok
CALL libc_error(SB) CALL libc_error(SB)
MOVQ (AX), DX // errno MOVLQSX (AX), DX // errno
XORL AX, AX XORL AX, AX
ok: ok:
MOVQ AX, 32(BX) MOVQ AX, 32(BX)
...@@ -371,7 +371,7 @@ TEXT runtime·kevent_trampoline(SB),NOSPLIT,$0 ...@@ -371,7 +371,7 @@ TEXT runtime·kevent_trampoline(SB),NOSPLIT,$0
CMPQ AX, $-1 CMPQ AX, $-1
JNE ok JNE ok
CALL libc_error(SB) CALL libc_error(SB)
MOVQ (AX), AX // errno MOVLQSX (AX), AX // errno
NEGQ AX // caller wants it as a negative error code NEGQ AX // caller wants it as a negative error code
ok: ok:
POPQ BP POPQ BP
......
...@@ -70,7 +70,7 @@ TEXT runtime·mmap_trampoline(SB),NOSPLIT,$0 ...@@ -70,7 +70,7 @@ TEXT runtime·mmap_trampoline(SB),NOSPLIT,$0
CMP R0, R2 CMP R0, R2
BNE ok BNE ok
BL libc_error(SB) BL libc_error(SB)
MOVD (R0), R1 MOVW (R0), R1
MOVD $0, R0 MOVD $0, R0
ok: ok:
MOVD R0, 32(R19) // ret 1 p MOVD R0, 32(R19) // ret 1 p
...@@ -277,7 +277,7 @@ TEXT runtime·kevent_trampoline(SB),NOSPLIT,$0 ...@@ -277,7 +277,7 @@ TEXT runtime·kevent_trampoline(SB),NOSPLIT,$0
CMP R0, R2 CMP R0, R2
BNE ok BNE ok
BL libc_error(SB) BL libc_error(SB)
MOVD (R0), R0 // errno MOVW (R0), R0 // errno
NEG R0, R0 // caller wants it as a negative error code NEG R0, R0 // caller wants it as a negative error code
ok: ok:
RET RET
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment