diff --git a/src/runtime/cgo/asm_ppc64x.s b/src/runtime/cgo/asm_ppc64x.s index dded1be399..1cf27ddc96 100644 --- a/src/runtime/cgo/asm_ppc64x.s +++ b/src/runtime/cgo/asm_ppc64x.s @@ -16,6 +16,8 @@ TEXT crosscall2(SB),NOSPLIT|NOFRAME,$0 // Start with standard C stack frame layout and linkage MOVD LR, R0 MOVD R0, 16(R1) // Save LR in caller's frame + MOVW CR, R0 // Save CR in caller's frame + MOVD R0, 8(R1) MOVD R2, 24(R1) // Save TOC in caller's frame BL saveregs2<>(SB) @@ -38,6 +40,8 @@ TEXT crosscall2(SB),NOSPLIT|NOFRAME,$0 BL restoreregs2<>(SB) MOVD 24(R1), R2 + MOVD 8(R1), R0 + MOVFL R0, $0xff MOVD 16(R1), R0 MOVD R0, LR RET diff --git a/src/runtime/rt0_linux_ppc64le.s b/src/runtime/rt0_linux_ppc64le.s index bcbc9c7b31..81b991349a 100644 --- a/src/runtime/rt0_linux_ppc64le.s +++ b/src/runtime/rt0_linux_ppc64le.s @@ -8,6 +8,8 @@ TEXT _rt0_ppc64le_linux_lib(SB),NOSPLIT,$-8 // Start with standard C stack frame layout and linkage. MOVD LR, R0 MOVD R0, 16(R1) // Save LR in caller's frame. + MOVW CR, R0 // Save CR in caller's frame + MOVD R0, 8(R1) MOVD R2, 24(R1) // Save TOC in caller's frame. MOVDU R1, -320(R1) // Allocate frame. @@ -120,6 +122,8 @@ done: ADD $320, R1 MOVD 24(R1), R2 + MOVD 8(R1), R0 + MOVFL R0, $0xff MOVD 16(R1), R0 MOVD R0, LR RET