From: Cherry Mui Date: Fri, 1 Apr 2022 23:15:32 +0000 (-0400) Subject: runtime: use proper C ABI for race call on PPC64LE X-Git-Tag: go1.19beta1~783 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c8110c3df64a4eea12334a627cca2b78d6ff3082;p=gostls13.git 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 Reviewed-by: Ian Lance Taylor Run-TryBot: Cherry Mui TryBot-Result: Gopher Robot --- diff --git a/src/runtime/race_ppc64le.s b/src/runtime/race_ppc64le.s index 0d8aaa01c1..a1bf3665ad 100644 --- a/src/runtime/race_ppc64le.s +++ b/src/runtime/race_ppc64le.s @@ -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)