]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: load errno as signed 32-bit
authorKeith Randall <khr@golang.org>
Wed, 15 Aug 2018 23:21:00 +0000 (16:21 -0700)
committerKeith Randall <khr@golang.org>
Thu, 16 Aug 2018 15:51:23 +0000 (15:51 +0000)
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: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/sys_darwin_amd64.s
src/runtime/sys_darwin_arm64.s

index 2a2e7379ca90b3977a9da69c3648f11d4f4b16d0..db743526130d337bb0b286e829e52a0cd5a68e4e 100644 (file)
@@ -306,7 +306,7 @@ TEXT runtime·mmap_trampoline(SB),NOSPLIT,$0
        CMPQ    AX, $-1
        JNE     ok
        CALL    libc_error(SB)
-       MOVQ    (AX), DX                // errno
+       MOVLQSX (AX), DX                // errno
        XORL    AX, AX
 ok:
        MOVQ    AX, 32(BX)
@@ -371,7 +371,7 @@ TEXT runtime·kevent_trampoline(SB),NOSPLIT,$0
        CMPQ    AX, $-1
        JNE     ok
        CALL    libc_error(SB)
-       MOVQ    (AX), AX                // errno
+       MOVLQSX (AX), AX                // errno
        NEGQ    AX                      // caller wants it as a negative error code
 ok:
        POPQ    BP
index 4f9d0b8d58c5c7e8f7215328d4ce07e8aa12d9ab..d7ba116b8430ba60d0fbf9441638177d8f2768c0 100644 (file)
@@ -70,7 +70,7 @@ TEXT runtime·mmap_trampoline(SB),NOSPLIT,$0
        CMP     R0, R2
        BNE     ok
        BL libc_error(SB)
-       MOVD    (R0), R1
+       MOVW    (R0), R1
        MOVD    $0, R0
 ok:
        MOVD    R0, 32(R19) // ret 1 p
@@ -277,7 +277,7 @@ TEXT runtime·kevent_trampoline(SB),NOSPLIT,$0
        CMP     R0, R2
        BNE     ok
        BL libc_error(SB)
-       MOVD    (R0), R0        // errno
+       MOVW    (R0), R0        // errno
        NEG     R0, R0  // caller wants it as a negative error code
 ok:
        RET