VirtualBox

source: vbox/trunk/src/libs/openssl-1.1.1g/crypto/genasm-nasm/x86cpuid.S@ 86352

最後變更 在這個檔案從86352是 83531,由 vboxsync 提交於 5 年 前

setting svn:sync-process=export for openssl-1.1.1f, all files except tests

檔案大小: 6.4 KB
 
1%ifidn __OUTPUT_FORMAT__,obj
2section code use32 class=code align=64
3%elifidn __OUTPUT_FORMAT__,win32
4section .text code align=64
5%else
6section .text code
7%endif
8global _OPENSSL_ia32_cpuid
9align 16
10_OPENSSL_ia32_cpuid:
11L$_OPENSSL_ia32_cpuid_begin:
12 push ebp
13 push ebx
14 push esi
15 push edi
16 xor edx,edx
17 pushfd
18 pop eax
19 mov ecx,eax
20 xor eax,2097152
21 push eax
22 popfd
23 pushfd
24 pop eax
25 xor ecx,eax
26 xor eax,eax
27 mov esi,DWORD [20+esp]
28 mov DWORD [8+esi],eax
29 bt ecx,21
30 jnc NEAR L$000nocpuid
31 cpuid
32 mov edi,eax
33 xor eax,eax
34 cmp ebx,1970169159
35 setne al
36 mov ebp,eax
37 cmp edx,1231384169
38 setne al
39 or ebp,eax
40 cmp ecx,1818588270
41 setne al
42 or ebp,eax
43 jz NEAR L$001intel
44 cmp ebx,1752462657
45 setne al
46 mov esi,eax
47 cmp edx,1769238117
48 setne al
49 or esi,eax
50 cmp ecx,1145913699
51 setne al
52 or esi,eax
53 jnz NEAR L$001intel
54 mov eax,2147483648
55 cpuid
56 cmp eax,2147483649
57 jb NEAR L$001intel
58 mov esi,eax
59 mov eax,2147483649
60 cpuid
61 or ebp,ecx
62 and ebp,2049
63 cmp esi,2147483656
64 jb NEAR L$001intel
65 mov eax,2147483656
66 cpuid
67 movzx esi,cl
68 inc esi
69 mov eax,1
70 xor ecx,ecx
71 cpuid
72 bt edx,28
73 jnc NEAR L$002generic
74 shr ebx,16
75 and ebx,255
76 cmp ebx,esi
77 ja NEAR L$002generic
78 and edx,4026531839
79 jmp NEAR L$002generic
80L$001intel:
81 cmp edi,4
82 mov esi,-1
83 jb NEAR L$003nocacheinfo
84 mov eax,4
85 mov ecx,0
86 cpuid
87 mov esi,eax
88 shr esi,14
89 and esi,4095
90L$003nocacheinfo:
91 mov eax,1
92 xor ecx,ecx
93 cpuid
94 and edx,3220176895
95 cmp ebp,0
96 jne NEAR L$004notintel
97 or edx,1073741824
98 and ah,15
99 cmp ah,15
100 jne NEAR L$004notintel
101 or edx,1048576
102L$004notintel:
103 bt edx,28
104 jnc NEAR L$002generic
105 and edx,4026531839
106 cmp esi,0
107 je NEAR L$002generic
108 or edx,268435456
109 shr ebx,16
110 cmp bl,1
111 ja NEAR L$002generic
112 and edx,4026531839
113L$002generic:
114 and ebp,2048
115 and ecx,4294965247
116 mov esi,edx
117 or ebp,ecx
118 cmp edi,7
119 mov edi,DWORD [20+esp]
120 jb NEAR L$005no_extended_info
121 mov eax,7
122 xor ecx,ecx
123 cpuid
124 mov DWORD [8+edi],ebx
125L$005no_extended_info:
126 bt ebp,27
127 jnc NEAR L$006clear_avx
128 xor ecx,ecx
129db 15,1,208
130 and eax,6
131 cmp eax,6
132 je NEAR L$007done
133 cmp eax,2
134 je NEAR L$006clear_avx
135L$008clear_xmm:
136 and ebp,4261412861
137 and esi,4278190079
138L$006clear_avx:
139 and ebp,4026525695
140 and DWORD [8+edi],4294967263
141L$007done:
142 mov eax,esi
143 mov edx,ebp
144L$000nocpuid:
145 pop edi
146 pop esi
147 pop ebx
148 pop ebp
149 ret
150;extern _OPENSSL_ia32cap_P
151global _OPENSSL_rdtsc
152align 16
153_OPENSSL_rdtsc:
154L$_OPENSSL_rdtsc_begin:
155 xor eax,eax
156 xor edx,edx
157 lea ecx,[_OPENSSL_ia32cap_P]
158 bt DWORD [ecx],4
159 jnc NEAR L$009notsc
160 rdtsc
161L$009notsc:
162 ret
163global _OPENSSL_instrument_halt
164align 16
165_OPENSSL_instrument_halt:
166L$_OPENSSL_instrument_halt_begin:
167 lea ecx,[_OPENSSL_ia32cap_P]
168 bt DWORD [ecx],4
169 jnc NEAR L$010nohalt
170dd 2421723150
171 and eax,3
172 jnz NEAR L$010nohalt
173 pushfd
174 pop eax
175 bt eax,9
176 jnc NEAR L$010nohalt
177 rdtsc
178 push edx
179 push eax
180 hlt
181 rdtsc
182 sub eax,DWORD [esp]
183 sbb edx,DWORD [4+esp]
184 add esp,8
185 ret
186L$010nohalt:
187 xor eax,eax
188 xor edx,edx
189 ret
190global _OPENSSL_far_spin
191align 16
192_OPENSSL_far_spin:
193L$_OPENSSL_far_spin_begin:
194 pushfd
195 pop eax
196 bt eax,9
197 jnc NEAR L$011nospin
198 mov eax,DWORD [4+esp]
199 mov ecx,DWORD [8+esp]
200dd 2430111262
201 xor eax,eax
202 mov edx,DWORD [ecx]
203 jmp NEAR L$012spin
204align 16
205L$012spin:
206 inc eax
207 cmp edx,DWORD [ecx]
208 je NEAR L$012spin
209dd 529567888
210 ret
211L$011nospin:
212 xor eax,eax
213 xor edx,edx
214 ret
215global _OPENSSL_wipe_cpu
216align 16
217_OPENSSL_wipe_cpu:
218L$_OPENSSL_wipe_cpu_begin:
219 xor eax,eax
220 xor edx,edx
221 lea ecx,[_OPENSSL_ia32cap_P]
222 mov ecx,DWORD [ecx]
223 bt DWORD [ecx],1
224 jnc NEAR L$013no_x87
225dd 4007259865,4007259865,4007259865,4007259865,2430851995
226L$013no_x87:
227 lea eax,[4+esp]
228 ret
229global _OPENSSL_atomic_add
230align 16
231_OPENSSL_atomic_add:
232L$_OPENSSL_atomic_add_begin:
233 mov edx,DWORD [4+esp]
234 mov ecx,DWORD [8+esp]
235 push ebx
236 nop
237 mov eax,DWORD [edx]
238L$014spin:
239 lea ebx,[ecx*1+eax]
240 nop
241dd 447811568
242 jne NEAR L$014spin
243 mov eax,ebx
244 pop ebx
245 ret
246global _OPENSSL_cleanse
247align 16
248_OPENSSL_cleanse:
249L$_OPENSSL_cleanse_begin:
250 mov edx,DWORD [4+esp]
251 mov ecx,DWORD [8+esp]
252 xor eax,eax
253 cmp ecx,7
254 jae NEAR L$015lot
255 cmp ecx,0
256 je NEAR L$016ret
257L$017little:
258 mov BYTE [edx],al
259 sub ecx,1
260 lea edx,[1+edx]
261 jnz NEAR L$017little
262L$016ret:
263 ret
264align 16
265L$015lot:
266 test edx,3
267 jz NEAR L$018aligned
268 mov BYTE [edx],al
269 lea ecx,[ecx-1]
270 lea edx,[1+edx]
271 jmp NEAR L$015lot
272L$018aligned:
273 mov DWORD [edx],eax
274 lea ecx,[ecx-4]
275 test ecx,-4
276 lea edx,[4+edx]
277 jnz NEAR L$018aligned
278 cmp ecx,0
279 jne NEAR L$017little
280 ret
281global _CRYPTO_memcmp
282align 16
283_CRYPTO_memcmp:
284L$_CRYPTO_memcmp_begin:
285 push esi
286 push edi
287 mov esi,DWORD [12+esp]
288 mov edi,DWORD [16+esp]
289 mov ecx,DWORD [20+esp]
290 xor eax,eax
291 xor edx,edx
292 cmp ecx,0
293 je NEAR L$019no_data
294L$020loop:
295 mov dl,BYTE [esi]
296 lea esi,[1+esi]
297 xor dl,BYTE [edi]
298 lea edi,[1+edi]
299 or al,dl
300 dec ecx
301 jnz NEAR L$020loop
302 neg eax
303 shr eax,31
304L$019no_data:
305 pop edi
306 pop esi
307 ret
308global _OPENSSL_instrument_bus
309align 16
310_OPENSSL_instrument_bus:
311L$_OPENSSL_instrument_bus_begin:
312 push ebp
313 push ebx
314 push esi
315 push edi
316 mov eax,0
317 pop edi
318 pop esi
319 pop ebx
320 pop ebp
321 ret
322global _OPENSSL_instrument_bus2
323align 16
324_OPENSSL_instrument_bus2:
325L$_OPENSSL_instrument_bus2_begin:
326 push ebp
327 push ebx
328 push esi
329 push edi
330 mov eax,0
331 pop edi
332 pop esi
333 pop ebx
334 pop ebp
335 ret
336global _OPENSSL_ia32_rdrand_bytes
337align 16
338_OPENSSL_ia32_rdrand_bytes:
339L$_OPENSSL_ia32_rdrand_bytes_begin:
340 push edi
341 push ebx
342 xor eax,eax
343 mov edi,DWORD [12+esp]
344 mov ebx,DWORD [16+esp]
345 cmp ebx,0
346 je NEAR L$021done
347 mov ecx,8
348L$022loop:
349db 15,199,242
350 jc NEAR L$023break
351 loop L$022loop
352 jmp NEAR L$021done
353align 16
354L$023break:
355 cmp ebx,4
356 jb NEAR L$024tail
357 mov DWORD [edi],edx
358 lea edi,[4+edi]
359 add eax,4
360 sub ebx,4
361 jz NEAR L$021done
362 mov ecx,8
363 jmp NEAR L$022loop
364align 16
365L$024tail:
366 mov BYTE [edi],dl
367 lea edi,[1+edi]
368 inc eax
369 shr edx,8
370 dec ebx
371 jnz NEAR L$024tail
372L$021done:
373 xor edx,edx
374 pop ebx
375 pop edi
376 ret
377global _OPENSSL_ia32_rdseed_bytes
378align 16
379_OPENSSL_ia32_rdseed_bytes:
380L$_OPENSSL_ia32_rdseed_bytes_begin:
381 push edi
382 push ebx
383 xor eax,eax
384 mov edi,DWORD [12+esp]
385 mov ebx,DWORD [16+esp]
386 cmp ebx,0
387 je NEAR L$025done
388 mov ecx,8
389L$026loop:
390db 15,199,250
391 jc NEAR L$027break
392 loop L$026loop
393 jmp NEAR L$025done
394align 16
395L$027break:
396 cmp ebx,4
397 jb NEAR L$028tail
398 mov DWORD [edi],edx
399 lea edi,[4+edi]
400 add eax,4
401 sub ebx,4
402 jz NEAR L$025done
403 mov ecx,8
404 jmp NEAR L$026loop
405align 16
406L$028tail:
407 mov BYTE [edi],dl
408 lea edi,[1+edi]
409 inc eax
410 shr edx,8
411 dec ebx
412 jnz NEAR L$028tail
413L$025done:
414 xor edx,edx
415 pop ebx
416 pop edi
417 ret
418segment .bss
419common _OPENSSL_ia32cap_P 16
420segment .CRT$XCU data align=4
421extern _OPENSSL_cpuid_setup
422dd _OPENSSL_cpuid_setup
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette