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