]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.23] runtime: fix 9-arg syscall on darwin/amd64
authorKeith Randall <khr@golang.org>
Mon, 14 Apr 2025 16:52:31 +0000 (09:52 -0700)
committerCarlos Amedee <carlos@golang.org>
Mon, 28 Apr 2025 17:29:49 +0000 (10:29 -0700)
The last 3 arguments need to be passed on the stack, not registers.

Fixes #73380

Change-Id: Ib1155ad1a805957fad3d9594c93981a558755591
Reviewed-on: https://go-review.googlesource.com/c/go/+/665435
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
(cherry picked from commit 9d7de0483861b3f882f79797939566fe8f6f9e24)
Reviewed-on: https://go-review.googlesource.com/c/go/+/666015

src/runtime/sys_darwin_amd64.s

index 01992d59d434eb3f039d869a9d194aa794af77a1..408d52a17343b6f6d908613bed59191b2b70a1f0 100644 (file)
@@ -739,7 +739,7 @@ ok:
 //
 // syscall9 expects a 32-bit result and tests for 32-bit -1
 // to decide there was an error.
-TEXT runtime·syscall9(SB),NOSPLIT,$16
+TEXT runtime·syscall9(SB),NOSPLIT,$32
        MOVQ    (0*8)(DI), R13// fn
        MOVQ    (2*8)(DI), SI // a2
        MOVQ    (3*8)(DI), DX // a3
@@ -747,15 +747,18 @@ TEXT runtime·syscall9(SB),NOSPLIT,$16
        MOVQ    (5*8)(DI), R8 // a5
        MOVQ    (6*8)(DI), R9 // a6
        MOVQ    (7*8)(DI), R10 // a7
+       MOVQ    R10, 0(SP)
        MOVQ    (8*8)(DI), R11 // a8
+       MOVQ    R11, 8(SP)
        MOVQ    (9*8)(DI), R12 // a9
-       MOVQ    DI, (SP)
+       MOVQ    R12, 16(SP)
+       MOVQ    DI, 24(SP)
        MOVQ    (1*8)(DI), DI // a1
        XORL    AX, AX        // vararg: say "no float args"
 
        CALL    R13
 
-       MOVQ    (SP), DI
+       MOVQ    24(SP), DI
        MOVQ    AX, (10*8)(DI) // r1
        MOVQ    DX, (11*8)(DI) // r2
 
@@ -764,7 +767,7 @@ TEXT runtime·syscall9(SB),NOSPLIT,$16
 
        CALL    libc_error(SB)
        MOVLQSX (AX), AX
-       MOVQ    (SP), DI
+       MOVQ    24(SP), DI
        MOVQ    AX, (12*8)(DI) // err
 
 ok: