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