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.
4
5 #include "textflag.h"
6
7 // Called by C code generated by cmd/cgo.
8 // func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr)
9 // Saves C callee-saved registers and calls cgocallback with three arguments.
10 // fn is the PC of a func(a unsafe.Pointer) function.
11 TEXT crosscall2(SB),NOSPLIT|NOFRAME,$0
12 /*
13 * Push arguments for fn (X10, X11, X13), along with all callee-save
14 * registers. Note that at procedure entry the first argument is at
15 * 8(X2).
16 */
17 ADD $(-8*29), X2
18 MOV X10, (8*1)(X2) // fn unsafe.Pointer
19 MOV X11, (8*2)(X2) // a unsafe.Pointer
20 MOV X13, (8*3)(X2) // ctxt uintptr
21 MOV X8, (8*4)(X2)
22 MOV X9, (8*5)(X2)
23 MOV X18, (8*6)(X2)
24 MOV X19, (8*7)(X2)
25 MOV X20, (8*8)(X2)
26 MOV X21, (8*9)(X2)
27 MOV X22, (8*10)(X2)
28 MOV X23, (8*11)(X2)
29 MOV X24, (8*12)(X2)
30 MOV X25, (8*13)(X2)
31 MOV X26, (8*14)(X2)
32 MOV g, (8*15)(X2)
33 MOV X1, (8*16)(X2)
34 MOVD F8, (8*17)(X2)
35 MOVD F9, (8*18)(X2)
36 MOVD F18, (8*19)(X2)
37 MOVD F19, (8*20)(X2)
38 MOVD F20, (8*21)(X2)
39 MOVD F21, (8*22)(X2)
40 MOVD F22, (8*23)(X2)
41 MOVD F23, (8*24)(X2)
42 MOVD F24, (8*25)(X2)
43 MOVD F25, (8*26)(X2)
44 MOVD F26, (8*27)(X2)
45 MOVD F27, (8*28)(X2)
46
47 // Initialize Go ABI environment
48 CALL runtime·load_g(SB)
49 CALL runtime·cgocallback(SB)
50
51 MOV (8*4)(X2), X8
52 MOV (8*5)(X2), X9
53 MOV (8*6)(X2), X18
54 MOV (8*7)(X2), X19
55 MOV (8*8)(X2), X20
56 MOV (8*9)(X2), X21
57 MOV (8*10)(X2), X22
58 MOV (8*11)(X2), X23
59 MOV (8*12)(X2), X24
60 MOV (8*13)(X2), X25
61 MOV (8*14)(X2), X26
62 MOV (8*15)(X2), g
63 MOV (8*16)(X2), X1
64 MOVD (8*17)(X2), F8
65 MOVD (8*18)(X2), F9
66 MOVD (8*19)(X2), F18
67 MOVD (8*20)(X2), F19
68 MOVD (8*21)(X2), F20
69 MOVD (8*22)(X2), F21
70 MOVD (8*23)(X2), F22
71 MOVD (8*24)(X2), F23
72 MOVD (8*25)(X2), F24
73 MOVD (8*26)(X2), F25
74 MOVD (8*27)(X2), F26
75 MOVD (8*28)(X2), F27
76 ADD $(8*29), X2
77
78 RET
79
View as plain text