___
-open STDOUT,"| $^X perlasm/x86_64-xlate.pl $output";
+$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
+$dir = "." if $dir eq "";
+open STDOUT,"| $^X $dir/perlasm/x86_64-xlate.pl $output";
+
print<<___;
.text
mov \$1,%eax
cpuid
- bt \$28,%edx # test hyper-threading bit
- jnc .Ldone
cmp \$0,%r9d
jne .Lnotintel
- or \$1<<20,%edx # use reserved bit to engage RC4_CHAR
+ or \$0x00100000,%edx # use reserved 20th bit to engage RC4_CHAR
and \$15,%ah
cmp \$15,%ah # examine Family ID
je .Lnotintel
- or \$1<<30,%edx # use reserved bit to skip unrolled loop
+ or \$0x40000000,%edx # use reserved bit to skip unrolled loop
.Lnotintel:
+ bt \$28,%edx # test hyper-threading bit
+ jnc .Ldone
shr \$16,%ebx
cmp \$1,%bl # see if cache is shared
ja .Ldone
or %rcx,%rax
ret
.size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid
+
+.globl OPENSSL_cleanse
+.type OPENSSL_cleanse,\@function,2
+.align 16
+OPENSSL_cleanse:
+ xor %rax,%rax
+ cmp \$15,%rsi
+ jae .Lot
+.Little:
+ mov %al,(%rdi)
+ sub \$1,%rsi
+ lea 1(%rdi),%rdi
+ jnz .Little
+ ret
+.align 16
+.Lot:
+ test \$7,%rdi
+ jz .Laligned
+ mov %al,(%rdi)
+ lea -1(%rsi),%rsi
+ lea 1(%rdi),%rdi
+ jmp .Lot
+.Laligned:
+ mov %rax,(%rdi)
+ lea -8(%rsi),%rsi
+ test \$-8,%rsi
+ lea 8(%rdi),%rdi
+ jnz .Laligned
+ cmp \$0,%rsi
+ jne .Little
+ ret
+.size OPENSSL_cleanse,.-OPENSSL_cleanse
___
+close STDOUT; # flush