x86cpuid.S revision 299966
1# $FreeBSD: stable/10/secure/lib/libcrypto/i386/x86cpuid.S 299966 2016-05-16 19:30:27Z 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.comm	OPENSSL_ia32cap_P,8,4
348.section	.init
349	call	OPENSSL_cpuid_setup
350#else
351.file	"x86cpuid.S"
352.text
353.globl	OPENSSL_ia32_cpuid
354.type	OPENSSL_ia32_cpuid,@function
355.align	16
356OPENSSL_ia32_cpuid:
357.L_OPENSSL_ia32_cpuid_begin:
358	pushl	%ebp
359	pushl	%ebx
360	pushl	%esi
361	pushl	%edi
362	xorl	%edx,%edx
363	pushfl
364	popl	%eax
365	movl	%eax,%ecx
366	xorl	$2097152,%eax
367	pushl	%eax
368	popfl
369	pushfl
370	popl	%eax
371	xorl	%eax,%ecx
372	xorl	%eax,%eax
373	btl	$21,%ecx
374	jnc	.L000nocpuid
375	.byte	0x0f,0xa2
376	movl	%eax,%edi
377	xorl	%eax,%eax
378	cmpl	$1970169159,%ebx
379	setne	%al
380	movl	%eax,%ebp
381	cmpl	$1231384169,%edx
382	setne	%al
383	orl	%eax,%ebp
384	cmpl	$1818588270,%ecx
385	setne	%al
386	orl	%eax,%ebp
387	jz	.L001intel
388	cmpl	$1752462657,%ebx
389	setne	%al
390	movl	%eax,%esi
391	cmpl	$1769238117,%edx
392	setne	%al
393	orl	%eax,%esi
394	cmpl	$1145913699,%ecx
395	setne	%al
396	orl	%eax,%esi
397	jnz	.L001intel
398	movl	$2147483648,%eax
399	.byte	0x0f,0xa2
400	cmpl	$2147483649,%eax
401	jb	.L001intel
402	movl	%eax,%esi
403	movl	$2147483649,%eax
404	.byte	0x0f,0xa2
405	orl	%ecx,%ebp
406	andl	$2049,%ebp
407	cmpl	$2147483656,%esi
408	jb	.L001intel
409	movl	$2147483656,%eax
410	.byte	0x0f,0xa2
411	movzbl	%cl,%esi
412	incl	%esi
413	movl	$1,%eax
414	xorl	%ecx,%ecx
415	.byte	0x0f,0xa2
416	btl	$28,%edx
417	jnc	.L002generic
418	shrl	$16,%ebx
419	andl	$255,%ebx
420	cmpl	%esi,%ebx
421	ja	.L002generic
422	andl	$4026531839,%edx
423	jmp	.L002generic
424.L001intel:
425	cmpl	$4,%edi
426	movl	$-1,%edi
427	jb	.L003nocacheinfo
428	movl	$4,%eax
429	movl	$0,%ecx
430	.byte	0x0f,0xa2
431	movl	%eax,%edi
432	shrl	$14,%edi
433	andl	$4095,%edi
434.L003nocacheinfo:
435	movl	$1,%eax
436	xorl	%ecx,%ecx
437	.byte	0x0f,0xa2
438	andl	$3220176895,%edx
439	cmpl	$0,%ebp
440	jne	.L004notintel
441	orl	$1073741824,%edx
442	andb	$15,%ah
443	cmpb	$15,%ah
444	jne	.L004notintel
445	orl	$1048576,%edx
446.L004notintel:
447	btl	$28,%edx
448	jnc	.L002generic
449	andl	$4026531839,%edx
450	cmpl	$0,%edi
451	je	.L002generic
452	orl	$268435456,%edx
453	shrl	$16,%ebx
454	cmpb	$1,%bl
455	ja	.L002generic
456	andl	$4026531839,%edx
457.L002generic:
458	andl	$2048,%ebp
459	andl	$4294965247,%ecx
460	movl	%edx,%esi
461	orl	%ecx,%ebp
462	btl	$27,%ecx
463	jnc	.L005clear_avx
464	xorl	%ecx,%ecx
465.byte	15,1,208
466	andl	$6,%eax
467	cmpl	$6,%eax
468	je	.L006done
469	cmpl	$2,%eax
470	je	.L005clear_avx
471.L007clear_xmm:
472	andl	$4261412861,%ebp
473	andl	$4278190079,%esi
474.L005clear_avx:
475	andl	$4026525695,%ebp
476.L006done:
477	movl	%esi,%eax
478	movl	%ebp,%edx
479.L000nocpuid:
480	popl	%edi
481	popl	%esi
482	popl	%ebx
483	popl	%ebp
484	ret
485.size	OPENSSL_ia32_cpuid,.-.L_OPENSSL_ia32_cpuid_begin
486.globl	OPENSSL_rdtsc
487.type	OPENSSL_rdtsc,@function
488.align	16
489OPENSSL_rdtsc:
490.L_OPENSSL_rdtsc_begin:
491	xorl	%eax,%eax
492	xorl	%edx,%edx
493	leal	OPENSSL_ia32cap_P,%ecx
494	btl	$4,(%ecx)
495	jnc	.L008notsc
496	.byte	0x0f,0x31
497.L008notsc:
498	ret
499.size	OPENSSL_rdtsc,.-.L_OPENSSL_rdtsc_begin
500.globl	OPENSSL_instrument_halt
501.type	OPENSSL_instrument_halt,@function
502.align	16
503OPENSSL_instrument_halt:
504.L_OPENSSL_instrument_halt_begin:
505	leal	OPENSSL_ia32cap_P,%ecx
506	btl	$4,(%ecx)
507	jnc	.L009nohalt
508.long	2421723150
509	andl	$3,%eax
510	jnz	.L009nohalt
511	pushfl
512	popl	%eax
513	btl	$9,%eax
514	jnc	.L009nohalt
515	.byte	0x0f,0x31
516	pushl	%edx
517	pushl	%eax
518	hlt
519	.byte	0x0f,0x31
520	subl	(%esp),%eax
521	sbbl	4(%esp),%edx
522	addl	$8,%esp
523	ret
524.L009nohalt:
525	xorl	%eax,%eax
526	xorl	%edx,%edx
527	ret
528.size	OPENSSL_instrument_halt,.-.L_OPENSSL_instrument_halt_begin
529.globl	OPENSSL_far_spin
530.type	OPENSSL_far_spin,@function
531.align	16
532OPENSSL_far_spin:
533.L_OPENSSL_far_spin_begin:
534	pushfl
535	popl	%eax
536	btl	$9,%eax
537	jnc	.L010nospin
538	movl	4(%esp),%eax
539	movl	8(%esp),%ecx
540.long	2430111262
541	xorl	%eax,%eax
542	movl	(%ecx),%edx
543	jmp	.L011spin
544.align	16
545.L011spin:
546	incl	%eax
547	cmpl	(%ecx),%edx
548	je	.L011spin
549.long	529567888
550	ret
551.L010nospin:
552	xorl	%eax,%eax
553	xorl	%edx,%edx
554	ret
555.size	OPENSSL_far_spin,.-.L_OPENSSL_far_spin_begin
556.globl	OPENSSL_wipe_cpu
557.type	OPENSSL_wipe_cpu,@function
558.align	16
559OPENSSL_wipe_cpu:
560.L_OPENSSL_wipe_cpu_begin:
561	xorl	%eax,%eax
562	xorl	%edx,%edx
563	leal	OPENSSL_ia32cap_P,%ecx
564	movl	(%ecx),%ecx
565	btl	$1,(%ecx)
566	jnc	.L012no_x87
567	andl	$83886080,%ecx
568	cmpl	$83886080,%ecx
569	jne	.L013no_sse2
570	pxor	%xmm0,%xmm0
571	pxor	%xmm1,%xmm1
572	pxor	%xmm2,%xmm2
573	pxor	%xmm3,%xmm3
574	pxor	%xmm4,%xmm4
575	pxor	%xmm5,%xmm5
576	pxor	%xmm6,%xmm6
577	pxor	%xmm7,%xmm7
578.L013no_sse2:
579.long	4007259865,4007259865,4007259865,4007259865,2430851995
580.L012no_x87:
581	leal	4(%esp),%eax
582	ret
583.size	OPENSSL_wipe_cpu,.-.L_OPENSSL_wipe_cpu_begin
584.globl	OPENSSL_atomic_add
585.type	OPENSSL_atomic_add,@function
586.align	16
587OPENSSL_atomic_add:
588.L_OPENSSL_atomic_add_begin:
589	movl	4(%esp),%edx
590	movl	8(%esp),%ecx
591	pushl	%ebx
592	nop
593	movl	(%edx),%eax
594.L014spin:
595	leal	(%eax,%ecx,1),%ebx
596	nop
597.long	447811568
598	jne	.L014spin
599	movl	%ebx,%eax
600	popl	%ebx
601	ret
602.size	OPENSSL_atomic_add,.-.L_OPENSSL_atomic_add_begin
603.globl	OPENSSL_indirect_call
604.type	OPENSSL_indirect_call,@function
605.align	16
606OPENSSL_indirect_call:
607.L_OPENSSL_indirect_call_begin:
608	pushl	%ebp
609	movl	%esp,%ebp
610	subl	$28,%esp
611	movl	12(%ebp),%ecx
612	movl	%ecx,(%esp)
613	movl	16(%ebp),%edx
614	movl	%edx,4(%esp)
615	movl	20(%ebp),%eax
616	movl	%eax,8(%esp)
617	movl	24(%ebp),%eax
618	movl	%eax,12(%esp)
619	movl	28(%ebp),%eax
620	movl	%eax,16(%esp)
621	movl	32(%ebp),%eax
622	movl	%eax,20(%esp)
623	movl	36(%ebp),%eax
624	movl	%eax,24(%esp)
625	call	*8(%ebp)
626	movl	%ebp,%esp
627	popl	%ebp
628	ret
629.size	OPENSSL_indirect_call,.-.L_OPENSSL_indirect_call_begin
630.globl	OPENSSL_cleanse
631.type	OPENSSL_cleanse,@function
632.align	16
633OPENSSL_cleanse:
634.L_OPENSSL_cleanse_begin:
635	movl	4(%esp),%edx
636	movl	8(%esp),%ecx
637	xorl	%eax,%eax
638	cmpl	$7,%ecx
639	jae	.L015lot
640	cmpl	$0,%ecx
641	je	.L016ret
642.L017little:
643	movb	%al,(%edx)
644	subl	$1,%ecx
645	leal	1(%edx),%edx
646	jnz	.L017little
647.L016ret:
648	ret
649.align	16
650.L015lot:
651	testl	$3,%edx
652	jz	.L018aligned
653	movb	%al,(%edx)
654	leal	-1(%ecx),%ecx
655	leal	1(%edx),%edx
656	jmp	.L015lot
657.L018aligned:
658	movl	%eax,(%edx)
659	leal	-4(%ecx),%ecx
660	testl	$-4,%ecx
661	leal	4(%edx),%edx
662	jnz	.L018aligned
663	cmpl	$0,%ecx
664	jne	.L017little
665	ret
666.size	OPENSSL_cleanse,.-.L_OPENSSL_cleanse_begin
667.globl	OPENSSL_ia32_rdrand
668.type	OPENSSL_ia32_rdrand,@function
669.align	16
670OPENSSL_ia32_rdrand:
671.L_OPENSSL_ia32_rdrand_begin:
672	movl	$8,%ecx
673.L019loop:
674.byte	15,199,240
675	jc	.L020break
676	loop	.L019loop
677.L020break:
678	cmpl	$0,%eax
679	cmovel	%ecx,%eax
680	ret
681.size	OPENSSL_ia32_rdrand,.-.L_OPENSSL_ia32_rdrand_begin
682.comm	OPENSSL_ia32cap_P,8,4
683.section	.init
684	call	OPENSSL_cpuid_setup
685#endif
686