1default rel 2%define XMMWORD 3%define YMMWORD 4%define ZMMWORD 5section .text code align=64 6 7 8global OPENSSL_ia32_cpuid 9 10ALIGN 16 11OPENSSL_ia32_cpuid: 12 mov QWORD[8+rsp],rdi ;WIN64 prologue 13 mov QWORD[16+rsp],rsi 14 mov rax,rsp 15$L$SEH_begin_OPENSSL_ia32_cpuid: 16 mov rdi,rcx 17 18 19 20 21 mov rdi,rcx 22 mov r8,rbx 23 24 xor eax,eax 25 mov DWORD[8+rdi],eax 26 cpuid 27 mov r11d,eax 28 29 xor eax,eax 30 cmp ebx,0x756e6547 31 setne al 32 mov r9d,eax 33 cmp edx,0x49656e69 34 setne al 35 or r9d,eax 36 cmp ecx,0x6c65746e 37 setne al 38 or r9d,eax 39 jz NEAR $L$intel 40 41 cmp ebx,0x68747541 42 setne al 43 mov r10d,eax 44 cmp edx,0x69746E65 45 setne al 46 or r10d,eax 47 cmp ecx,0x444D4163 48 setne al 49 or r10d,eax 50 jnz NEAR $L$intel 51 52 53 54 55 mov eax,0x80000000 56 cpuid 57 58 59 cmp eax,0x80000001 60 jb NEAR $L$intel 61 mov r10d,eax 62 mov eax,0x80000001 63 cpuid 64 65 66 or r9d,ecx 67 and r9d,0x00000801 68 69 cmp r10d,0x80000008 70 jb NEAR $L$intel 71 72 mov eax,0x80000008 73 cpuid 74 75 movzx r10,cl 76 inc r10 77 78 mov eax,1 79 cpuid 80 81 bt edx,28 82 jnc NEAR $L$generic 83 shr ebx,16 84 cmp bl,r10b 85 ja NEAR $L$generic 86 and edx,0xefffffff 87 jmp NEAR $L$generic 88 89$L$intel: 90 cmp r11d,4 91 mov r10d,-1 92 jb NEAR $L$nocacheinfo 93 94 mov eax,4 95 mov ecx,0 96 cpuid 97 mov r10d,eax 98 shr r10d,14 99 and r10d,0xfff 100 101 cmp r11d,7 102 jb NEAR $L$nocacheinfo 103 104 mov eax,7 105 xor ecx,ecx 106 cpuid 107 mov DWORD[8+rdi],ebx 108 109$L$nocacheinfo: 110 mov eax,1 111 cpuid 112 113 and edx,0xbfefffff 114 cmp r9d,0 115 jne NEAR $L$notintel 116 or edx,0x40000000 117$L$notintel: 118 bt edx,28 119 jnc NEAR $L$generic 120 and edx,0xefffffff 121 cmp r10d,0 122 je NEAR $L$generic 123 124 or edx,0x10000000 125 shr ebx,16 126 cmp bl,1 127 ja NEAR $L$generic 128 and edx,0xefffffff 129$L$generic: 130 and r9d,0x00000800 131 and ecx,0xfffff7ff 132 or r9d,ecx 133 134 mov r10d,edx 135 bt r9d,27 136 jnc NEAR $L$clear_avx 137 xor ecx,ecx 138DB 0x0f,0x01,0xd0 139 and eax,6 140 cmp eax,6 141 je NEAR $L$done 142$L$clear_avx: 143 mov eax,0xefffe7ff 144 and r9d,eax 145 and DWORD[8+rdi],0xffffffdf 146$L$done: 147 mov DWORD[4+rdi],r9d 148 mov DWORD[rdi],r10d 149 mov rbx,r8 150 mov rdi,QWORD[8+rsp] ;WIN64 epilogue 151 mov rsi,QWORD[16+rsp] 152 DB 0F3h,0C3h ;repret 153$L$SEH_end_OPENSSL_ia32_cpuid: 154 155