1 // Copyright 2016 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 MOVD _crosscall2_ptr(SB), R1
11 MOVD $crosscall2(SB), R2
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
20 // Start with standard C stack frame layout and linkage.
22 // Save R6-R15 in the register save area of the calling function.
25 // Allocate 96 bytes on the stack.
28 // Save F8-F15 in our stack frame.
38 // Initialize Go ABI environment.
41 MOVD R2, 8(R15) // fn unsafe.Pointer
42 MOVD R3, 16(R15) // a unsafe.Pointer
44 MOVD R5, 24(R15) // ctxt uintptr
45 BL runtime·cgocallback(SB)
56 // De-allocate stack frame.