xref: /freebsd/contrib/llvm-project/compiler-rt/lib/xray/xray_trampoline_powerpc64_asm.S (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric	.text
2*0b57cec5SDimitry Andric	.abiversion 2
3*0b57cec5SDimitry Andric	.globl	__xray_FunctionEntry
4*0b57cec5SDimitry Andric	.p2align	4
5*0b57cec5SDimitry Andric__xray_FunctionEntry:
6*0b57cec5SDimitry Andric	std 0, 16(1)
7*0b57cec5SDimitry Andric	stdu 1, -408(1)
8*0b57cec5SDimitry Andric# Spill r3-r10, f1-f13, and vsr34-vsr45, which are parameter registers.
9*0b57cec5SDimitry Andric# If this appears to be slow, the caller needs to pass in number of generic,
10*0b57cec5SDimitry Andric# floating point, and vector parameters, so that we only spill those live ones.
11*0b57cec5SDimitry Andric	std 3, 32(1)
12*0b57cec5SDimitry Andric	ld 3, 400(1) # FuncId
13*0b57cec5SDimitry Andric	std 4, 40(1)
14*0b57cec5SDimitry Andric	std 5, 48(1)
15*0b57cec5SDimitry Andric	std 6, 56(1)
16*0b57cec5SDimitry Andric	std 7, 64(1)
17*0b57cec5SDimitry Andric	std 8, 72(1)
18*0b57cec5SDimitry Andric	std 9, 80(1)
19*0b57cec5SDimitry Andric	std 10, 88(1)
20*0b57cec5SDimitry Andric	addi 4, 1, 96
21*0b57cec5SDimitry Andric	stxsdx 1, 0, 4
22*0b57cec5SDimitry Andric	addi 4, 1, 104
23*0b57cec5SDimitry Andric	stxsdx 2, 0, 4
24*0b57cec5SDimitry Andric	addi 4, 1, 112
25*0b57cec5SDimitry Andric	stxsdx 3, 0, 4
26*0b57cec5SDimitry Andric	addi 4, 1, 120
27*0b57cec5SDimitry Andric	stxsdx 4, 0, 4
28*0b57cec5SDimitry Andric	addi 4, 1, 128
29*0b57cec5SDimitry Andric	stxsdx 5, 0, 4
30*0b57cec5SDimitry Andric	addi 4, 1, 136
31*0b57cec5SDimitry Andric	stxsdx 6, 0, 4
32*0b57cec5SDimitry Andric	addi 4, 1, 144
33*0b57cec5SDimitry Andric	stxsdx 7, 0, 4
34*0b57cec5SDimitry Andric	addi 4, 1, 152
35*0b57cec5SDimitry Andric	stxsdx 8, 0, 4
36*0b57cec5SDimitry Andric	addi 4, 1, 160
37*0b57cec5SDimitry Andric	stxsdx 9, 0, 4
38*0b57cec5SDimitry Andric	addi 4, 1, 168
39*0b57cec5SDimitry Andric	stxsdx 10, 0, 4
40*0b57cec5SDimitry Andric	addi 4, 1, 176
41*0b57cec5SDimitry Andric	stxsdx 11, 0, 4
42*0b57cec5SDimitry Andric	addi 4, 1, 184
43*0b57cec5SDimitry Andric	stxsdx 12, 0, 4
44*0b57cec5SDimitry Andric	addi 4, 1, 192
45*0b57cec5SDimitry Andric	stxsdx 13, 0, 4
46*0b57cec5SDimitry Andric	addi 4, 1, 200
47*0b57cec5SDimitry Andric	stxvd2x 34, 0, 4
48*0b57cec5SDimitry Andric	addi 4, 1, 216
49*0b57cec5SDimitry Andric	stxvd2x 35, 0, 4
50*0b57cec5SDimitry Andric	addi 4, 1, 232
51*0b57cec5SDimitry Andric	stxvd2x 36, 0, 4
52*0b57cec5SDimitry Andric	addi 4, 1, 248
53*0b57cec5SDimitry Andric	stxvd2x 37, 0, 4
54*0b57cec5SDimitry Andric	addi 4, 1, 264
55*0b57cec5SDimitry Andric	stxvd2x 38, 0, 4
56*0b57cec5SDimitry Andric	addi 4, 1, 280
57*0b57cec5SDimitry Andric	stxvd2x 39, 0, 4
58*0b57cec5SDimitry Andric	addi 4, 1, 296
59*0b57cec5SDimitry Andric	stxvd2x 40, 0, 4
60*0b57cec5SDimitry Andric	addi 4, 1, 312
61*0b57cec5SDimitry Andric	stxvd2x 41, 0, 4
62*0b57cec5SDimitry Andric	addi 4, 1, 328
63*0b57cec5SDimitry Andric	stxvd2x 42, 0, 4
64*0b57cec5SDimitry Andric	addi 4, 1, 344
65*0b57cec5SDimitry Andric	stxvd2x 43, 0, 4
66*0b57cec5SDimitry Andric	addi 4, 1, 360
67*0b57cec5SDimitry Andric	stxvd2x 44, 0, 4
68*0b57cec5SDimitry Andric	addi 4, 1, 376
69*0b57cec5SDimitry Andric	stxvd2x 45, 0, 4
70*0b57cec5SDimitry Andric	std 2, 392(1)
71*0b57cec5SDimitry Andric	mflr 0
72*0b57cec5SDimitry Andric	std 0, 400(1)
73*0b57cec5SDimitry Andric
74*0b57cec5SDimitry Andric	li 4, 0
75*0b57cec5SDimitry Andric	bl _ZN6__xray23CallXRayPatchedFunctionEi13XRayEntryType
76*0b57cec5SDimitry Andric	nop
77*0b57cec5SDimitry Andric
78*0b57cec5SDimitry Andric	addi 4, 1, 96
79*0b57cec5SDimitry Andric	lxsdx 1, 0, 4
80*0b57cec5SDimitry Andric	addi 4, 1, 104
81*0b57cec5SDimitry Andric	lxsdx 2, 0, 4
82*0b57cec5SDimitry Andric	addi 4, 1, 112
83*0b57cec5SDimitry Andric	lxsdx 3, 0, 4
84*0b57cec5SDimitry Andric	addi 4, 1, 120
85*0b57cec5SDimitry Andric	lxsdx 4, 0, 4
86*0b57cec5SDimitry Andric	addi 4, 1, 128
87*0b57cec5SDimitry Andric	lxsdx 5, 0, 4
88*0b57cec5SDimitry Andric	addi 4, 1, 136
89*0b57cec5SDimitry Andric	lxsdx 6, 0, 4
90*0b57cec5SDimitry Andric	addi 4, 1, 144
91*0b57cec5SDimitry Andric	lxsdx 7, 0, 4
92*0b57cec5SDimitry Andric	addi 4, 1, 152
93*0b57cec5SDimitry Andric	lxsdx 8, 0, 4
94*0b57cec5SDimitry Andric	addi 4, 1, 160
95*0b57cec5SDimitry Andric	lxsdx 9, 0, 4
96*0b57cec5SDimitry Andric	addi 4, 1, 168
97*0b57cec5SDimitry Andric	lxsdx 10, 0, 4
98*0b57cec5SDimitry Andric	addi 4, 1, 176
99*0b57cec5SDimitry Andric	lxsdx 11, 0, 4
100*0b57cec5SDimitry Andric	addi 4, 1, 184
101*0b57cec5SDimitry Andric	lxsdx 12, 0, 4
102*0b57cec5SDimitry Andric	addi 4, 1, 192
103*0b57cec5SDimitry Andric	lxsdx 13, 0, 4
104*0b57cec5SDimitry Andric	addi 4, 1, 200
105*0b57cec5SDimitry Andric	lxvd2x 34, 0, 4
106*0b57cec5SDimitry Andric	addi 4, 1, 216
107*0b57cec5SDimitry Andric	lxvd2x 35, 0, 4
108*0b57cec5SDimitry Andric	addi 4, 1, 232
109*0b57cec5SDimitry Andric	lxvd2x 36, 0, 4
110*0b57cec5SDimitry Andric	addi 4, 1, 248
111*0b57cec5SDimitry Andric	lxvd2x 37, 0, 4
112*0b57cec5SDimitry Andric	addi 4, 1, 264
113*0b57cec5SDimitry Andric	lxvd2x 38, 0, 4
114*0b57cec5SDimitry Andric	addi 4, 1, 280
115*0b57cec5SDimitry Andric	lxvd2x 39, 0, 4
116*0b57cec5SDimitry Andric	addi 4, 1, 296
117*0b57cec5SDimitry Andric	lxvd2x 40, 0, 4
118*0b57cec5SDimitry Andric	addi 4, 1, 312
119*0b57cec5SDimitry Andric	lxvd2x 41, 0, 4
120*0b57cec5SDimitry Andric	addi 4, 1, 328
121*0b57cec5SDimitry Andric	lxvd2x 42, 0, 4
122*0b57cec5SDimitry Andric	addi 4, 1, 344
123*0b57cec5SDimitry Andric	lxvd2x 43, 0, 4
124*0b57cec5SDimitry Andric	addi 4, 1, 360
125*0b57cec5SDimitry Andric	lxvd2x 44, 0, 4
126*0b57cec5SDimitry Andric	addi 4, 1, 376
127*0b57cec5SDimitry Andric	lxvd2x 45, 0, 4
128*0b57cec5SDimitry Andric	ld 0, 400(1)
129*0b57cec5SDimitry Andric	mtlr 0
130*0b57cec5SDimitry Andric	ld 2, 392(1)
131*0b57cec5SDimitry Andric	ld 3, 32(1)
132*0b57cec5SDimitry Andric	ld 4, 40(1)
133*0b57cec5SDimitry Andric	ld 5, 48(1)
134*0b57cec5SDimitry Andric	ld 6, 56(1)
135*0b57cec5SDimitry Andric	ld 7, 64(1)
136*0b57cec5SDimitry Andric	ld 8, 72(1)
137*0b57cec5SDimitry Andric	ld 9, 80(1)
138*0b57cec5SDimitry Andric	ld 10, 88(1)
139*0b57cec5SDimitry Andric
140*0b57cec5SDimitry Andric	addi 1, 1, 408
141*0b57cec5SDimitry Andric	ld 0, 16(1)
142*0b57cec5SDimitry Andric	blr
143*0b57cec5SDimitry Andric
144*0b57cec5SDimitry Andric	.globl	__xray_FunctionExit
145*0b57cec5SDimitry Andric	.p2align	4
146*0b57cec5SDimitry Andric__xray_FunctionExit:
147*0b57cec5SDimitry Andric	std 0, 16(1)
148*0b57cec5SDimitry Andric	stdu 1, -256(1)
149*0b57cec5SDimitry Andric# Spill r3-r4, f1-f8, and vsr34-vsr41, which are return registers.
150*0b57cec5SDimitry Andric# If this appears to be slow, the caller needs to pass in number of generic,
151*0b57cec5SDimitry Andric# floating point, and vector parameters, so that we only spill those live ones.
152*0b57cec5SDimitry Andric	std 3, 32(1)
153*0b57cec5SDimitry Andric	ld 3, 248(1) # FuncId
154*0b57cec5SDimitry Andric	std 4, 40(1)
155*0b57cec5SDimitry Andric	addi 4, 1, 48
156*0b57cec5SDimitry Andric	stxsdx 1, 0, 4
157*0b57cec5SDimitry Andric	addi 4, 1, 56
158*0b57cec5SDimitry Andric	stxsdx 2, 0, 4
159*0b57cec5SDimitry Andric	addi 4, 1, 64
160*0b57cec5SDimitry Andric	stxsdx 3, 0, 4
161*0b57cec5SDimitry Andric	addi 4, 1, 72
162*0b57cec5SDimitry Andric	stxsdx 4, 0, 4
163*0b57cec5SDimitry Andric	addi 4, 1, 80
164*0b57cec5SDimitry Andric	stxsdx 5, 0, 4
165*0b57cec5SDimitry Andric	addi 4, 1, 88
166*0b57cec5SDimitry Andric	stxsdx 6, 0, 4
167*0b57cec5SDimitry Andric	addi 4, 1, 96
168*0b57cec5SDimitry Andric	stxsdx 7, 0, 4
169*0b57cec5SDimitry Andric	addi 4, 1, 104
170*0b57cec5SDimitry Andric	stxsdx 8, 0, 4
171*0b57cec5SDimitry Andric	addi 4, 1, 112
172*0b57cec5SDimitry Andric	stxvd2x 34, 0, 4
173*0b57cec5SDimitry Andric	addi 4, 1, 128
174*0b57cec5SDimitry Andric	stxvd2x 35, 0, 4
175*0b57cec5SDimitry Andric	addi 4, 1, 144
176*0b57cec5SDimitry Andric	stxvd2x 36, 0, 4
177*0b57cec5SDimitry Andric	addi 4, 1, 160
178*0b57cec5SDimitry Andric	stxvd2x 37, 0, 4
179*0b57cec5SDimitry Andric	addi 4, 1, 176
180*0b57cec5SDimitry Andric	stxvd2x 38, 0, 4
181*0b57cec5SDimitry Andric	addi 4, 1, 192
182*0b57cec5SDimitry Andric	stxvd2x 39, 0, 4
183*0b57cec5SDimitry Andric	addi 4, 1, 208
184*0b57cec5SDimitry Andric	stxvd2x 40, 0, 4
185*0b57cec5SDimitry Andric	addi 4, 1, 224
186*0b57cec5SDimitry Andric	stxvd2x 41, 0, 4
187*0b57cec5SDimitry Andric	std 2, 240(1)
188*0b57cec5SDimitry Andric	mflr 0
189*0b57cec5SDimitry Andric	std 0, 248(1)
190*0b57cec5SDimitry Andric
191*0b57cec5SDimitry Andric	li 4, 1
192*0b57cec5SDimitry Andric	bl _ZN6__xray23CallXRayPatchedFunctionEi13XRayEntryType
193*0b57cec5SDimitry Andric	nop
194*0b57cec5SDimitry Andric
195*0b57cec5SDimitry Andric	addi 4, 1, 48
196*0b57cec5SDimitry Andric	lxsdx 1, 0, 4
197*0b57cec5SDimitry Andric	addi 4, 1, 56
198*0b57cec5SDimitry Andric	lxsdx 2, 0, 4
199*0b57cec5SDimitry Andric	addi 4, 1, 64
200*0b57cec5SDimitry Andric	lxsdx 3, 0, 4
201*0b57cec5SDimitry Andric	addi 4, 1, 72
202*0b57cec5SDimitry Andric	lxsdx 4, 0, 4
203*0b57cec5SDimitry Andric	addi 4, 1, 80
204*0b57cec5SDimitry Andric	lxsdx 5, 0, 4
205*0b57cec5SDimitry Andric	addi 4, 1, 88
206*0b57cec5SDimitry Andric	lxsdx 6, 0, 4
207*0b57cec5SDimitry Andric	addi 4, 1, 96
208*0b57cec5SDimitry Andric	lxsdx 7, 0, 4
209*0b57cec5SDimitry Andric	addi 4, 1, 104
210*0b57cec5SDimitry Andric	lxsdx 8, 0, 4
211*0b57cec5SDimitry Andric	addi 4, 1, 112
212*0b57cec5SDimitry Andric	lxvd2x 34, 0, 4
213*0b57cec5SDimitry Andric	addi 4, 1, 128
214*0b57cec5SDimitry Andric	lxvd2x 35, 0, 4
215*0b57cec5SDimitry Andric	addi 4, 1, 144
216*0b57cec5SDimitry Andric	lxvd2x 36, 0, 4
217*0b57cec5SDimitry Andric	addi 4, 1, 160
218*0b57cec5SDimitry Andric	lxvd2x 37, 0, 4
219*0b57cec5SDimitry Andric	addi 4, 1, 176
220*0b57cec5SDimitry Andric	lxvd2x 38, 0, 4
221*0b57cec5SDimitry Andric	addi 4, 1, 192
222*0b57cec5SDimitry Andric	lxvd2x 39, 0, 4
223*0b57cec5SDimitry Andric	addi 4, 1, 208
224*0b57cec5SDimitry Andric	lxvd2x 40, 0, 4
225*0b57cec5SDimitry Andric	addi 4, 1, 224
226*0b57cec5SDimitry Andric	lxvd2x 41, 0, 4
227*0b57cec5SDimitry Andric	ld 0, 248(1)
228*0b57cec5SDimitry Andric	mtlr 0
229*0b57cec5SDimitry Andric	ld 2, 240(1)
230*0b57cec5SDimitry Andric	ld 3, 32(1)
231*0b57cec5SDimitry Andric	ld 4, 40(1)
232*0b57cec5SDimitry Andric
233*0b57cec5SDimitry Andric	addi 1, 1, 256
234*0b57cec5SDimitry Andric	ld 0, 16(1)
235*0b57cec5SDimitry Andric	blr
236