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