1
0
mirror of https://github.com/golang/go synced 2024-11-24 12:20:17 -07:00

runtime: use proper C ABI for race call on PPC64LE

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>
This commit is contained in:
Cherry Mui 2022-04-01 19:15:32 -04:00
parent 35fb79be6a
commit c8110c3df6

View 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)