Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions internal/fakecgo/trampolines_ppc64le.s
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,22 @@ TEXT ·call5(SB), NOSPLIT|NOFRAME, $0-56
MOVD 64(R1), R6 // a4 → fourth C arg
MOVD 72(R1), R7 // a5 → fifth C arg

MOVDU R1, -32(R1)
// Go frames are only 8-byte aligned, but ELFv2 requires R1 to be 16-byte
// aligned at a call. Keep the original R1 in R22, a non-volatile register.
// The back chain is stored before R1 moves so that 0(R1) is always valid.
MOVD R1, R22
RLDCR $0, R1, $~15, R10
MOVD R22, -32(R10)
SUB $32, R10, R1
Comment thread
hajimehoshi marked this conversation as resolved.
Resolved

MOVD R12, CTR
CALL CTR

// Store return value
// After MOVDU -32, original 80(R1) is now at 80+32=112(R1)
MOVD R3, (80+32)(R1)

// Deallocate frame
ADD $32, R1
MOVD R22, R1

// Store return value
MOVD R3, 80(R1)

// Clear R0 before returning to Go code.
// Go uses R0 as a constant 0 register for things like "std r0,X(r1)"
Expand Down
Loading