1
0
mirror of https://github.com/golang/go synced 2024-11-17 13:04:54 -07:00

runtime: add arg storage to ppc64le/linux runtime.sigprofNonGoWrapper frame

CL 475935 fixed the the ELFv2 ABI violations, but in the process created a
Go ABI violation by failing to allocate stack space for arguments.

Allocate this space while keeping the frame 16 byte aligned.

Updates #58953

Change-Id: I9942d9a433118b391ef8cd7bcea5808695cf94d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/476296
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Archana Ravindar <aravind5@in.ibm.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
Paul E. Murphy 2023-03-14 16:30:38 -05:00 committed by Paul Murphy
parent 71f82df19a
commit a8cd10f2ab

View File

@ -747,22 +747,23 @@ TEXT runtime·sigprofNonGoWrapper<>(SB),NOSPLIT|NOFRAME,$0
MOVW CR, R0
MOVD R0, 8(R1)
// Don't save a back chain pointer when calling into Go. It will be overwritten.
// Go stores LR where ELF stores a back chain pointer.
ADD $-(32+SAVE_ALL_REG_SIZE), R1
// Go stores LR where ELF stores a back chain pointer. And, allocate 64B for
// FIXED_FRAME and 24B argument space, rounded up to a 16 byte boundary.
ADD $-(64+SAVE_ALL_REG_SIZE), R1
SAVE_GPR(32)
SAVE_FPR(32+SAVE_GPR_SIZE)
SAVE_VR(32+SAVE_GPR_SIZE+SAVE_FPR_SIZE, R6)
SAVE_GPR(64)
SAVE_FPR(64+SAVE_GPR_SIZE)
SAVE_VR(64+SAVE_GPR_SIZE+SAVE_FPR_SIZE, R6)
MOVD $0, R0
CALL runtime·sigprofNonGo<ABIInternal>(SB)
RESTORE_GPR(32)
RESTORE_FPR(32+SAVE_GPR_SIZE)
RESTORE_VR(32+SAVE_GPR_SIZE+SAVE_FPR_SIZE, R6)
RESTORE_GPR(64)
RESTORE_FPR(64+SAVE_GPR_SIZE)
RESTORE_VR(64+SAVE_GPR_SIZE+SAVE_FPR_SIZE, R6)
// Clear frame, restore LR, return
ADD $(32+SAVE_ALL_REG_SIZE), R1
ADD $(64+SAVE_ALL_REG_SIZE), R1
MOVD 16(R1), R0
MOVD R0, LR
MOVD 8(R1), R0