1 #if defined(__i386__) 2 .file "crypto/cpu-x86-asm.S" 3 .text 4 .globl _OPENSSL_ia32_cpuid 5 .private_extern _OPENSSL_ia32_cpuid 6 .align 4 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 .globl _OPENSSL_rdtsc 149 .private_extern _OPENSSL_rdtsc 150 .align 4 151 _OPENSSL_rdtsc: 152 L_OPENSSL_rdtsc_begin: 153 xorl %eax,%eax 154 xorl %edx,%edx 155 call L009PIC_me_up 156 L009PIC_me_up: 157 popl %ecx 158 movl L_OPENSSL_ia32cap_P$non_lazy_ptr-L009PIC_me_up(%ecx),%ecx 159 btl $4,(%ecx) 160 jnc L010notsc 161 .byte 0x0f,0x31 162 L010notsc: 163 ret 164 .globl _OPENSSL_instrument_halt 165 .private_extern _OPENSSL_instrument_halt 166 .align 4 167 _OPENSSL_instrument_halt: 168 L_OPENSSL_instrument_halt_begin: 169 call L011PIC_me_up 170 L011PIC_me_up: 171 popl %ecx 172 movl L_OPENSSL_ia32cap_P$non_lazy_ptr-L011PIC_me_up(%ecx),%ecx 173 btl $4,(%ecx) 174 jnc L012nohalt 175 .long 2421723150 176 andl $3,%eax 177 jnz L012nohalt 178 pushfl 179 popl %eax 180 btl $9,%eax 181 jnc L012nohalt 182 .byte 0x0f,0x31 183 pushl %edx 184 pushl %eax 185 hlt 186 .byte 0x0f,0x31 187 subl (%esp),%eax 188 sbbl 4(%esp),%edx 189 addl $8,%esp 190 ret 191 L012nohalt: 192 xorl %eax,%eax 193 xorl %edx,%edx 194 ret 195 .globl _OPENSSL_far_spin 196 .private_extern _OPENSSL_far_spin 197 .align 4 198 _OPENSSL_far_spin: 199 L_OPENSSL_far_spin_begin: 200 pushfl 201 popl %eax 202 btl $9,%eax 203 jnc L013nospin 204 movl 4(%esp),%eax 205 movl 8(%esp),%ecx 206 .long 2430111262 207 xorl %eax,%eax 208 movl (%ecx),%edx 209 jmp L014spin 210 .align 4,0x90 211 L014spin: 212 incl %eax 213 cmpl (%ecx),%edx 214 je L014spin 215 .long 529567888 216 ret 217 L013nospin: 218 xorl %eax,%eax 219 xorl %edx,%edx 220 ret 221 .globl _OPENSSL_wipe_cpu 222 .private_extern _OPENSSL_wipe_cpu 223 .align 4 224 _OPENSSL_wipe_cpu: 225 L_OPENSSL_wipe_cpu_begin: 226 xorl %eax,%eax 227 xorl %edx,%edx 228 call L015PIC_me_up 229 L015PIC_me_up: 230 popl %ecx 231 movl L_OPENSSL_ia32cap_P$non_lazy_ptr-L015PIC_me_up(%ecx),%ecx 232 movl (%ecx),%ecx 233 btl $1,(%ecx) 234 jnc L016no_x87 235 .long 4007259865,4007259865,4007259865,4007259865,2430851995 236 L016no_x87: 237 leal 4(%esp),%eax 238 ret 239 .globl _OPENSSL_atomic_add 240 .private_extern _OPENSSL_atomic_add 241 .align 4 242 _OPENSSL_atomic_add: 243 L_OPENSSL_atomic_add_begin: 244 movl 4(%esp),%edx 245 movl 8(%esp),%ecx 246 pushl %ebx 247 nop 248 movl (%edx),%eax 249 L017spin: 250 leal (%eax,%ecx,1),%ebx 251 nop 252 .long 447811568 253 jne L017spin 254 movl %ebx,%eax 255 popl %ebx 256 ret 257 .globl _OPENSSL_indirect_call 258 .private_extern _OPENSSL_indirect_call 259 .align 4 260 _OPENSSL_indirect_call: 261 L_OPENSSL_indirect_call_begin: 262 pushl %ebp 263 movl %esp,%ebp 264 subl $28,%esp 265 movl 12(%ebp),%ecx 266 movl %ecx,(%esp) 267 movl 16(%ebp),%edx 268 movl %edx,4(%esp) 269 movl 20(%ebp),%eax 270 movl %eax,8(%esp) 271 movl 24(%ebp),%eax 272 movl %eax,12(%esp) 273 movl 28(%ebp),%eax 274 movl %eax,16(%esp) 275 movl 32(%ebp),%eax 276 movl %eax,20(%esp) 277 movl 36(%ebp),%eax 278 movl %eax,24(%esp) 279 call *8(%ebp) 280 movl %ebp,%esp 281 popl %ebp 282 ret 283 .globl _OPENSSL_ia32_rdrand 284 .private_extern _OPENSSL_ia32_rdrand 285 .align 4 286 _OPENSSL_ia32_rdrand: 287 L_OPENSSL_ia32_rdrand_begin: 288 movl $8,%ecx 289 L018loop: 290 .byte 15,199,240 291 jc L019break 292 loop L018loop 293 L019break: 294 cmpl $0,%eax 295 cmovel %ecx,%eax 296 ret 297 .section __IMPORT,__pointers,non_lazy_symbol_pointers 298 L_OPENSSL_ia32cap_P$non_lazy_ptr: 299 .indirect_symbol _OPENSSL_ia32cap_P 300 .long 0 301 #endif 302