-#!/usr/bin/env perl
+#! /usr/bin/env perl
+# Copyright 2011-2016 The OpenSSL Project Authors. All Rights Reserved.
+#
+# Licensed under the OpenSSL license (the "License"). You may not use
+# this file except in compliance with the License. You can obtain a copy
+# in the file LICENSE in the source distribution or at
+# https://www.openssl.org/source/license.html
+
# ====================================================================
# Written by Andy Polyakov <appro@openssl.org> for the OpenSSL
( $xlate="${dir}../../crypto/perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl";
-open OUT,"| \"$^X\" $xlate $flavour $output";
+open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\"";
*STDOUT=*OUT;
$code=".text\n";
cpuid
xor %eax,%eax
cmp \$`"0x".unpack("H*",'tneC')`,%ebx
- jne .Lnoluck
+ jne .Lzhaoxin
cmp \$`"0x".unpack("H*",'Hrua')`,%edx
jne .Lnoluck
cmp \$`"0x".unpack("H*",'slua')`,%ecx
jne .Lnoluck
+ jmp .LzhaoxinEnd
+.Lzhaoxin:
+ cmp \$`"0x".unpack("H*",'hS ')`,%ebx
+ jne .Lnoluck
+ cmp \$`"0x".unpack("H*",'hgna')`,%edx
+ jne .Lnoluck
+ cmp \$`"0x".unpack("H*",' ia')`,%ecx
+ jne .Lnoluck
+.LzhaoxinEnd:
mov \$0xC0000000,%eax
cpuid
mov %eax,%edx
.L${mode}_no_carry:
___
$code.=<<___;
- mov %r8,$out # restore paramters
+ mov %r8,$out # restore parameters
mov %r11,$chunk
test \$0x0f,$out
jz .L${mode}_out_aligned
bswap %eax
mov %eax,-4($ctx)
- mov %r10,$len # restore paramters
+ mov %r10,$len # restore parameters
sub %r11,$len
mov \$`16*0x10000`,$chunk
jz .L${mode}_exit
sub $len,%rsp
shr \$3,$len
lea (%rsp),$out
- .byte 0xf3,0x48,0xa5 # rep movsq
+ .byte 0xf3,0x48,0xa5 # rep movsq
lea (%r8),$out
lea (%rsp),$inp
mov $chunk,$len