ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / third_party / boringssl / win-x86 / crypto / cpu-x86-asm.asm
blobdf7993fa1717ba72614f10d29d7cfb83eb9ce197
1 %ifidn __OUTPUT_FORMAT__,obj
2 section code use32 class=code align=64
3 %elifidn __OUTPUT_FORMAT__,win32
4 %ifdef __YASM_VERSION_ID__
5 %if __YASM_VERSION_ID__ < 01010000h
6 %error yasm version 1.1.0 or later needed.
7 %endif
8 ; Yasm automatically includes .00 and complains about redefining it.
9 ; https://www.tortall.net/projects/yasm/manual/html/objfmt-win32-safeseh.html
10 %else
11 $@feat.00 equ 1
12 %endif
13 section .text code align=64
14 %else
15 section .text code
16 %endif
17 global _OPENSSL_ia32_cpuid
18 align 16
19 _OPENSSL_ia32_cpuid:
20 L$_OPENSSL_ia32_cpuid_begin:
21 push ebp
22 push ebx
23 push esi
24 push edi
25 xor edx,edx
26 pushfd
27 pop eax
28 mov ecx,eax
29 xor eax,2097152
30 push eax
31 popfd
32 pushfd
33 pop eax
34 xor ecx,eax
35 xor eax,eax
36 bt ecx,21
37 jnc NEAR L$000nocpuid
38 mov esi,DWORD [20+esp]
39 mov DWORD [8+esi],eax
40 cpuid
41 mov edi,eax
42 xor eax,eax
43 cmp ebx,1970169159
44 setne al
45 mov ebp,eax
46 cmp edx,1231384169
47 setne al
48 or ebp,eax
49 cmp ecx,1818588270
50 setne al
51 or ebp,eax
52 jz NEAR L$001intel
53 cmp ebx,1752462657
54 setne al
55 mov esi,eax
56 cmp edx,1769238117
57 setne al
58 or esi,eax
59 cmp ecx,1145913699
60 setne al
61 or esi,eax
62 jnz NEAR L$001intel
63 mov eax,2147483648
64 cpuid
65 cmp eax,2147483649
66 jb NEAR L$001intel
67 mov esi,eax
68 mov eax,2147483649
69 cpuid
70 or ebp,ecx
71 and ebp,2049
72 cmp esi,2147483656
73 jb NEAR L$001intel
74 mov eax,2147483656
75 cpuid
76 movzx esi,cl
77 inc esi
78 mov eax,1
79 xor ecx,ecx
80 cpuid
81 bt edx,28
82 jnc NEAR L$002generic
83 shr ebx,16
84 and ebx,255
85 cmp ebx,esi
86 ja NEAR L$002generic
87 and edx,4026531839
88 jmp NEAR L$002generic
89 L$001intel:
90 cmp edi,7
91 jb NEAR L$003cacheinfo
92 mov esi,DWORD [20+esp]
93 mov eax,7
94 xor ecx,ecx
95 cpuid
96 mov DWORD [8+esi],ebx
97 L$003cacheinfo:
98 cmp edi,4
99 mov edi,-1
100 jb NEAR L$004nocacheinfo
101 mov eax,4
102 mov ecx,0
103 cpuid
104 mov edi,eax
105 shr edi,14
106 and edi,4095
107 L$004nocacheinfo:
108 mov eax,1
109 xor ecx,ecx
110 cpuid
111 and edx,3220176895
112 cmp ebp,0
113 jne NEAR L$005notintel
114 or edx,1073741824
115 L$005notintel:
116 bt edx,28
117 jnc NEAR L$002generic
118 and edx,4026531839
119 cmp edi,0
120 je NEAR L$002generic
121 or edx,268435456
122 shr ebx,16
123 cmp bl,1
124 ja NEAR L$002generic
125 and edx,4026531839
126 L$002generic:
127 and ebp,2048
128 and ecx,4294965247
129 mov esi,edx
130 or ebp,ecx
131 bt ecx,27
132 jnc NEAR L$006clear_avx
133 xor ecx,ecx
134 db 15,1,208
135 and eax,6
136 cmp eax,6
137 je NEAR L$007done
138 cmp eax,2
139 je NEAR L$006clear_avx
140 L$008clear_xmm:
141 and ebp,4261412861
142 and esi,4278190079
143 L$006clear_avx:
144 and ebp,4026525695
145 mov edi,DWORD [20+esp]
146 and DWORD [8+edi],4294967263
147 L$007done:
148 mov eax,esi
149 mov edx,ebp
150 L$000nocpuid:
151 pop edi
152 pop esi
153 pop ebx
154 pop ebp
156 ;extern _OPENSSL_ia32cap_P
157 global _OPENSSL_rdtsc
158 align 16
159 _OPENSSL_rdtsc:
160 L$_OPENSSL_rdtsc_begin:
161 xor eax,eax
162 xor edx,edx
163 lea ecx,[_OPENSSL_ia32cap_P]
164 bt DWORD [ecx],4
165 jnc NEAR L$009notsc
166 rdtsc
167 L$009notsc:
169 global _OPENSSL_instrument_halt
170 align 16
171 _OPENSSL_instrument_halt:
172 L$_OPENSSL_instrument_halt_begin:
173 lea ecx,[_OPENSSL_ia32cap_P]
174 bt DWORD [ecx],4
175 jnc NEAR L$010nohalt
176 dd 2421723150
177 and eax,3
178 jnz NEAR L$010nohalt
179 pushfd
180 pop eax
181 bt eax,9
182 jnc NEAR L$010nohalt
183 rdtsc
184 push edx
185 push eax
187 rdtsc
188 sub eax,DWORD [esp]
189 sbb edx,DWORD [4+esp]
190 add esp,8
192 L$010nohalt:
193 xor eax,eax
194 xor edx,edx
196 global _OPENSSL_far_spin
197 align 16
198 _OPENSSL_far_spin:
199 L$_OPENSSL_far_spin_begin:
200 pushfd
201 pop eax
202 bt eax,9
203 jnc NEAR L$011nospin
204 mov eax,DWORD [4+esp]
205 mov ecx,DWORD [8+esp]
206 dd 2430111262
207 xor eax,eax
208 mov edx,DWORD [ecx]
209 jmp NEAR L$012spin
210 align 16
211 L$012spin:
212 inc eax
213 cmp edx,DWORD [ecx]
214 je NEAR L$012spin
215 dd 529567888
217 L$011nospin:
218 xor eax,eax
219 xor edx,edx
221 global _OPENSSL_wipe_cpu
222 align 16
223 _OPENSSL_wipe_cpu:
224 L$_OPENSSL_wipe_cpu_begin:
225 xor eax,eax
226 xor edx,edx
227 lea ecx,[_OPENSSL_ia32cap_P]
228 mov ecx,DWORD [ecx]
229 bt DWORD [ecx],1
230 jnc NEAR L$013no_x87
231 dd 4007259865,4007259865,4007259865,4007259865,2430851995
232 L$013no_x87:
233 lea eax,[4+esp]
235 global _OPENSSL_atomic_add
236 align 16
237 _OPENSSL_atomic_add:
238 L$_OPENSSL_atomic_add_begin:
239 mov edx,DWORD [4+esp]
240 mov ecx,DWORD [8+esp]
241 push ebx
243 mov eax,DWORD [edx]
244 L$014spin:
245 lea ebx,[ecx*1+eax]
247 dd 447811568
248 jne NEAR L$014spin
249 mov eax,ebx
250 pop ebx
252 global _OPENSSL_indirect_call
253 align 16
254 _OPENSSL_indirect_call:
255 L$_OPENSSL_indirect_call_begin:
256 push ebp
257 mov ebp,esp
258 sub esp,28
259 mov ecx,DWORD [12+ebp]
260 mov DWORD [esp],ecx
261 mov edx,DWORD [16+ebp]
262 mov DWORD [4+esp],edx
263 mov eax,DWORD [20+ebp]
264 mov DWORD [8+esp],eax
265 mov eax,DWORD [24+ebp]
266 mov DWORD [12+esp],eax
267 mov eax,DWORD [28+ebp]
268 mov DWORD [16+esp],eax
269 mov eax,DWORD [32+ebp]
270 mov DWORD [20+esp],eax
271 mov eax,DWORD [36+ebp]
272 mov DWORD [24+esp],eax
273 call DWORD [8+ebp]
274 mov esp,ebp
275 pop ebp
277 global _OPENSSL_ia32_rdrand
278 align 16
279 _OPENSSL_ia32_rdrand:
280 L$_OPENSSL_ia32_rdrand_begin:
281 mov ecx,8
282 L$015loop:
283 db 15,199,240
284 jc NEAR L$016break
285 loop L$015loop
286 L$016break:
287 cmp eax,0
288 cmove eax,ecx
290 segment .bss
291 common _OPENSSL_ia32cap_P 16