]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use proper C ABI for race call on PPC64LE
authorCherry Mui <cherryyz@google.com>
Fri, 1 Apr 2022 23:15:32 +0000 (19:15 -0400)
committerCherry Mui <cherryyz@google.com>
Mon, 4 Apr 2022 15:53:45 +0000 (15:53 +0000)
On PPC64LE, the C ABI requires SP to be 16-byte aligned. Also, in
the C ABI the callee may save LR, CR, R2 etc. to the 4 reserved
words of the caller's frame. This CL aligns the SP and reserves
the space on stack.

Change-Id: I738880028815b7d3402647e4ebbdae37f45acc77
Reviewed-on: https://go-review.googlesource.com/c/go/+/397675
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/runtime/race_ppc64le.s

index 0d8aaa01c1fad04fb3b6513c7fef3fb619db2fd9..a1bf3665ad4e74b847a8fe5779e016a5f17ab11b 100644 (file)
@@ -442,6 +442,9 @@ TEXT        racecall<>(SB), NOSPLIT, $0-0
        BEQ     call                    // already on g0
        MOVD    (g_sched+gobuf_sp)(R10), R1 // switch R1
 call:
+       // prepare frame for C ABI
+       SUB     $32, R1                 // create frame for callee saving LR, CR, R2 etc.
+       RLDCR   $0, R1, $~15, R1        // align SP to 16 bytes
        MOVD    R8, CTR                 // R8 = caller addr
        MOVD    R8, R12                 // expected by PPC64 ABI
        BL      (CTR)