1 // Copyright 2020 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.
7 // Set the x_crosscall2_ptr C function pointer variable point to crosscall2.
8 // It's such a pointer chain: _crosscall2_ptr -> x_crosscall2_ptr -> crosscall2
9 TEXT ·set_crosscall2(SB),NOSPLIT,$0-0
10 MOV _crosscall2_ptr(SB), X7
11 MOV $crosscall2(SB), X8
15 // Called by C code generated by cmd/cgo.
16 // func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr)
17 // Saves C callee-saved registers and calls cgocallback with three arguments.
18 // fn is the PC of a func(a unsafe.Pointer) function.
19 TEXT crosscall2(SB),NOSPLIT|NOFRAME,$0
21 * Push arguments for fn (X10, X11, X13), along with all callee-save
22 * registers. Note that at procedure entry the first argument is at
26 MOV X10, (8*1)(X2) // fn unsafe.Pointer
27 MOV X11, (8*2)(X2) // a unsafe.Pointer
28 MOV X13, (8*3)(X2) // ctxt uintptr
55 // Initialize Go ABI environment
56 CALL runtime·load_g(SB)
57 CALL runtime·cgocallback(SB)