5 if ($flavour =~ /\./) { $output = $flavour; undef $flavour; }
7 $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
9 $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
10 open STDOUT,"| $^X ${dir}perlasm/x86_64-xlate.pl $flavour $output";
12 if ($win64) { $arg1="%rcx"; $arg2="%rdx"; }
13 else { $arg1="%rdi"; $arg2="%rsi"; }
15 .extern OPENSSL_cpuid_setup
17 call OPENSSL_cpuid_setup
21 .globl OPENSSL_atomic_add
22 .type OPENSSL_atomic_add,\@abi-omnipotent
26 .Lspin: leaq ($arg2,%rax),%r8
31 .byte 0x48,0x98 # cltq/cdqe
33 .size OPENSSL_atomic_add,.-OPENSSL_atomic_add
36 .type OPENSSL_rdtsc,\@abi-omnipotent
43 .size OPENSSL_rdtsc,.-OPENSSL_rdtsc
45 .globl OPENSSL_ia32_cpuid
46 .type OPENSSL_ia32_cpuid,\@abi-omnipotent
54 cmp \$0x756e6547,%ebx # "Genu"
57 cmp \$0x49656e69,%edx # "ineI"
60 cmp \$0x6c65746e,%ecx # "ntel"
62 or %eax,%r9d # 0 indicates Intel CPU
63 mov \$1,%r10d # "number of [AMD] cores"
66 cmp \$0x68747541,%ebx # "Auth"
69 cmp \$0x69746E65,%edx # "enti"
72 cmp \$0x444D4163,%ecx # "cAMD"
74 or %eax,%r10d # 0 indicates AMD CPU
80 mov \$1,%r10d # "number of [AMD] cores"
85 movzb %cl,%r10 # number of cores - 1
86 inc %r10 # number of cores
93 or \$0x00100000,%edx # use reserved 20th bit to engage RC4_CHAR
95 cmp \$15,%ah # examine Family ID
97 or \$0x40000000,%edx # use reserved bit to skip unrolled loop
99 bt \$28,%edx # test hyper-threading bit
102 cmp %r10b,%bl # see if cache is shared
104 and \$0xefffffff,%edx # ~(1<<28)
111 .size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid
113 .globl OPENSSL_cleanse
114 .type OPENSSL_cleanse,\@abi-omnipotent
143 .size OPENSSL_cleanse,.-OPENSSL_cleanse
146 print<<___ if (!$win64);
147 .globl OPENSSL_wipe_cpu
148 .type OPENSSL_wipe_cpu,\@abi-omnipotent
177 .size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
179 print<<___ if ($win64);
180 .globl OPENSSL_wipe_cpu
181 .type OPENSSL_wipe_cpu,\@abi-omnipotent
198 .size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
201 close STDOUT; # flush