1 OPTION DOTNAME 2 .text$ SEGMENT ALIGN(256) 'CODE' 3 4 PUBLIC OPENSSL_ia32_cpuid 5 6 ALIGN 16 7 OPENSSL_ia32_cpuid PROC PUBLIC 8 mov QWORD PTR[8+rsp],rdi ;WIN64 prologue 9 mov QWORD PTR[16+rsp],rsi 10 mov rax,rsp 11 $L$SEH_begin_OPENSSL_ia32_cpuid:: 12 mov rdi,rcx 13 14 15 16 17 mov rdi,rcx 18 mov r8,rbx 19 20 xor eax,eax 21 mov DWORD PTR[8+rdi],eax 22 cpuid 23 mov r11d,eax 24 25 xor eax,eax 26 cmp ebx,0756e6547h 27 setne al 28 mov r9d,eax 29 cmp edx,049656e69h 30 setne al 31 or r9d,eax 32 cmp ecx,06c65746eh 33 setne al 34 or r9d,eax 35 jz $L$intel 36 37 cmp ebx,068747541h 38 setne al 39 mov r10d,eax 40 cmp edx,069746E65h 41 setne al 42 or r10d,eax 43 cmp ecx,0444D4163h 44 setne al 45 or r10d,eax 46 jnz $L$intel 47 48 49 50 51 mov eax,080000000h 52 cpuid 53 54 55 cmp eax,080000001h 56 jb $L$intel 57 mov r10d,eax 58 mov eax,080000001h 59 cpuid 60 61 62 or r9d,ecx 63 and r9d,000000801h 64 65 cmp r10d,080000008h 66 jb $L$intel 67 68 mov eax,080000008h 69 cpuid 70 71 movzx r10,cl 72 inc r10 73 74 mov eax,1 75 cpuid 76 77 bt edx,28 78 jnc $L$generic 79 shr ebx,16 80 cmp bl,r10b 81 ja $L$generic 82 and edx,0efffffffh 83 jmp $L$generic 84 85 $L$intel:: 86 cmp r11d,4 87 mov r10d,-1 88 jb $L$nocacheinfo 89 90 mov eax,4 91 mov ecx,0 92 cpuid 93 mov r10d,eax 94 shr r10d,14 95 and r10d,0fffh 96 97 cmp r11d,7 98 jb $L$nocacheinfo 99 100 mov eax,7 101 xor ecx,ecx 102 cpuid 103 mov DWORD PTR[8+rdi],ebx 104 105 $L$nocacheinfo:: 106 mov eax,1 107 cpuid 108 109 and edx,0bfefffffh 110 cmp r9d,0 111 jne $L$notintel 112 or edx,040000000h 113 and ah,15 114 cmp ah,15 115 jne $L$notintel 116 or edx,000100000h 117 $L$notintel:: 118 bt edx,28 119 jnc $L$generic 120 and edx,0efffffffh 121 cmp r10d,0 122 je $L$generic 123 124 or edx,010000000h 125 shr ebx,16 126 cmp bl,1 127 ja $L$generic 128 and edx,0efffffffh 129 $L$generic:: 130 and r9d,000000800h 131 and ecx,0fffff7ffh 132 or r9d,ecx 133 134 mov r10d,edx 135 bt r9d,27 136 jnc $L$clear_avx 137 xor ecx,ecx 138 DB 00fh,001h,0d0h 139 and eax,6 140 cmp eax,6 141 je $L$done 142 $L$clear_avx:: 143 mov eax,0efffe7ffh 144 and r9d,eax 145 and DWORD PTR[8+rdi],0ffffffdfh 146 $L$done:: 147 mov DWORD PTR[4+rdi],r9d 148 mov DWORD PTR[rdi],r10d 149 mov rbx,r8 150 mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue 151 mov rsi,QWORD PTR[16+rsp] 152 DB 0F3h,0C3h ;repret 153 $L$SEH_end_OPENSSL_ia32_cpuid:: 154 OPENSSL_ia32_cpuid ENDP 155 156 157 .text$ ENDS 158 END 159