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
open STDOUT,"| $^X perlasm/x86_64-xlate.pl $output";
107
.type OPENSSL_rdtsc,\@abi-omnipotent
114
.size OPENSSL_rdtsc,.-OPENSSL_rdtsc
116
.globl OPENSSL_ia32_cpuid
117
.type OPENSSL_ia32_cpuid,\@abi-omnipotent
125
cmp \$0x756e6547,%ebx # "Genu"
128
cmp \$0x49656e69,%edx # "ineI"
131
cmp \$0x6c65746e,%ecx # "ntel"
139
or \$0x00100000,%edx # use reserved 20th bit to engage RC4_CHAR
141
cmp \$15,%ah # examine Family ID
143
or \$0x40000000,%edx # use reserved bit to skip unrolled loop
145
bt \$28,%edx # test hyper-threading bit
148
cmp \$1,%bl # see if cache is shared
150
and \$0xefffffff,%edx # ~(1<<28)
157
.size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid
159
close STDOUT; # flush