1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
8 // Set the x_crosscall2_ptr C function pointer variable point to crosscall2.
9 // It's such a pointer chain: _crosscall2_ptr -> x_crosscall2_ptr -> crosscall2
10 TEXT ·set_crosscall2(SB),NOSPLIT,$0-0
11 MOVQ _crosscall2_ptr(SB), AX
12 MOVQ $crosscall2(SB), BX
16 // Called by C code generated by cmd/cgo.
17 // func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr)
18 // Saves C callee-saved registers and calls cgocallback with three arguments.
19 // fn is the PC of a func(a unsafe.Pointer) function.
20 // This signature is known to SWIG, so we can't change it.
21 TEXT crosscall2(SB),NOSPLIT|NOFRAME,$0-0
22 PUSH_REGS_HOST_TO_ABI0()
24 // Make room for arguments to cgocallback.
27 MOVQ DI, 0x0(SP) /* fn */
28 MOVQ SI, 0x8(SP) /* arg */
30 MOVQ CX, 0x10(SP) /* ctxt */
32 MOVQ CX, 0x0(SP) /* fn */
33 MOVQ DX, 0x8(SP) /* arg */
35 MOVQ R9, 0x10(SP) /* ctxt */
38 CALL runtime·cgocallback(SB)
41 POP_REGS_HOST_TO_ABI0()