1// This file is generated from a similarly-named Perl script in the BoringSSL
2// source tree. Do not edit by hand.
3
4#if defined(__has_feature)
5#if __has_feature(memory_sanitizer) && !defined(OPENSSL_NO_ASM)
6#define OPENSSL_NO_ASM
7#endif
8#endif
9
10#if !defined(OPENSSL_NO_ASM)
11#if defined(BORINGSSL_PREFIX)
12#include <boringssl_prefix_symbols_asm.h>
13#endif
14.text
15
16// abi_test_trampoline loads callee-saved registers from |state|, calls |func|
17// with |argv|, then saves the callee-saved registers into |state|. It returns
18// the result of |func|. The |unwind| argument is unused.
19// uint64_t abi_test_trampoline(void (*func)(...), CallerState *state,
20//                              const uint64_t *argv, size_t argc,
21//                              uint64_t unwind);
22
23.globl	_abi_test_trampoline
24.private_extern	_abi_test_trampoline
25.align	4
26_abi_test_trampoline:
27Labi_test_trampoline_begin:
28	// Stack layout (low to high addresses)
29	//   x29,x30 (16 bytes)
30	//    d8-d15 (64 bytes)
31	//   x19-x28 (80 bytes)
32	//    x1 (8 bytes)
33	//   padding (8 bytes)
34	stp	x29, x30, [sp, #-176]!
35	mov	x29, sp
36
37	// Saved callee-saved registers and |state|.
38	stp	d8, d9, [sp, #16]
39	stp	d10, d11, [sp, #32]
40	stp	d12, d13, [sp, #48]
41	stp	d14, d15, [sp, #64]
42	stp	x19, x20, [sp, #80]
43	stp	x21, x22, [sp, #96]
44	stp	x23, x24, [sp, #112]
45	stp	x25, x26, [sp, #128]
46	stp	x27, x28, [sp, #144]
47	str	x1, [sp, #160]
48
49	// Load registers from |state|, with the exception of x29. x29 is the
50	// frame pointer and also callee-saved, but AAPCS64 allows platforms to
51	// mandate that x29 always point to a frame. iOS64 does so, which means
52	// we cannot fill x29 with entropy without violating ABI rules
53	// ourselves. x29 is tested separately below.
54	ldp	d8, d9, [x1], #16
55	ldp	d10, d11, [x1], #16
56	ldp	d12, d13, [x1], #16
57	ldp	d14, d15, [x1], #16
58	ldp	x19, x20, [x1], #16
59	ldp	x21, x22, [x1], #16
60	ldp	x23, x24, [x1], #16
61	ldp	x25, x26, [x1], #16
62	ldp	x27, x28, [x1], #16
63
64	// Move parameters into temporary registers.
65	mov	x9, x0
66	mov	x10, x2
67	mov	x11, x3
68
69	// Load parameters into registers.
70	cbz	x11, Largs_done
71	ldr	x0, [x10], #8
72	subs	x11, x11, #1
73	b.eq	Largs_done
74	ldr	x1, [x10], #8
75	subs	x11, x11, #1
76	b.eq	Largs_done
77	ldr	x2, [x10], #8
78	subs	x11, x11, #1
79	b.eq	Largs_done
80	ldr	x3, [x10], #8
81	subs	x11, x11, #1
82	b.eq	Largs_done
83	ldr	x4, [x10], #8
84	subs	x11, x11, #1
85	b.eq	Largs_done
86	ldr	x5, [x10], #8
87	subs	x11, x11, #1
88	b.eq	Largs_done
89	ldr	x6, [x10], #8
90	subs	x11, x11, #1
91	b.eq	Largs_done
92	ldr	x7, [x10], #8
93
94Largs_done:
95	blr	x9
96
97	// Reload |state| and store registers.
98	ldr	x1, [sp, #160]
99	stp	d8, d9, [x1], #16
100	stp	d10, d11, [x1], #16
101	stp	d12, d13, [x1], #16
102	stp	d14, d15, [x1], #16
103	stp	x19, x20, [x1], #16
104	stp	x21, x22, [x1], #16
105	stp	x23, x24, [x1], #16
106	stp	x25, x26, [x1], #16
107	stp	x27, x28, [x1], #16
108
109	// |func| is required to preserve x29, the frame pointer. We cannot load
110	// random values into x29 (see comment above), so compare it against the
111	// expected value and zero the field of |state| if corrupted.
112	mov	x9, sp
113	cmp	x29, x9
114	b.eq	Lx29_ok
115	str	xzr, [x1]
116
117Lx29_ok:
118	// Restore callee-saved registers.
119	ldp	d8, d9, [sp, #16]
120	ldp	d10, d11, [sp, #32]
121	ldp	d12, d13, [sp, #48]
122	ldp	d14, d15, [sp, #64]
123	ldp	x19, x20, [sp, #80]
124	ldp	x21, x22, [sp, #96]
125	ldp	x23, x24, [sp, #112]
126	ldp	x25, x26, [sp, #128]
127	ldp	x27, x28, [sp, #144]
128
129	ldp	x29, x30, [sp], #176
130	ret
131
132
133.globl	_abi_test_clobber_x0
134.private_extern	_abi_test_clobber_x0
135.align	4
136_abi_test_clobber_x0:
137	mov	x0, xzr
138	ret
139
140
141.globl	_abi_test_clobber_x1
142.private_extern	_abi_test_clobber_x1
143.align	4
144_abi_test_clobber_x1:
145	mov	x1, xzr
146	ret
147
148
149.globl	_abi_test_clobber_x2
150.private_extern	_abi_test_clobber_x2
151.align	4
152_abi_test_clobber_x2:
153	mov	x2, xzr
154	ret
155
156
157.globl	_abi_test_clobber_x3
158.private_extern	_abi_test_clobber_x3
159.align	4
160_abi_test_clobber_x3:
161	mov	x3, xzr
162	ret
163
164
165.globl	_abi_test_clobber_x4
166.private_extern	_abi_test_clobber_x4
167.align	4
168_abi_test_clobber_x4:
169	mov	x4, xzr
170	ret
171
172
173.globl	_abi_test_clobber_x5
174.private_extern	_abi_test_clobber_x5
175.align	4
176_abi_test_clobber_x5:
177	mov	x5, xzr
178	ret
179
180
181.globl	_abi_test_clobber_x6
182.private_extern	_abi_test_clobber_x6
183.align	4
184_abi_test_clobber_x6:
185	mov	x6, xzr
186	ret
187
188
189.globl	_abi_test_clobber_x7
190.private_extern	_abi_test_clobber_x7
191.align	4
192_abi_test_clobber_x7:
193	mov	x7, xzr
194	ret
195
196
197.globl	_abi_test_clobber_x8
198.private_extern	_abi_test_clobber_x8
199.align	4
200_abi_test_clobber_x8:
201	mov	x8, xzr
202	ret
203
204
205.globl	_abi_test_clobber_x9
206.private_extern	_abi_test_clobber_x9
207.align	4
208_abi_test_clobber_x9:
209	mov	x9, xzr
210	ret
211
212
213.globl	_abi_test_clobber_x10
214.private_extern	_abi_test_clobber_x10
215.align	4
216_abi_test_clobber_x10:
217	mov	x10, xzr
218	ret
219
220
221.globl	_abi_test_clobber_x11
222.private_extern	_abi_test_clobber_x11
223.align	4
224_abi_test_clobber_x11:
225	mov	x11, xzr
226	ret
227
228
229.globl	_abi_test_clobber_x12
230.private_extern	_abi_test_clobber_x12
231.align	4
232_abi_test_clobber_x12:
233	mov	x12, xzr
234	ret
235
236
237.globl	_abi_test_clobber_x13
238.private_extern	_abi_test_clobber_x13
239.align	4
240_abi_test_clobber_x13:
241	mov	x13, xzr
242	ret
243
244
245.globl	_abi_test_clobber_x14
246.private_extern	_abi_test_clobber_x14
247.align	4
248_abi_test_clobber_x14:
249	mov	x14, xzr
250	ret
251
252
253.globl	_abi_test_clobber_x15
254.private_extern	_abi_test_clobber_x15
255.align	4
256_abi_test_clobber_x15:
257	mov	x15, xzr
258	ret
259
260
261.globl	_abi_test_clobber_x16
262.private_extern	_abi_test_clobber_x16
263.align	4
264_abi_test_clobber_x16:
265	mov	x16, xzr
266	ret
267
268
269.globl	_abi_test_clobber_x17
270.private_extern	_abi_test_clobber_x17
271.align	4
272_abi_test_clobber_x17:
273	mov	x17, xzr
274	ret
275
276
277.globl	_abi_test_clobber_x19
278.private_extern	_abi_test_clobber_x19
279.align	4
280_abi_test_clobber_x19:
281	mov	x19, xzr
282	ret
283
284
285.globl	_abi_test_clobber_x20
286.private_extern	_abi_test_clobber_x20
287.align	4
288_abi_test_clobber_x20:
289	mov	x20, xzr
290	ret
291
292
293.globl	_abi_test_clobber_x21
294.private_extern	_abi_test_clobber_x21
295.align	4
296_abi_test_clobber_x21:
297	mov	x21, xzr
298	ret
299
300
301.globl	_abi_test_clobber_x22
302.private_extern	_abi_test_clobber_x22
303.align	4
304_abi_test_clobber_x22:
305	mov	x22, xzr
306	ret
307
308
309.globl	_abi_test_clobber_x23
310.private_extern	_abi_test_clobber_x23
311.align	4
312_abi_test_clobber_x23:
313	mov	x23, xzr
314	ret
315
316
317.globl	_abi_test_clobber_x24
318.private_extern	_abi_test_clobber_x24
319.align	4
320_abi_test_clobber_x24:
321	mov	x24, xzr
322	ret
323
324
325.globl	_abi_test_clobber_x25
326.private_extern	_abi_test_clobber_x25
327.align	4
328_abi_test_clobber_x25:
329	mov	x25, xzr
330	ret
331
332
333.globl	_abi_test_clobber_x26
334.private_extern	_abi_test_clobber_x26
335.align	4
336_abi_test_clobber_x26:
337	mov	x26, xzr
338	ret
339
340
341.globl	_abi_test_clobber_x27
342.private_extern	_abi_test_clobber_x27
343.align	4
344_abi_test_clobber_x27:
345	mov	x27, xzr
346	ret
347
348
349.globl	_abi_test_clobber_x28
350.private_extern	_abi_test_clobber_x28
351.align	4
352_abi_test_clobber_x28:
353	mov	x28, xzr
354	ret
355
356
357.globl	_abi_test_clobber_x29
358.private_extern	_abi_test_clobber_x29
359.align	4
360_abi_test_clobber_x29:
361	mov	x29, xzr
362	ret
363
364
365.globl	_abi_test_clobber_d0
366.private_extern	_abi_test_clobber_d0
367.align	4
368_abi_test_clobber_d0:
369	fmov	d0, xzr
370	ret
371
372
373.globl	_abi_test_clobber_d1
374.private_extern	_abi_test_clobber_d1
375.align	4
376_abi_test_clobber_d1:
377	fmov	d1, xzr
378	ret
379
380
381.globl	_abi_test_clobber_d2
382.private_extern	_abi_test_clobber_d2
383.align	4
384_abi_test_clobber_d2:
385	fmov	d2, xzr
386	ret
387
388
389.globl	_abi_test_clobber_d3
390.private_extern	_abi_test_clobber_d3
391.align	4
392_abi_test_clobber_d3:
393	fmov	d3, xzr
394	ret
395
396
397.globl	_abi_test_clobber_d4
398.private_extern	_abi_test_clobber_d4
399.align	4
400_abi_test_clobber_d4:
401	fmov	d4, xzr
402	ret
403
404
405.globl	_abi_test_clobber_d5
406.private_extern	_abi_test_clobber_d5
407.align	4
408_abi_test_clobber_d5:
409	fmov	d5, xzr
410	ret
411
412
413.globl	_abi_test_clobber_d6
414.private_extern	_abi_test_clobber_d6
415.align	4
416_abi_test_clobber_d6:
417	fmov	d6, xzr
418	ret
419
420
421.globl	_abi_test_clobber_d7
422.private_extern	_abi_test_clobber_d7
423.align	4
424_abi_test_clobber_d7:
425	fmov	d7, xzr
426	ret
427
428
429.globl	_abi_test_clobber_d8
430.private_extern	_abi_test_clobber_d8
431.align	4
432_abi_test_clobber_d8:
433	fmov	d8, xzr
434	ret
435
436
437.globl	_abi_test_clobber_d9
438.private_extern	_abi_test_clobber_d9
439.align	4
440_abi_test_clobber_d9:
441	fmov	d9, xzr
442	ret
443
444
445.globl	_abi_test_clobber_d10
446.private_extern	_abi_test_clobber_d10
447.align	4
448_abi_test_clobber_d10:
449	fmov	d10, xzr
450	ret
451
452
453.globl	_abi_test_clobber_d11
454.private_extern	_abi_test_clobber_d11
455.align	4
456_abi_test_clobber_d11:
457	fmov	d11, xzr
458	ret
459
460
461.globl	_abi_test_clobber_d12
462.private_extern	_abi_test_clobber_d12
463.align	4
464_abi_test_clobber_d12:
465	fmov	d12, xzr
466	ret
467
468
469.globl	_abi_test_clobber_d13
470.private_extern	_abi_test_clobber_d13
471.align	4
472_abi_test_clobber_d13:
473	fmov	d13, xzr
474	ret
475
476
477.globl	_abi_test_clobber_d14
478.private_extern	_abi_test_clobber_d14
479.align	4
480_abi_test_clobber_d14:
481	fmov	d14, xzr
482	ret
483
484
485.globl	_abi_test_clobber_d15
486.private_extern	_abi_test_clobber_d15
487.align	4
488_abi_test_clobber_d15:
489	fmov	d15, xzr
490	ret
491
492
493.globl	_abi_test_clobber_d16
494.private_extern	_abi_test_clobber_d16
495.align	4
496_abi_test_clobber_d16:
497	fmov	d16, xzr
498	ret
499
500
501.globl	_abi_test_clobber_d17
502.private_extern	_abi_test_clobber_d17
503.align	4
504_abi_test_clobber_d17:
505	fmov	d17, xzr
506	ret
507
508
509.globl	_abi_test_clobber_d18
510.private_extern	_abi_test_clobber_d18
511.align	4
512_abi_test_clobber_d18:
513	fmov	d18, xzr
514	ret
515
516
517.globl	_abi_test_clobber_d19
518.private_extern	_abi_test_clobber_d19
519.align	4
520_abi_test_clobber_d19:
521	fmov	d19, xzr
522	ret
523
524
525.globl	_abi_test_clobber_d20
526.private_extern	_abi_test_clobber_d20
527.align	4
528_abi_test_clobber_d20:
529	fmov	d20, xzr
530	ret
531
532
533.globl	_abi_test_clobber_d21
534.private_extern	_abi_test_clobber_d21
535.align	4
536_abi_test_clobber_d21:
537	fmov	d21, xzr
538	ret
539
540
541.globl	_abi_test_clobber_d22
542.private_extern	_abi_test_clobber_d22
543.align	4
544_abi_test_clobber_d22:
545	fmov	d22, xzr
546	ret
547
548
549.globl	_abi_test_clobber_d23
550.private_extern	_abi_test_clobber_d23
551.align	4
552_abi_test_clobber_d23:
553	fmov	d23, xzr
554	ret
555
556
557.globl	_abi_test_clobber_d24
558.private_extern	_abi_test_clobber_d24
559.align	4
560_abi_test_clobber_d24:
561	fmov	d24, xzr
562	ret
563
564
565.globl	_abi_test_clobber_d25
566.private_extern	_abi_test_clobber_d25
567.align	4
568_abi_test_clobber_d25:
569	fmov	d25, xzr
570	ret
571
572
573.globl	_abi_test_clobber_d26
574.private_extern	_abi_test_clobber_d26
575.align	4
576_abi_test_clobber_d26:
577	fmov	d26, xzr
578	ret
579
580
581.globl	_abi_test_clobber_d27
582.private_extern	_abi_test_clobber_d27
583.align	4
584_abi_test_clobber_d27:
585	fmov	d27, xzr
586	ret
587
588
589.globl	_abi_test_clobber_d28
590.private_extern	_abi_test_clobber_d28
591.align	4
592_abi_test_clobber_d28:
593	fmov	d28, xzr
594	ret
595
596
597.globl	_abi_test_clobber_d29
598.private_extern	_abi_test_clobber_d29
599.align	4
600_abi_test_clobber_d29:
601	fmov	d29, xzr
602	ret
603
604
605.globl	_abi_test_clobber_d30
606.private_extern	_abi_test_clobber_d30
607.align	4
608_abi_test_clobber_d30:
609	fmov	d30, xzr
610	ret
611
612
613.globl	_abi_test_clobber_d31
614.private_extern	_abi_test_clobber_d31
615.align	4
616_abi_test_clobber_d31:
617	fmov	d31, xzr
618	ret
619
620
621.globl	_abi_test_clobber_v8_upper
622.private_extern	_abi_test_clobber_v8_upper
623.align	4
624_abi_test_clobber_v8_upper:
625	fmov	v8.d[1], xzr
626	ret
627
628
629.globl	_abi_test_clobber_v9_upper
630.private_extern	_abi_test_clobber_v9_upper
631.align	4
632_abi_test_clobber_v9_upper:
633	fmov	v9.d[1], xzr
634	ret
635
636
637.globl	_abi_test_clobber_v10_upper
638.private_extern	_abi_test_clobber_v10_upper
639.align	4
640_abi_test_clobber_v10_upper:
641	fmov	v10.d[1], xzr
642	ret
643
644
645.globl	_abi_test_clobber_v11_upper
646.private_extern	_abi_test_clobber_v11_upper
647.align	4
648_abi_test_clobber_v11_upper:
649	fmov	v11.d[1], xzr
650	ret
651
652
653.globl	_abi_test_clobber_v12_upper
654.private_extern	_abi_test_clobber_v12_upper
655.align	4
656_abi_test_clobber_v12_upper:
657	fmov	v12.d[1], xzr
658	ret
659
660
661.globl	_abi_test_clobber_v13_upper
662.private_extern	_abi_test_clobber_v13_upper
663.align	4
664_abi_test_clobber_v13_upper:
665	fmov	v13.d[1], xzr
666	ret
667
668
669.globl	_abi_test_clobber_v14_upper
670.private_extern	_abi_test_clobber_v14_upper
671.align	4
672_abi_test_clobber_v14_upper:
673	fmov	v14.d[1], xzr
674	ret
675
676
677.globl	_abi_test_clobber_v15_upper
678.private_extern	_abi_test_clobber_v15_upper
679.align	4
680_abi_test_clobber_v15_upper:
681	fmov	v15.d[1], xzr
682	ret
683
684#endif  // !OPENSSL_NO_ASM
685