OpenSSL: Add pre-generated asm files to the build.
[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         btl     $21,%ecx
23         jnc     .L000done
24         xorl    %eax,%eax
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    $2147483656,%eax
51         jb      .L001intel
52         movl    $2147483656,%eax
53         .byte   0x0f,0xa2
54         movzbl  %cl,%esi
55         incl    %esi
56         movl    $1,%eax
57         .byte   0x0f,0xa2
58         btl     $28,%edx
59         jnc     .L000done
60         shrl    $16,%ebx
61         andl    $255,%ebx
62         cmpl    %esi,%ebx
63         ja      .L000done
64         andl    $4026531839,%edx
65         jmp     .L000done
66 .L001intel:
67         cmpl    $4,%edi
68         movl    $-1,%edi
69         jb      .L002nocacheinfo
70         movl    $4,%eax
71         movl    $0,%ecx
72         .byte   0x0f,0xa2
73         movl    %eax,%edi
74         shrl    $14,%edi
75         andl    $4095,%edi
76 .L002nocacheinfo:
77         movl    $1,%eax
78         .byte   0x0f,0xa2
79         cmpl    $0,%ebp
80         jne     .L003notP4
81         andb    $15,%ah
82         cmpb    $15,%ah
83         jne     .L003notP4
84         orl     $1048576,%edx
85 .L003notP4:
86         btl     $28,%edx
87         jnc     .L000done
88         andl    $4026531839,%edx
89         cmpl    $0,%edi
90         je      .L000done
91         orl     $268435456,%edx
92         shrl    $16,%ebx
93         cmpb    $1,%bl
94         ja      .L000done
95         andl    $4026531839,%edx
96 .L000done:
97         movl    %edx,%eax
98         movl    %ecx,%edx
99         popl    %edi
100         popl    %esi
101         popl    %ebx
102         popl    %ebp
103         ret
104 .size   OPENSSL_ia32_cpuid,.-.L_OPENSSL_ia32_cpuid_begin
105 .globl  OPENSSL_rdtsc
106 .type   OPENSSL_rdtsc,@function
107 .align  16
108 OPENSSL_rdtsc:
109 .L_OPENSSL_rdtsc_begin:
110         xorl    %eax,%eax
111         xorl    %edx,%edx
112         leal    OPENSSL_ia32cap_P,%ecx
113         btl     $4,(%ecx)
114         jnc     .L004notsc
115         .byte   0x0f,0x31
116 .L004notsc:
117         ret
118 .size   OPENSSL_rdtsc,.-.L_OPENSSL_rdtsc_begin
119 .globl  OPENSSL_instrument_halt
120 .type   OPENSSL_instrument_halt,@function
121 .align  16
122 OPENSSL_instrument_halt:
123 .L_OPENSSL_instrument_halt_begin:
124         leal    OPENSSL_ia32cap_P,%ecx
125         btl     $4,(%ecx)
126         jnc     .L005nohalt
127 .long   2421723150
128         andl    $3,%eax
129         jnz     .L005nohalt
130         pushfl
131         popl    %eax
132         btl     $9,%eax
133         jnc     .L005nohalt
134         .byte   0x0f,0x31
135         pushl   %edx
136         pushl   %eax
137         hlt
138         .byte   0x0f,0x31
139         subl    (%esp),%eax
140         sbbl    4(%esp),%edx
141         addl    $8,%esp
142         ret
143 .L005nohalt:
144         xorl    %eax,%eax
145         xorl    %edx,%edx
146         ret
147 .size   OPENSSL_instrument_halt,.-.L_OPENSSL_instrument_halt_begin
148 .globl  OPENSSL_far_spin
149 .type   OPENSSL_far_spin,@function
150 .align  16
151 OPENSSL_far_spin:
152 .L_OPENSSL_far_spin_begin:
153         pushfl
154         popl    %eax
155         btl     $9,%eax
156         jnc     .L006nospin
157         movl    4(%esp),%eax
158         movl    8(%esp),%ecx
159 .long   2430111262
160         xorl    %eax,%eax
161         movl    (%ecx),%edx
162         jmp     .L007spin
163 .align  16
164 .L007spin:
165         incl    %eax
166         cmpl    (%ecx),%edx
167         je      .L007spin
168 .long   529567888
169         ret
170 .L006nospin:
171         xorl    %eax,%eax
172         xorl    %edx,%edx
173         ret
174 .size   OPENSSL_far_spin,.-.L_OPENSSL_far_spin_begin
175 .globl  OPENSSL_wipe_cpu
176 .type   OPENSSL_wipe_cpu,@function
177 .align  16
178 OPENSSL_wipe_cpu:
179 .L_OPENSSL_wipe_cpu_begin:
180         xorl    %eax,%eax
181         xorl    %edx,%edx
182         leal    OPENSSL_ia32cap_P,%ecx
183         movl    (%ecx),%ecx
184         btl     $1,(%ecx)
185         jnc     .L008no_x87
186         btl     $26,(%ecx)
187         jnc     .L009no_sse2
188         pxor    %xmm0,%xmm0
189         pxor    %xmm1,%xmm1
190         pxor    %xmm2,%xmm2
191         pxor    %xmm3,%xmm3
192         pxor    %xmm4,%xmm4
193         pxor    %xmm5,%xmm5
194         pxor    %xmm6,%xmm6
195         pxor    %xmm7,%xmm7
196 .L009no_sse2:
197 .long   4007259865,4007259865,4007259865,4007259865,2430851995
198 .L008no_x87:
199         leal    4(%esp),%eax
200         ret
201 .size   OPENSSL_wipe_cpu,.-.L_OPENSSL_wipe_cpu_begin
202 .globl  OPENSSL_atomic_add
203 .type   OPENSSL_atomic_add,@function
204 .align  16
205 OPENSSL_atomic_add:
206 .L_OPENSSL_atomic_add_begin:
207         movl    4(%esp),%edx
208         movl    8(%esp),%ecx
209         pushl   %ebx
210         nop
211         movl    (%edx),%eax
212 .L010spin:
213         leal    (%eax,%ecx,1),%ebx
214         nop
215 .long   447811568
216         jne     .L010spin
217         movl    %ebx,%eax
218         popl    %ebx
219         ret
220 .size   OPENSSL_atomic_add,.-.L_OPENSSL_atomic_add_begin
221 .globl  OPENSSL_indirect_call
222 .type   OPENSSL_indirect_call,@function
223 .align  16
224 OPENSSL_indirect_call:
225 .L_OPENSSL_indirect_call_begin:
226         pushl   %ebp
227         movl    %esp,%ebp
228         subl    $28,%esp
229         movl    12(%ebp),%ecx
230         movl    %ecx,(%esp)
231         movl    16(%ebp),%edx
232         movl    %edx,4(%esp)
233         movl    20(%ebp),%eax
234         movl    %eax,8(%esp)
235         movl    24(%ebp),%eax
236         movl    %eax,12(%esp)
237         movl    28(%ebp),%eax
238         movl    %eax,16(%esp)
239         movl    32(%ebp),%eax
240         movl    %eax,20(%esp)
241         movl    36(%ebp),%eax
242         movl    %eax,24(%esp)
243         call    *8(%ebp)
244         movl    %ebp,%esp
245         popl    %ebp
246         ret
247 .size   OPENSSL_indirect_call,.-.L_OPENSSL_indirect_call_begin
248 .globl  OPENSSL_cleanse
249 .type   OPENSSL_cleanse,@function
250 .align  16
251 OPENSSL_cleanse:
252 .L_OPENSSL_cleanse_begin:
253         movl    4(%esp),%edx
254         movl    8(%esp),%ecx
255         xorl    %eax,%eax
256         cmpl    $7,%ecx
257         jae     .L011lot
258         cmpl    $0,%ecx
259         je      .L012ret
260 .L013little:
261         movb    %al,(%edx)
262         subl    $1,%ecx
263         leal    1(%edx),%edx
264         jnz     .L013little
265 .L012ret:
266         ret
267 .align  16
268 .L011lot:
269         testl   $3,%edx
270         jz      .L014aligned
271         movb    %al,(%edx)
272         leal    -1(%ecx),%ecx
273         leal    1(%edx),%edx
274         jmp     .L011lot
275 .L014aligned:
276         movl    %eax,(%edx)
277         leal    -4(%ecx),%ecx
278         testl   $-4,%ecx
279         leal    4(%edx),%edx
280         jnz     .L014aligned
281         cmpl    $0,%ecx
282         jne     .L013little
283         ret
284 .size   OPENSSL_cleanse,.-.L_OPENSSL_cleanse_begin
285 .comm   OPENSSL_ia32cap_P,4,4
286 .section        .init
287         call    OPENSSL_cpuid_setup
288         jmp     .Linitalign
289 .align  16
290 .Linitalign: