diff --git a/src/runtime/cgo/asm_386.s b/src/runtime/cgo/asm_386.s index dc8897d353..7293c20bf8 100644 --- a/src/runtime/cgo/asm_386.s +++ b/src/runtime/cgo/asm_386.s @@ -7,26 +7,23 @@ // Called by C code generated by cmd/cgo. // func crosscall2(fn func(a unsafe.Pointer, n int32, ctxt uintptr), a unsafe.Pointer, n int32, ctxt uintptr) // Saves C callee-saved registers and calls fn with three arguments. -TEXT crosscall2(SB),NOSPLIT,$0 - PUSHL BP - MOVL SP, BP - PUSHL BX - PUSHL SI - PUSHL DI - - SUBL $12, SP - MOVL 20(BP), AX +TEXT crosscall2(SB),NOSPLIT,$28-16 + MOVL BP, 24(SP) + MOVL BX, 20(SP) + MOVL SI, 16(SP) + MOVL DI, 12(SP) + + MOVL ctxt+12(FP), AX MOVL AX, 8(SP) - MOVL 16(BP), AX + MOVL n+8(FP), AX MOVL AX, 4(SP) - MOVL 12(BP), AX + MOVL a+4(FP), AX MOVL AX, 0(SP) - MOVL 8(BP), AX + MOVL fn+0(FP), AX CALL AX - ADDL $12, SP - - POPL DI - POPL SI - POPL BX - POPL BP + + MOVL 12(SP), DI + MOVL 16(SP), SI + MOVL 20(SP), BX + MOVL 24(SP), BP RET diff --git a/src/runtime/cgo/asm_amd64.s b/src/runtime/cgo/asm_amd64.s index 541bd9ea01..0e33fc4796 100644 --- a/src/runtime/cgo/asm_amd64.s +++ b/src/runtime/cgo/asm_amd64.s @@ -7,14 +7,12 @@ // Called by C code generated by cmd/cgo. // func crosscall2(fn func(a unsafe.Pointer, n int32, ctxt uintptr), a unsafe.Pointer, n int32, ctxt uintptr) // Saves C callee-saved registers and calls fn with three arguments. -TEXT crosscall2(SB),NOSPLIT,$0 #ifndef GOOS_windows - SUBQ $0x58, SP /* keeps stack pointer 32-byte aligned */ +TEXT crosscall2(SB),NOSPLIT,$0x50-0 /* keeps stack pointer 32-byte aligned */ #else - SUBQ $0x118, SP /* also need to save xmm6 - xmm15 */ +TEXT crosscall2(SB),NOSPLIT,$0x110-0 /* also need to save xmm6 - xmm15 */ #endif MOVQ BX, 0x18(SP) - MOVQ BP, 0x20(SP) MOVQ R12, 0x28(SP) MOVQ R13, 0x30(SP) MOVQ R14, 0x38(SP) @@ -62,15 +60,9 @@ TEXT crosscall2(SB),NOSPLIT,$0 #endif MOVQ 0x18(SP), BX - MOVQ 0x20(SP), BP MOVQ 0x28(SP), R12 MOVQ 0x30(SP), R13 MOVQ 0x38(SP), R14 MOVQ 0x40(SP), R15 -#ifndef GOOS_windows - ADDQ $0x58, SP -#else - ADDQ $0x118, SP -#endif RET