x86cpuid.S revision 299983
1# $FreeBSD: stable/10/secure/lib/libcrypto/i386/x86cpuid.S 299983 2016-05-16 22:42:09Z jkim $
2# Do not modify. This file is auto-generated from x86cpuid.pl.
3#ifdef PIC
4.file	"x86cpuid.S"
5.text
6.globl	OPENSSL_ia32_cpuid
7.type	OPENSSL_ia32_cpuid,@function
8.align	16
9OPENSSL_ia32_cpuid:
10.L_OPENSSL_ia32_cpuid_begin:
11	pushl	%ebp
12	pushl	%ebx
13	pushl	%esi
14	pushl	%edi
15	xorl	%edx,%edx
16	pushfl
17	popl	%eax
18	movl	%eax,%ecx
19	xorl	$2097152,%eax
20	pushl	%eax
21	popfl
22	pushfl
23	popl	%eax
24	xorl	%eax,%ecx
25	xorl	%eax,%eax
26	btl	$21,%ecx
27	jnc	.L000nocpuid
28	.byte	0x0f,0xa2
29	movl	%eax,%edi
30	xorl	%eax,%eax
31	cmpl	$1970169159,%ebx
32	setne	%al
33	movl	%eax,%ebp
34	cmpl	$1231384169,%edx
35	setne	%al
36	orl	%eax,%ebp
37	cmpl	$1818588270,%ecx
38	setne	%al
39	orl	%eax,%ebp
40	jz	.L001intel
41	cmpl	$1752462657,%ebx
42	setne	%al
43	movl	%eax,%esi
44	cmpl	$1769238117,%edx
45	setne	%al
46	orl	%eax,%esi
47	cmpl	$1145913699,%ecx
48	setne	%al
49	orl	%eax,%esi
50	jnz	.L001intel
51	movl	$2147483648,%eax
52	.byte	0x0f,0xa2
53	cmpl	$2147483649,%eax
54	jb	.L001intel
55	movl	%eax,%esi
56	movl	$2147483649,%eax
57	.byte	0x0f,0xa2
58	orl	%ecx,%ebp
59	andl	$2049,%ebp
60	cmpl	$2147483656,%esi
61	jb	.L001intel
62	movl	$2147483656,%eax
63	.byte	0x0f,0xa2
64	movzbl	%cl,%esi
65	incl	%esi
66	movl	$1,%eax
67	xorl	%ecx,%ecx
68	.byte	0x0f,0xa2
69	btl	$28,%edx
70	jnc	.L002generic
71	shrl	$16,%ebx
72	andl	$255,%ebx
73	cmpl	%esi,%ebx
74	ja	.L002generic
75	andl	$4026531839,%edx
76	jmp	.L002generic
77.L001intel:
78	cmpl	$4,%edi
79	movl	$-1,%edi
80	jb	.L003nocacheinfo
81	movl	$4,%eax
82	movl	$0,%ecx
83	.byte	0x0f,0xa2
84	movl	%eax,%edi
85	shrl	$14,%edi
86	andl	$4095,%edi
87.L003nocacheinfo:
88	movl	$1,%eax
89	xorl	%ecx,%ecx
90	.byte	0x0f,0xa2
91	andl	$3220176895,%edx
92	cmpl	$0,%ebp
93	jne	.L004notintel
94	orl	$1073741824,%edx
95	andb	$15,%ah
96	cmpb	$15,%ah
97	jne	.L004notintel
98	orl	$1048576,%edx
99.L004notintel:
100	btl	$28,%edx
101	jnc	.L002generic
102	andl	$4026531839,%edx
103	cmpl	$0,%edi
104	je	.L002generic
105	orl	$268435456,%edx
106	shrl	$16,%ebx
107	cmpb	$1,%bl
108	ja	.L002generic
109	andl	$4026531839,%edx
110.L002generic:
111	andl	$2048,%ebp
112	andl	$4294965247,%ecx
113	movl	%edx,%esi
114	orl	%ecx,%ebp
115	btl	$27,%ecx
116	jnc	.L005clear_avx
117	xorl	%ecx,%ecx
118.byte	15,1,208
119	andl	$6,%eax
120	cmpl	$6,%eax
121	je	.L006done
122	cmpl	$2,%eax
123	je	.L005clear_avx
124.L007clear_xmm:
125	andl	$4261412861,%ebp
126	andl	$4278190079,%esi
127.L005clear_avx:
128	andl	$4026525695,%ebp
129.L006done:
130	movl	%esi,%eax
131	movl	%ebp,%edx
132.L000nocpuid:
133	popl	%edi
134	popl	%esi
135	popl	%ebx
136	popl	%ebp
137	ret
138.size	OPENSSL_ia32_cpuid,.-.L_OPENSSL_ia32_cpuid_begin
139.globl	OPENSSL_rdtsc
140.type	OPENSSL_rdtsc,@function
141.align	16
142OPENSSL_rdtsc:
143.L_OPENSSL_rdtsc_begin:
144	xorl	%eax,%eax
145	xorl	%edx,%edx
146	call	.L008PIC_me_up
147.L008PIC_me_up:
148	popl	%ecx
149	leal	_GLOBAL_OFFSET_TABLE_+[.-.L008PIC_me_up](%ecx),%ecx
150	movl	OPENSSL_ia32cap_P@GOT(%ecx),%ecx
151	btl	$4,(%ecx)
152	jnc	.L009notsc
153	.byte	0x0f,0x31
154.L009notsc:
155	ret
156.size	OPENSSL_rdtsc,.-.L_OPENSSL_rdtsc_begin
157.globl	OPENSSL_instrument_halt
158.type	OPENSSL_instrument_halt,@function
159.align	16
160OPENSSL_instrument_halt:
161.L_OPENSSL_instrument_halt_begin:
162	call	.L010PIC_me_up
163.L010PIC_me_up:
164	popl	%ecx
165	leal	_GLOBAL_OFFSET_TABLE_+[.-.L010PIC_me_up](%ecx),%ecx
166	movl	OPENSSL_ia32cap_P@GOT(%ecx),%ecx
167	btl	$4,(%ecx)
168	jnc	.L011nohalt
169.long	2421723150
170	andl	$3,%eax
171	jnz	.L011nohalt
172	pushfl
173	popl	%eax
174	btl	$9,%eax
175	jnc	.L011nohalt
176	.byte	0x0f,0x31
177	pushl	%edx
178	pushl	%eax
179	hlt
180	.byte	0x0f,0x31
181	subl	(%esp),%eax
182	sbbl	4(%esp),%edx
183	addl	$8,%esp
184	ret
185.L011nohalt:
186	xorl	%eax,%eax
187	xorl	%edx,%edx
188	ret
189.size	OPENSSL_instrument_halt,.-.L_OPENSSL_instrument_halt_begin
190.globl	OPENSSL_far_spin
191.type	OPENSSL_far_spin,@function
192.align	16
193OPENSSL_far_spin:
194.L_OPENSSL_far_spin_begin:
195	pushfl
196	popl	%eax
197	btl	$9,%eax
198	jnc	.L012nospin
199	movl	4(%esp),%eax
200	movl	8(%esp),%ecx
201.long	2430111262
202	xorl	%eax,%eax
203	movl	(%ecx),%edx
204	jmp	.L013spin
205.align	16
206.L013spin:
207	incl	%eax
208	cmpl	(%ecx),%edx
209	je	.L013spin
210.long	529567888
211	ret
212.L012nospin:
213	xorl	%eax,%eax
214	xorl	%edx,%edx
215	ret
216.size	OPENSSL_far_spin,.-.L_OPENSSL_far_spin_begin
217.globl	OPENSSL_wipe_cpu
218.type	OPENSSL_wipe_cpu,@function
219.align	16
220OPENSSL_wipe_cpu:
221.L_OPENSSL_wipe_cpu_begin:
222	xorl	%eax,%eax
223	xorl	%edx,%edx
224	call	.L014PIC_me_up
225.L014PIC_me_up:
226	popl	%ecx
227	leal	_GLOBAL_OFFSET_TABLE_+[.-.L014PIC_me_up](%ecx),%ecx
228	movl	OPENSSL_ia32cap_P@GOT(%ecx),%ecx
229	movl	(%ecx),%ecx
230	btl	$1,(%ecx)
231	jnc	.L015no_x87
232	andl	$83886080,%ecx
233	cmpl	$83886080,%ecx
234	jne	.L016no_sse2
235	pxor	%xmm0,%xmm0
236	pxor	%xmm1,%xmm1
237	pxor	%xmm2,%xmm2
238	pxor	%xmm3,%xmm3
239	pxor	%xmm4,%xmm4
240	pxor	%xmm5,%xmm5
241	pxor	%xmm6,%xmm6
242	pxor	%xmm7,%xmm7
243.L016no_sse2:
244.long	4007259865,4007259865,4007259865,4007259865,2430851995
245.L015no_x87:
246	leal	4(%esp),%eax
247	ret
248.size	OPENSSL_wipe_cpu,.-.L_OPENSSL_wipe_cpu_begin
249.globl	OPENSSL_atomic_add
250.type	OPENSSL_atomic_add,@function
251.align	16
252OPENSSL_atomic_add:
253.L_OPENSSL_atomic_add_begin:
254	movl	4(%esp),%edx
255	movl	8(%esp),%ecx
256	pushl	%ebx
257	nop
258	movl	(%edx),%eax
259.L017spin:
260	leal	(%eax,%ecx,1),%ebx
261	nop
262.long	447811568
263	jne	.L017spin
264	movl	%ebx,%eax
265	popl	%ebx
266	ret
267.size	OPENSSL_atomic_add,.-.L_OPENSSL_atomic_add_begin
268.globl	OPENSSL_indirect_call
269.type	OPENSSL_indirect_call,@function
270.align	16
271OPENSSL_indirect_call:
272.L_OPENSSL_indirect_call_begin:
273	pushl	%ebp
274	movl	%esp,%ebp
275	subl	$28,%esp
276	movl	12(%ebp),%ecx
277	movl	%ecx,(%esp)
278	movl	16(%ebp),%edx
279	movl	%edx,4(%esp)
280	movl	20(%ebp),%eax
281	movl	%eax,8(%esp)
282	movl	24(%ebp),%eax
283	movl	%eax,12(%esp)
284	movl	28(%ebp),%eax
285	movl	%eax,16(%esp)
286	movl	32(%ebp),%eax
287	movl	%eax,20(%esp)
288	movl	36(%ebp),%eax
289	movl	%eax,24(%esp)
290	call	*8(%ebp)
291	movl	%ebp,%esp
292	popl	%ebp
293	ret
294.size	OPENSSL_indirect_call,.-.L_OPENSSL_indirect_call_begin
295.globl	OPENSSL_cleanse
296.type	OPENSSL_cleanse,@function
297.align	16
298OPENSSL_cleanse:
299.L_OPENSSL_cleanse_begin:
300	movl	4(%esp),%edx
301	movl	8(%esp),%ecx
302	xorl	%eax,%eax
303	cmpl	$7,%ecx
304	jae	.L018lot
305	cmpl	$0,%ecx
306	je	.L019ret
307.L020little:
308	movb	%al,(%edx)
309	subl	$1,%ecx
310	leal	1(%edx),%edx
311	jnz	.L020little
312.L019ret:
313	ret
314.align	16
315.L018lot:
316	testl	$3,%edx
317	jz	.L021aligned
318	movb	%al,(%edx)
319	leal	-1(%ecx),%ecx
320	leal	1(%edx),%edx
321	jmp	.L018lot
322.L021aligned:
323	movl	%eax,(%edx)
324	leal	-4(%ecx),%ecx
325	testl	$-4,%ecx
326	leal	4(%edx),%edx
327	jnz	.L021aligned
328	cmpl	$0,%ecx
329	jne	.L020little
330	ret
331.size	OPENSSL_cleanse,.-.L_OPENSSL_cleanse_begin
332.globl	OPENSSL_ia32_rdrand
333.type	OPENSSL_ia32_rdrand,@function
334.align	16
335OPENSSL_ia32_rdrand:
336.L_OPENSSL_ia32_rdrand_begin:
337	movl	$8,%ecx
338.L022loop:
339.byte	15,199,240
340	jc	.L023break
341	loop	.L022loop
342.L023break:
343	cmpl	$0,%eax
344	cmovel	%ecx,%eax
345	ret
346.size	OPENSSL_ia32_rdrand,.-.L_OPENSSL_ia32_rdrand_begin
347.hidden	OPENSSL_cpuid_setup
348.hidden	OPENSSL_ia32cap_P
349.comm	OPENSSL_ia32cap_P,8,4
350.section	.init
351	call	OPENSSL_cpuid_setup
352#else
353.file	"x86cpuid.S"
354.text
355.globl	OPENSSL_ia32_cpuid
356.type	OPENSSL_ia32_cpuid,@function
357.align	16
358OPENSSL_ia32_cpuid:
359.L_OPENSSL_ia32_cpuid_begin:
360	pushl	%ebp
361	pushl	%ebx
362	pushl	%esi
363	pushl	%edi
364	xorl	%edx,%edx
365	pushfl
366	popl	%eax
367	movl	%eax,%ecx
368	xorl	$2097152,%eax
369	pushl	%eax
370	popfl
371	pushfl
372	popl	%eax
373	xorl	%eax,%ecx
374	xorl	%eax,%eax
375	btl	$21,%ecx
376	jnc	.L000nocpuid
377	.byte	0x0f,0xa2
378	movl	%eax,%edi
379	xorl	%eax,%eax
380	cmpl	$1970169159,%ebx
381	setne	%al
382	movl	%eax,%ebp
383	cmpl	$1231384169,%edx
384	setne	%al
385	orl	%eax,%ebp
386	cmpl	$1818588270,%ecx
387	setne	%al
388	orl	%eax,%ebp
389	jz	.L001intel
390	cmpl	$1752462657,%ebx
391	setne	%al
392	movl	%eax,%esi
393	cmpl	$1769238117,%edx
394	setne	%al
395	orl	%eax,%esi
396	cmpl	$1145913699,%ecx
397	setne	%al
398	orl	%eax,%esi
399	jnz	.L001intel
400	movl	$2147483648,%eax
401	.byte	0x0f,0xa2
402	cmpl	$2147483649,%eax
403	jb	.L001intel
404	movl	%eax,%esi
405	movl	$2147483649,%eax
406	.byte	0x0f,0xa2
407	orl	%ecx,%ebp
408	andl	$2049,%ebp
409	cmpl	$2147483656,%esi
410	jb	.L001intel
411	movl	$2147483656,%eax
412	.byte	0x0f,0xa2
413	movzbl	%cl,%esi
414	incl	%esi
415	movl	$1,%eax
416	xorl	%ecx,%ecx
417	.byte	0x0f,0xa2
418	btl	$28,%edx
419	jnc	.L002generic
420	shrl	$16,%ebx
421	andl	$255,%ebx
422	cmpl	%esi,%ebx
423	ja	.L002generic
424	andl	$4026531839,%edx
425	jmp	.L002generic
426.L001intel:
427	cmpl	$4,%edi
428	movl	$-1,%edi
429	jb	.L003nocacheinfo
430	movl	$4,%eax
431	movl	$0,%ecx
432	.byte	0x0f,0xa2
433	movl	%eax,%edi
434	shrl	$14,%edi
435	andl	$4095,%edi
436.L003nocacheinfo:
437	movl	$1,%eax
438	xorl	%ecx,%ecx
439	.byte	0x0f,0xa2
440	andl	$3220176895,%edx
441	cmpl	$0,%ebp
442	jne	.L004notintel
443	orl	$1073741824,%edx
444	andb	$15,%ah
445	cmpb	$15,%ah
446	jne	.L004notintel
447	orl	$1048576,%edx
448.L004notintel:
449	btl	$28,%edx
450	jnc	.L002generic
451	andl	$4026531839,%edx
452	cmpl	$0,%edi
453	je	.L002generic
454	orl	$268435456,%edx
455	shrl	$16,%ebx
456	cmpb	$1,%bl
457	ja	.L002generic
458	andl	$4026531839,%edx
459.L002generic:
460	andl	$2048,%ebp
461	andl	$4294965247,%ecx
462	movl	%edx,%esi
463	orl	%ecx,%ebp
464	btl	$27,%ecx
465	jnc	.L005clear_avx
466	xorl	%ecx,%ecx
467.byte	15,1,208
468	andl	$6,%eax
469	cmpl	$6,%eax
470	je	.L006done
471	cmpl	$2,%eax
472	je	.L005clear_avx
473.L007clear_xmm:
474	andl	$4261412861,%ebp
475	andl	$4278190079,%esi
476.L005clear_avx:
477	andl	$4026525695,%ebp
478.L006done:
479	movl	%esi,%eax
480	movl	%ebp,%edx
481.L000nocpuid:
482	popl	%edi
483	popl	%esi
484	popl	%ebx
485	popl	%ebp
486	ret
487.size	OPENSSL_ia32_cpuid,.-.L_OPENSSL_ia32_cpuid_begin
488.globl	OPENSSL_rdtsc
489.type	OPENSSL_rdtsc,@function
490.align	16
491OPENSSL_rdtsc:
492.L_OPENSSL_rdtsc_begin:
493	xorl	%eax,%eax
494	xorl	%edx,%edx
495	leal	OPENSSL_ia32cap_P,%ecx
496	btl	$4,(%ecx)
497	jnc	.L008notsc
498	.byte	0x0f,0x31
499.L008notsc:
500	ret
501.size	OPENSSL_rdtsc,.-.L_OPENSSL_rdtsc_begin
502.globl	OPENSSL_instrument_halt
503.type	OPENSSL_instrument_halt,@function
504.align	16
505OPENSSL_instrument_halt:
506.L_OPENSSL_instrument_halt_begin:
507	leal	OPENSSL_ia32cap_P,%ecx
508	btl	$4,(%ecx)
509	jnc	.L009nohalt
510.long	2421723150
511	andl	$3,%eax
512	jnz	.L009nohalt
513	pushfl
514	popl	%eax
515	btl	$9,%eax
516	jnc	.L009nohalt
517	.byte	0x0f,0x31
518	pushl	%edx
519	pushl	%eax
520	hlt
521	.byte	0x0f,0x31
522	subl	(%esp),%eax
523	sbbl	4(%esp),%edx
524	addl	$8,%esp
525	ret
526.L009nohalt:
527	xorl	%eax,%eax
528	xorl	%edx,%edx
529	ret
530.size	OPENSSL_instrument_halt,.-.L_OPENSSL_instrument_halt_begin
531.globl	OPENSSL_far_spin
532.type	OPENSSL_far_spin,@function
533.align	16
534OPENSSL_far_spin:
535.L_OPENSSL_far_spin_begin:
536	pushfl
537	popl	%eax
538	btl	$9,%eax
539	jnc	.L010nospin
540	movl	4(%esp),%eax
541	movl	8(%esp),%ecx
542.long	2430111262
543	xorl	%eax,%eax
544	movl	(%ecx),%edx
545	jmp	.L011spin
546.align	16
547.L011spin:
548	incl	%eax
549	cmpl	(%ecx),%edx
550	je	.L011spin
551.long	529567888
552	ret
553.L010nospin:
554	xorl	%eax,%eax
555	xorl	%edx,%edx
556	ret
557.size	OPENSSL_far_spin,.-.L_OPENSSL_far_spin_begin
558.globl	OPENSSL_wipe_cpu
559.type	OPENSSL_wipe_cpu,@function
560.align	16
561OPENSSL_wipe_cpu:
562.L_OPENSSL_wipe_cpu_begin:
563	xorl	%eax,%eax
564	xorl	%edx,%edx
565	leal	OPENSSL_ia32cap_P,%ecx
566	movl	(%ecx),%ecx
567	btl	$1,(%ecx)
568	jnc	.L012no_x87
569	andl	$83886080,%ecx
570	cmpl	$83886080,%ecx
571	jne	.L013no_sse2
572	pxor	%xmm0,%xmm0
573	pxor	%xmm1,%xmm1
574	pxor	%xmm2,%xmm2
575	pxor	%xmm3,%xmm3
576	pxor	%xmm4,%xmm4
577	pxor	%xmm5,%xmm5
578	pxor	%xmm6,%xmm6
579	pxor	%xmm7,%xmm7
580.L013no_sse2:
581.long	4007259865,4007259865,4007259865,4007259865,2430851995
582.L012no_x87:
583	leal	4(%esp),%eax
584	ret
585.size	OPENSSL_wipe_cpu,.-.L_OPENSSL_wipe_cpu_begin
586.globl	OPENSSL_atomic_add
587.type	OPENSSL_atomic_add,@function
588.align	16
589OPENSSL_atomic_add:
590.L_OPENSSL_atomic_add_begin:
591	movl	4(%esp),%edx
592	movl	8(%esp),%ecx
593	pushl	%ebx
594	nop
595	movl	(%edx),%eax
596.L014spin:
597	leal	(%eax,%ecx,1),%ebx
598	nop
599.long	447811568
600	jne	.L014spin
601	movl	%ebx,%eax
602	popl	%ebx
603	ret
604.size	OPENSSL_atomic_add,.-.L_OPENSSL_atomic_add_begin
605.globl	OPENSSL_indirect_call
606.type	OPENSSL_indirect_call,@function
607.align	16
608OPENSSL_indirect_call:
609.L_OPENSSL_indirect_call_begin:
610	pushl	%ebp
611	movl	%esp,%ebp
612	subl	$28,%esp
613	movl	12(%ebp),%ecx
614	movl	%ecx,(%esp)
615	movl	16(%ebp),%edx
616	movl	%edx,4(%esp)
617	movl	20(%ebp),%eax
618	movl	%eax,8(%esp)
619	movl	24(%ebp),%eax
620	movl	%eax,12(%esp)
621	movl	28(%ebp),%eax
622	movl	%eax,16(%esp)
623	movl	32(%ebp),%eax
624	movl	%eax,20(%esp)
625	movl	36(%ebp),%eax
626	movl	%eax,24(%esp)
627	call	*8(%ebp)
628	movl	%ebp,%esp
629	popl	%ebp
630	ret
631.size	OPENSSL_indirect_call,.-.L_OPENSSL_indirect_call_begin
632.globl	OPENSSL_cleanse
633.type	OPENSSL_cleanse,@function
634.align	16
635OPENSSL_cleanse:
636.L_OPENSSL_cleanse_begin:
637	movl	4(%esp),%edx
638	movl	8(%esp),%ecx
639	xorl	%eax,%eax
640	cmpl	$7,%ecx
641	jae	.L015lot
642	cmpl	$0,%ecx
643	je	.L016ret
644.L017little:
645	movb	%al,(%edx)
646	subl	$1,%ecx
647	leal	1(%edx),%edx
648	jnz	.L017little
649.L016ret:
650	ret
651.align	16
652.L015lot:
653	testl	$3,%edx
654	jz	.L018aligned
655	movb	%al,(%edx)
656	leal	-1(%ecx),%ecx
657	leal	1(%edx),%edx
658	jmp	.L015lot
659.L018aligned:
660	movl	%eax,(%edx)
661	leal	-4(%ecx),%ecx
662	testl	$-4,%ecx
663	leal	4(%edx),%edx
664	jnz	.L018aligned
665	cmpl	$0,%ecx
666	jne	.L017little
667	ret
668.size	OPENSSL_cleanse,.-.L_OPENSSL_cleanse_begin
669.globl	OPENSSL_ia32_rdrand
670.type	OPENSSL_ia32_rdrand,@function
671.align	16
672OPENSSL_ia32_rdrand:
673.L_OPENSSL_ia32_rdrand_begin:
674	movl	$8,%ecx
675.L019loop:
676.byte	15,199,240
677	jc	.L020break
678	loop	.L019loop
679.L020break:
680	cmpl	$0,%eax
681	cmovel	%ecx,%eax
682	ret
683.size	OPENSSL_ia32_rdrand,.-.L_OPENSSL_ia32_rdrand_begin
684.hidden	OPENSSL_cpuid_setup
685.hidden	OPENSSL_ia32cap_P
686.comm	OPENSSL_ia32cap_P,8,4
687.section	.init
688	call	OPENSSL_cpuid_setup
689#endif
690