4 $masm=1 if ($output =~ /\.asm/);
5 open STDOUT,">$output" || die "can't open $output: $!";
7 print<<___ if(defined($masm));
11 PUBLIC OPENSSL_atomic_add
13 OPENSSL_atomic_add PROC
14 mov eax,DWORD PTR[rcx]
15 \$Lspin: lea r8,DWORD PTR[rdx+rax]
16 lock cmpxchg DWORD PTR[rcx],r8d
21 OPENSSL_atomic_add ENDP
23 PUBLIC OPENSSL_wipe_cpu
38 lea rax,QWORD PTR[rsp+8]
44 EXTRN OPENSSL_cpuid_setup:PROC
45 DQ OPENSSL_cpuid_setup
49 print<<___ if(!defined($masm));
52 .globl OPENSSL_atomic_add
53 .type OPENSSL_atomic_add,\@function
57 .Lspin: leaq (%rsi,%rax),%r8
58 lock; cmpxchgl %r8d,(%rdi)
63 .size OPENSSL_atomic_add,.-OPENSSL_atomic_add
65 .globl OPENSSL_wipe_cpu
66 .type OPENSSL_wipe_cpu,\@function
95 .size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
98 call OPENSSL_cpuid_setup
102 $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
103 $dir = "." if $dir eq "";
104 open STDOUT,"| $^X $dir/perlasm/x86_64-xlate.pl $output";
110 .type OPENSSL_rdtsc,\@abi-omnipotent
117 .size OPENSSL_rdtsc,.-OPENSSL_rdtsc
119 .globl OPENSSL_ia32_cpuid
120 .type OPENSSL_ia32_cpuid,\@abi-omnipotent
128 cmp \$0x756e6547,%ebx # "Genu"
131 cmp \$0x49656e69,%edx # "ineI"
134 cmp \$0x6c65746e,%ecx # "ntel"
142 or \$0x00100000,%edx # use reserved 20th bit to engage RC4_CHAR
144 cmp \$15,%ah # examine Family ID
146 or \$0x40000000,%edx # use reserved bit to skip unrolled loop
148 bt \$28,%edx # test hyper-threading bit
151 cmp \$1,%bl # see if cache is shared
153 and \$0xefffffff,%edx # ~(1<<28)
160 .size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid
162 .globl OPENSSL_cleanse
163 .type OPENSSL_cleanse,\@function,2
192 .size OPENSSL_cleanse,.-OPENSSL_cleanse
194 close STDOUT; # flush