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"
68 or \$0x00100000,%edx # use reserved 20th bit to engage RC4_CHAR
70 cmp \$15,%ah # examine Family ID
72 or \$0x40000000,%edx # use reserved bit to skip unrolled loop
74 bt \$28,%edx # test hyper-threading bit
77 cmp \$1,%bl # see if cache is shared
79 and \$0xefffffff,%edx # ~(1<<28)
86 .size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid
88 .globl OPENSSL_cleanse
89 .type OPENSSL_cleanse,\@abi-omnipotent
118 .size OPENSSL_cleanse,.-OPENSSL_cleanse
121 print<<___ if (!$win64);
122 .globl OPENSSL_wipe_cpu
123 .type OPENSSL_wipe_cpu,\@abi-omnipotent
152 .size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
154 print<<___ if ($win64);
155 .globl OPENSSL_wipe_cpu
156 .type OPENSSL_wipe_cpu,\@abi-omnipotent
173 .size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
176 close STDOUT; # flush