From f9bd1d0f113db5a92e59592f0108dad45a9308ad Mon Sep 17 00:00:00 2001 From: "Paul E. Murphy" Date: Tue, 18 Oct 2022 10:22:17 -0500 Subject: [PATCH] runtime/internal/syscall: convert PPC64 Syscall6 to ABIInternal This avoids a lot of stacking. Change-Id: If5c5cf33335ffdcb7eecbd3f2db7858a415d817d Reviewed-on: https://go-review.googlesource.com/c/go/+/443736 TryBot-Result: Gopher Robot Reviewed-by: David Chase Run-TryBot: Paul Murphy Reviewed-by: Bryan Mills Reviewed-by: Lynn Boger --- .../internal/syscall/asm_linux_ppc64x.s | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/runtime/internal/syscall/asm_linux_ppc64x.s b/src/runtime/internal/syscall/asm_linux_ppc64x.s index 8cf8737df8..3e985edea0 100644 --- a/src/runtime/internal/syscall/asm_linux_ppc64x.s +++ b/src/runtime/internal/syscall/asm_linux_ppc64x.s @@ -7,22 +7,17 @@ #include "textflag.h" // func Syscall6(num, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, errno uintptr) -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - MOVD num+0(FP), R9 // syscall entry - MOVD a1+8(FP), R3 - MOVD a2+16(FP), R4 - MOVD a3+24(FP), R5 - MOVD a4+32(FP), R6 - MOVD a5+40(FP), R7 - MOVD a6+48(FP), R8 - SYSCALL R9 - MOVD R0, r2+64(FP) // r2 is not used. Always set to 0. - BVC ok - MOVD $-1, R4 - MOVD R4, r1+56(FP) - MOVD R3, errno+72(FP) - RET -ok: - MOVD R3, r1+56(FP) - MOVD R0, errno+72(FP) +TEXT ·Syscall6(SB),NOSPLIT,$0-80 + MOVD R3, R10 // Move syscall number to R10. SYSCALL will move it R0, and restore R0. + MOVD R4, R3 + MOVD R5, R4 + MOVD R6, R5 + MOVD R7, R6 + MOVD R8, R7 + MOVD R9, R8 + SYSCALL R10 + MOVD $-1, R6 + ISEL CR0SO, R3, R0, R5 // errno = (error) ? R3 : 0 + ISEL CR0SO, R6, R3, R3 // r1 = (error) ? -1 : 0 + MOVD $0, R4 // r2 is not used on linux/ppc64 RET -- 2.50.0