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