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