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