Remove remaining OSI protocol support.
[dragonfly.git] / secure / lib / libcrypto / asm / x86cpuid.s
1 .file   "x86cpuid.s"
2 .text
3 .globl  OPENSSL_ia32_cpuid
4 .type   OPENSSL_ia32_cpuid,@function
5 .align  16
6 OPENSSL_ia32_cpuid:
7 .L_OPENSSL_ia32_cpuid_begin:
8         pushl   %ebp
9         pushl   %ebx
10         pushl   %esi
11         pushl   %edi
12         xorl    %edx,%edx
13         pushfl
14         popl    %eax
15         movl    %eax,%ecx
16         xorl    $2097152,%eax
17         pushl   %eax
18         popfl
19         pushfl
20         popl    %eax
21         xorl    %eax,%ecx
22         xorl    %eax,%eax
23         btl     $21,%ecx
24         jnc     .L000nocpuid
25         .byte   0x0f,0xa2
26         movl    %eax,%edi
27         xorl    %eax,%eax
28         cmpl    $1970169159,%ebx
29         setne   %al
30         movl    %eax,%ebp
31         cmpl    $1231384169,%edx
32         setne   %al
33         orl     %eax,%ebp
34         cmpl    $1818588270,%ecx
35         setne   %al
36         orl     %eax,%ebp
37         jz      .L001intel
38         cmpl    $1752462657,%ebx
39         setne   %al
40         movl    %eax,%esi
41         cmpl    $1769238117,%edx
42         setne   %al
43         orl     %eax,%esi
44         cmpl    $1145913699,%ecx
45         setne   %al
46         orl     %eax,%esi
47         jnz     .L001intel
48         movl    $2147483648,%eax
49         .byte   0x0f,0xa2
50         cmpl    $2147483649,%eax
51         jb      .L001intel
52         movl    %eax,%esi
53         movl    $2147483649,%eax
54         .byte   0x0f,0xa2
55         orl     %ecx,%ebp
56         andl    $2049,%ebp
57         cmpl    $2147483656,%esi
58         jb      .L001intel
59         movl    $2147483656,%eax
60         .byte   0x0f,0xa2
61         movzbl  %cl,%esi
62         incl    %esi
63         movl    $1,%eax
64         xorl    %ecx,%ecx
65         .byte   0x0f,0xa2
66         btl     $28,%edx
67         jnc     .L002generic
68         shrl    $16,%ebx
69         andl    $255,%ebx
70         cmpl    %esi,%ebx
71         ja      .L002generic
72         andl    $4026531839,%edx
73         jmp     .L002generic
74 .L001intel:
75         cmpl    $4,%edi
76         movl    $-1,%edi
77         jb      .L003nocacheinfo
78         movl    $4,%eax
79         movl    $0,%ecx
80         .byte   0x0f,0xa2
81         movl    %eax,%edi
82         shrl    $14,%edi
83         andl    $4095,%edi
84 .L003nocacheinfo:
85         movl    $1,%eax
86         xorl    %ecx,%ecx
87         .byte   0x0f,0xa2
88         andl    $3220176895,%edx
89         cmpl    $0,%ebp
90         jne     .L004notintel
91         orl     $1073741824,%edx
92         andb    $15,%ah
93         cmpb    $15,%ah
94         jne     .L004notintel
95         orl     $1048576,%edx
96 .L004notintel:
97         btl     $28,%edx
98         jnc     .L002generic
99         andl    $4026531839,%edx
100         cmpl    $0,%edi
101         je      .L002generic
102         orl     $268435456,%edx
103         shrl    $16,%ebx
104         cmpb    $1,%bl
105         ja      .L002generic
106         andl    $4026531839,%edx
107 .L002generic:
108         andl    $2048,%ebp
109         andl    $4294965247,%ecx
110         movl    %edx,%esi
111         orl     %ecx,%ebp
112         btl     $27,%ecx
113         jnc     .L005clear_avx
114         xorl    %ecx,%ecx
115 .byte   15,1,208
116         andl    $6,%eax
117         cmpl    $6,%eax
118         je      .L006done
119         cmpl    $2,%eax
120         je      .L005clear_avx
121 .L007clear_xmm:
122         andl    $4261412861,%ebp
123         andl    $4278190079,%esi
124 .L005clear_avx:
125         andl    $4026525695,%ebp
126 .L006done:
127         movl    %esi,%eax
128         movl    %ebp,%edx
129 .L000nocpuid:
130         popl    %edi
131         popl    %esi
132         popl    %ebx
133         popl    %ebp
134         ret
135 .size   OPENSSL_ia32_cpuid,.-.L_OPENSSL_ia32_cpuid_begin
136 .globl  OPENSSL_rdtsc
137 .type   OPENSSL_rdtsc,@function
138 .align  16
139 OPENSSL_rdtsc:
140 .L_OPENSSL_rdtsc_begin:
141         xorl    %eax,%eax
142         xorl    %edx,%edx
143         leal    OPENSSL_ia32cap_P,%ecx
144         btl     $4,(%ecx)
145         jnc     .L008notsc
146         .byte   0x0f,0x31
147 .L008notsc:
148         ret
149 .size   OPENSSL_rdtsc,.-.L_OPENSSL_rdtsc_begin
150 .globl  OPENSSL_instrument_halt
151 .type   OPENSSL_instrument_halt,@function
152 .align  16
153 OPENSSL_instrument_halt:
154 .L_OPENSSL_instrument_halt_begin:
155         leal    OPENSSL_ia32cap_P,%ecx
156         btl     $4,(%ecx)
157         jnc     .L009nohalt
158 .long   2421723150
159         andl    $3,%eax
160         jnz     .L009nohalt
161         pushfl
162         popl    %eax
163         btl     $9,%eax
164         jnc     .L009nohalt
165         .byte   0x0f,0x31
166         pushl   %edx
167         pushl   %eax
168         hlt
169         .byte   0x0f,0x31
170         subl    (%esp),%eax
171         sbbl    4(%esp),%edx
172         addl    $8,%esp
173         ret
174 .L009nohalt:
175         xorl    %eax,%eax
176         xorl    %edx,%edx
177         ret
178 .size   OPENSSL_instrument_halt,.-.L_OPENSSL_instrument_halt_begin
179 .globl  OPENSSL_far_spin
180 .type   OPENSSL_far_spin,@function
181 .align  16
182 OPENSSL_far_spin:
183 .L_OPENSSL_far_spin_begin:
184         pushfl
185         popl    %eax
186         btl     $9,%eax
187         jnc     .L010nospin
188         movl    4(%esp),%eax
189         movl    8(%esp),%ecx
190 .long   2430111262
191         xorl    %eax,%eax
192         movl    (%ecx),%edx
193         jmp     .L011spin
194 .align  16
195 .L011spin:
196         incl    %eax
197         cmpl    (%ecx),%edx
198         je      .L011spin
199 .long   529567888
200         ret
201 .L010nospin:
202         xorl    %eax,%eax
203         xorl    %edx,%edx
204         ret
205 .size   OPENSSL_far_spin,.-.L_OPENSSL_far_spin_begin
206 .globl  OPENSSL_wipe_cpu
207 .type   OPENSSL_wipe_cpu,@function
208 .align  16
209 OPENSSL_wipe_cpu:
210 .L_OPENSSL_wipe_cpu_begin:
211         xorl    %eax,%eax
212         xorl    %edx,%edx
213         leal    OPENSSL_ia32cap_P,%ecx
214         movl    (%ecx),%ecx
215         btl     $1,(%ecx)
216         jnc     .L012no_x87
217         andl    $83886080,%ecx
218         cmpl    $83886080,%ecx
219         jne     .L013no_sse2
220         pxor    %xmm0,%xmm0
221         pxor    %xmm1,%xmm1
222         pxor    %xmm2,%xmm2
223         pxor    %xmm3,%xmm3
224         pxor    %xmm4,%xmm4
225         pxor    %xmm5,%xmm5
226         pxor    %xmm6,%xmm6
227         pxor    %xmm7,%xmm7
228 .L013no_sse2:
229 .long   4007259865,4007259865,4007259865,4007259865,2430851995
230 .L012no_x87:
231         leal    4(%esp),%eax
232         ret
233 .size   OPENSSL_wipe_cpu,.-.L_OPENSSL_wipe_cpu_begin
234 .globl  OPENSSL_atomic_add
235 .type   OPENSSL_atomic_add,@function
236 .align  16
237 OPENSSL_atomic_add:
238 .L_OPENSSL_atomic_add_begin:
239         movl    4(%esp),%edx
240         movl    8(%esp),%ecx
241         pushl   %ebx
242         nop
243         movl    (%edx),%eax
244 .L014spin:
245         leal    (%eax,%ecx,1),%ebx
246         nop
247 .long   447811568
248         jne     .L014spin
249         movl    %ebx,%eax
250         popl    %ebx
251         ret
252 .size   OPENSSL_atomic_add,.-.L_OPENSSL_atomic_add_begin
253 .globl  OPENSSL_indirect_call
254 .type   OPENSSL_indirect_call,@function
255 .align  16
256 OPENSSL_indirect_call:
257 .L_OPENSSL_indirect_call_begin:
258         pushl   %ebp
259         movl    %esp,%ebp
260         subl    $28,%esp
261         movl    12(%ebp),%ecx
262         movl    %ecx,(%esp)
263         movl    16(%ebp),%edx
264         movl    %edx,4(%esp)
265         movl    20(%ebp),%eax
266         movl    %eax,8(%esp)
267         movl    24(%ebp),%eax
268         movl    %eax,12(%esp)
269         movl    28(%ebp),%eax
270         movl    %eax,16(%esp)
271         movl    32(%ebp),%eax
272         movl    %eax,20(%esp)
273         movl    36(%ebp),%eax
274         movl    %eax,24(%esp)
275         call    *8(%ebp)
276         movl    %ebp,%esp
277         popl    %ebp
278         ret
279 .size   OPENSSL_indirect_call,.-.L_OPENSSL_indirect_call_begin
280 .globl  OPENSSL_cleanse
281 .type   OPENSSL_cleanse,@function
282 .align  16
283 OPENSSL_cleanse:
284 .L_OPENSSL_cleanse_begin:
285         movl    4(%esp),%edx
286         movl    8(%esp),%ecx
287         xorl    %eax,%eax
288         cmpl    $7,%ecx
289         jae     .L015lot
290         cmpl    $0,%ecx
291         je      .L016ret
292 .L017little:
293         movb    %al,(%edx)
294         subl    $1,%ecx
295         leal    1(%edx),%edx
296         jnz     .L017little
297 .L016ret:
298         ret
299 .align  16
300 .L015lot:
301         testl   $3,%edx
302         jz      .L018aligned
303         movb    %al,(%edx)
304         leal    -1(%ecx),%ecx
305         leal    1(%edx),%edx
306         jmp     .L015lot
307 .L018aligned:
308         movl    %eax,(%edx)
309         leal    -4(%ecx),%ecx
310         testl   $-4,%ecx
311         leal    4(%edx),%edx
312         jnz     .L018aligned
313         cmpl    $0,%ecx
314         jne     .L017little
315         ret
316 .size   OPENSSL_cleanse,.-.L_OPENSSL_cleanse_begin
317 .globl  OPENSSL_ia32_rdrand
318 .type   OPENSSL_ia32_rdrand,@function
319 .align  16
320 OPENSSL_ia32_rdrand:
321 .L_OPENSSL_ia32_rdrand_begin:
322         movl    $8,%ecx
323 .L019loop:
324 .byte   15,199,240
325         jc      .L020break
326         loop    .L019loop
327 .L020break:
328         cmpl    $0,%eax
329         cmovel  %ecx,%eax
330         ret
331 .size   OPENSSL_ia32_rdrand,.-.L_OPENSSL_ia32_rdrand_begin
332 .comm   OPENSSL_ia32cap_P,8,4
333 .section        .init
334         call    OPENSSL_cpuid_setup