Make x86_64 modules work under Win64/x64.
This commit is contained in:
parent
dc0fcb98df
commit
55eab3b74b
@ -626,14 +626,13 @@ AES_encrypt:
|
|||||||
|
|
||||||
call _x86_64_AES_encrypt_compact
|
call _x86_64_AES_encrypt_compact
|
||||||
|
|
||||||
lea 16(%rsp),%rsp
|
mov 16(%rsp),$out # restore out
|
||||||
pop $out # restore out
|
mov 24(%rsp),%rsp
|
||||||
mov $s0,0($out) # write output vector
|
mov $s0,0($out) # write output vector
|
||||||
mov $s1,4($out)
|
mov $s1,4($out)
|
||||||
mov $s2,8($out)
|
mov $s2,8($out)
|
||||||
mov $s3,12($out)
|
mov $s3,12($out)
|
||||||
|
|
||||||
mov (%rsp),%rsp
|
|
||||||
pop %r15
|
pop %r15
|
||||||
pop %r14
|
pop %r14
|
||||||
pop %r13
|
pop %r13
|
||||||
@ -1217,19 +1216,18 @@ AES_decrypt:
|
|||||||
sub $sbox,%rbp
|
sub $sbox,%rbp
|
||||||
and \$0x300,%rbp
|
and \$0x300,%rbp
|
||||||
lea ($sbox,%rbp),$sbox
|
lea ($sbox,%rbp),$sbox
|
||||||
shr \$3,%rbp # recall "magic" constants!
|
shr \$3,%rbp # recall "magic" constants!
|
||||||
add %rbp,$sbox
|
add %rbp,$sbox
|
||||||
|
|
||||||
call _x86_64_AES_decrypt_compact
|
call _x86_64_AES_decrypt_compact
|
||||||
|
|
||||||
lea 16(%rsp),%rsp
|
mov 16(%rsp),$out # restore out
|
||||||
pop $out # restore out
|
mov 24(%rsp),%rsp
|
||||||
mov $s0,0($out)
|
mov $s0,0($out) # write output vector
|
||||||
mov $s1,4($out)
|
mov $s1,4($out)
|
||||||
mov $s2,8($out)
|
mov $s2,8($out)
|
||||||
mov $s3,12($out)
|
mov $s3,12($out)
|
||||||
|
|
||||||
mov (%rsp),%rsp
|
|
||||||
pop %r15
|
pop %r15
|
||||||
pop %r14
|
pop %r14
|
||||||
pop %r13
|
pop %r13
|
||||||
@ -1275,6 +1273,13 @@ $code.=<<___;
|
|||||||
.type AES_set_encrypt_key,\@function,3
|
.type AES_set_encrypt_key,\@function,3
|
||||||
.align 16
|
.align 16
|
||||||
AES_set_encrypt_key:
|
AES_set_encrypt_key:
|
||||||
|
call _x86_64_AES_set_encrypt_key
|
||||||
|
ret
|
||||||
|
.size AES_set_encrypt_key,.-AES_set_encrypt_key
|
||||||
|
|
||||||
|
.type _x86_64_AES_set_encrypt_key,\@abi-omnipotent
|
||||||
|
.align 16
|
||||||
|
_x86_64_AES_set_encrypt_key:
|
||||||
push %rbx
|
push %rbx
|
||||||
push %rbp
|
push %rbp
|
||||||
|
|
||||||
@ -1461,8 +1466,8 @@ $code.=<<___;
|
|||||||
.Lexit:
|
.Lexit:
|
||||||
pop %rbp
|
pop %rbp
|
||||||
pop %rbx
|
pop %rbx
|
||||||
ret
|
.byte 0xf3,0xc3 # rep ret
|
||||||
.size AES_set_encrypt_key,.-AES_set_encrypt_key
|
.size _x86_64_AES_set_encrypt_key,.-_x86_64_AES_set_encrypt_key
|
||||||
___
|
___
|
||||||
|
|
||||||
sub deckey_ref()
|
sub deckey_ref()
|
||||||
@ -1527,7 +1532,7 @@ $code.=<<___;
|
|||||||
.align 16
|
.align 16
|
||||||
AES_set_decrypt_key:
|
AES_set_decrypt_key:
|
||||||
push %rdx # save key schedule
|
push %rdx # save key schedule
|
||||||
call AES_set_encrypt_key
|
call _x86_64_AES_set_encrypt_key
|
||||||
cmp \$0,%eax
|
cmp \$0,%eax
|
||||||
pop %r8 # restore key schedule
|
pop %r8 # restore key schedule
|
||||||
jne .Labort
|
jne .Labort
|
||||||
|
@ -85,6 +85,8 @@ my $current_function;
|
|||||||
if ($self->{op} =~ /(movz)b.*/) { # movz is pain...
|
if ($self->{op} =~ /(movz)b.*/) { # movz is pain...
|
||||||
$self->{op} = $1;
|
$self->{op} = $1;
|
||||||
$self->{sz} = "b";
|
$self->{sz} = "b";
|
||||||
|
} elsif ($self->{op} =~ /call/) {
|
||||||
|
$self->{sz} = ""
|
||||||
} elsif ($self->{op} =~ /([a-z]{3,})([qlwb])/) {
|
} elsif ($self->{op} =~ /([a-z]{3,})([qlwb])/) {
|
||||||
$self->{op} = $1;
|
$self->{op} = $1;
|
||||||
$self->{sz} = $2;
|
$self->{sz} = $2;
|
||||||
@ -358,7 +360,7 @@ my $current_function;
|
|||||||
$self->{value} = $v;
|
$self->{value} = $v;
|
||||||
last;
|
last;
|
||||||
};
|
};
|
||||||
/\.extern/ && do { $self->{value} = "EXTRN\t".$line; last; };
|
/\.extern/ && do { $self->{value} = "EXTRN\t".$line.":BYTE"; last; };
|
||||||
/\.globl/ && do { $self->{value} = "PUBLIC\t".$line; last; };
|
/\.globl/ && do { $self->{value} = "PUBLIC\t".$line; last; };
|
||||||
/\.type/ && do { ($sym,$type,$narg) = split(',',$line);
|
/\.type/ && do { ($sym,$type,$narg) = split(',',$line);
|
||||||
if ($type eq "\@function") {
|
if ($type eq "\@function") {
|
||||||
@ -394,8 +396,15 @@ my $current_function;
|
|||||||
last;
|
last;
|
||||||
};
|
};
|
||||||
/\.asciz/ && do { if ($line =~ /^"(.*)"$/) {
|
/\.asciz/ && do { if ($line =~ /^"(.*)"$/) {
|
||||||
$self->{value} = "DB\t"
|
my @str=unpack("C*",$1);
|
||||||
.join(",",unpack("C*",$1),0);
|
push @str,0;
|
||||||
|
while ($#str>15) {
|
||||||
|
$self->{value}.="DB\t"
|
||||||
|
.join(",",@str[0..15])."\n";
|
||||||
|
foreach (0..15) { shift @str; }
|
||||||
|
}
|
||||||
|
$self->{value}.="DB\t"
|
||||||
|
.join(",",@str) if (@str);
|
||||||
}
|
}
|
||||||
last;
|
last;
|
||||||
};
|
};
|
||||||
|
@ -41,7 +41,13 @@
|
|||||||
# apparently are not atomic instructions, but implemented in microcode.
|
# apparently are not atomic instructions, but implemented in microcode.
|
||||||
|
|
||||||
$output=shift;
|
$output=shift;
|
||||||
open STDOUT,"| $^X ../perlasm/x86_64-xlate.pl $output";
|
|
||||||
|
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
|
||||||
|
( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or
|
||||||
|
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
|
||||||
|
die "can't locate x86_64-xlate.pl";
|
||||||
|
|
||||||
|
open STDOUT,"| $^X $xlate $output";
|
||||||
|
|
||||||
if ($output =~ /512/) {
|
if ($output =~ /512/) {
|
||||||
$func="sha512_block_data_order";
|
$func="sha512_block_data_order";
|
||||||
|
@ -136,11 +136,11 @@ OPENSSL_ia32_cpuid:
|
|||||||
cpuid
|
cpuid
|
||||||
cmp \$0,%r9d
|
cmp \$0,%r9d
|
||||||
jne .Lnotintel
|
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
|
and \$15,%ah
|
||||||
cmp \$15,%ah # examine Family ID
|
cmp \$15,%ah # examine Family ID
|
||||||
je .Lnotintel
|
je .Lnotintel
|
||||||
or \$1<<30,%edx # use reserved bit to skip unrolled loop
|
or \$0x40000000,%edx # use reserved bit to skip unrolled loop
|
||||||
.Lnotintel:
|
.Lnotintel:
|
||||||
bt \$28,%edx # test hyper-threading bit
|
bt \$28,%edx # test hyper-threading bit
|
||||||
jnc .Ldone
|
jnc .Ldone
|
||||||
|
Loading…
x
Reference in New Issue
Block a user