Loading crypto/perlasm/ppc-xlate.pl +10 −3 Original line number Diff line number Diff line Loading @@ -31,10 +31,9 @@ my $globl = sub { $ret .= ".type $name,\@function"; last; }; /linux.*64/ && do { $ret .= ".globl .$name\n"; $ret .= ".type .$name,\@function\n"; /linux.*64/ && do { $ret .= ".globl $name\n"; $ret .= ".type $name,\@function\n"; $ret .= ".section \".opd\",\"aw\"\n"; $ret .= ".globl $name\n"; $ret .= ".align 3\n"; $ret .= "$name:\n"; $ret .= ".quad .$name,.TOC.\@tocbase,0\n"; Loading Loading @@ -62,6 +61,14 @@ my $machine = sub { } ".machine $arch"; }; my $size = sub { if ($flavour =~ /linux.*32/) { shift; ".size " . join(",",@_); } else { ""; } }; my $asciz = sub { shift; my $line = join(",",@_); Loading crypto/perlasm/x86_64-xlate.pl +10 −8 Original line number Diff line number Diff line Loading @@ -276,6 +276,7 @@ my %globals; $self->{label} =~ s/(?<![\w\$\.])0x([0-9a-f]+)/0$1h/ig; $self->{label} = "($self->{label})" if ($self->{label} =~ /[\*\+\-\/]/); $sz="q" if ($self->{asterisk} || opcode->mnemonic() eq "movq"); $sz="l" if (opcode->mnemonic() eq "movd"); if (defined($self->{index})) { sprintf "%s[%s%s*%d%s]",$szmap{$sz}, Loading Loading @@ -518,6 +519,7 @@ my %globals; elsif ($flavour eq "mingw64") { $self->{value} = ""; } } elsif ($dir =~ /\.comm/) { $self->{value} = "$dir\t$prefix$line"; $self->{value} =~ s|,([0-9]+),([0-9]+)$|",$1,".log($2)/log(2)|e if ($flavour eq "macosx"); } $line = ""; return $self; Loading Loading @@ -567,7 +569,7 @@ my %globals; $v.=" READONLY"; $v.=" ALIGN(".($1 eq "p" ? 4 : 8).")" if ($masm>=$masmref); } elsif ($line=~/\.CRT\$/i) { $v.=" READONLY DWORD"; $v.=" READONLY ALIGN(8)"; } } $current_segment = $line; Loading @@ -589,7 +591,7 @@ my %globals; $self->{value}="${decor}SEH_end_$current_function->{name}:"; $self->{value}.=":\n" if($masm); } $self->{value}.="$current_function->{name}\tENDP" if($masm); $self->{value}.="$current_function->{name}\tENDP" if($masm && $current_function->{name}); undef $current_function; } last; Loading Loading @@ -666,14 +668,14 @@ my %regrm = ( "%eax"=>0, "%ecx"=>1, "%edx"=>2, "%ebx"=>3, my $movq = sub { # elderly gas can't handle inter-register movq my $arg = shift; my @opcode=(0x66); if ($arg =~ /%xmm([0-9]+),%r(\w+)/) { if ($arg =~ /%xmm([0-9]+),\s*%r(\w+)/) { my ($src,$dst)=($1,$2); if ($dst !~ /[0-9]+/) { $dst = $regrm{"%e$dst"}; } rex(\@opcode,$src,$dst,0x8); push @opcode,0x0f,0x7e; push @opcode,0xc0|(($src&7)<<3)|($dst&7); # ModR/M @opcode; } elsif ($arg =~ /%r(\w+),%xmm([0-9]+)/) { } elsif ($arg =~ /%r(\w+),\s*%xmm([0-9]+)/) { my ($src,$dst)=($2,$1); if ($dst !~ /[0-9]+/) { $dst = $regrm{"%e$dst"}; } rex(\@opcode,$src,$dst,0x8); Loading @@ -686,7 +688,7 @@ my $movq = sub { # elderly gas can't handle inter-register movq }; my $pextrd = sub { if (shift =~ /\$([0-9]+),%xmm([0-9]+),(%\w+)/) { if (shift =~ /\$([0-9]+),\s*%xmm([0-9]+),\s*(%\w+)/) { my @opcode=(0x66); $imm=$1; $src=$2; Loading @@ -704,7 +706,7 @@ my $pextrd = sub { }; my $pinsrd = sub { if (shift =~ /\$([0-9]+),(%\w+),%xmm([0-9]+)/) { if (shift =~ /\$([0-9]+),\s*(%\w+),\s*%xmm([0-9]+)/) { my @opcode=(0x66); $imm=$1; $src=$2; Loading @@ -722,7 +724,7 @@ my $pinsrd = sub { }; my $pshufb = sub { if (shift =~ /%xmm([0-9]+),%xmm([0-9]+)/) { if (shift =~ /%xmm([0-9]+),\s*%xmm([0-9]+)/) { my @opcode=(0x66); rex(\@opcode,$2,$1); push @opcode,0x0f,0x38,0x00; Loading @@ -734,7 +736,7 @@ my $pshufb = sub { }; my $palignr = sub { if (shift =~ /\$([0-9]+),%xmm([0-9]+),%xmm([0-9]+)/) { if (shift =~ /\$([0-9]+),\s*%xmm([0-9]+),\s*%xmm([0-9]+)/) { my @opcode=(0x66); rex(\@opcode,$3,$2); push @opcode,0x0f,0x3a,0x0f; Loading crypto/perlasm/x86asm.pl +3 −1 Original line number Diff line number Diff line Loading @@ -218,7 +218,7 @@ sub ::asm_init $filename=$fn; $i386=$cpu; $elf=$cpp=$coff=$aout=$macosx=$win32=$netware=$mwerks=0; $elf=$cpp=$coff=$aout=$macosx=$win32=$netware=$mwerks=$android=0; if (($type eq "elf")) { $elf=1; require "x86gas.pl"; } elsif (($type eq "a\.out")) Loading @@ -235,6 +235,8 @@ sub ::asm_init { $win32=1; require "x86masm.pl"; } elsif (($type eq "macosx")) { $aout=1; $macosx=1; require "x86gas.pl"; } elsif (($type eq "android")) { $elf=1; $android=1; require "x86gas.pl"; } else { print STDERR <<"EOF"; Pick one target type from Loading crypto/perlasm/x86gas.pl +11 −6 Original line number Diff line number Diff line Loading @@ -160,7 +160,8 @@ sub ::file_end } if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out) { my $tmp=".comm\t${nmdecor}OPENSSL_ia32cap_P,8"; if ($::elf) { push (@out,"$tmp,4\n"); } if ($::macosx) { push (@out,"$tmp,2\n"); } elsif ($::elf) { push (@out,"$tmp,4\n"); } else { push (@out,"$tmp\n"); } } push(@out,$initseg) if ($initseg); Loading @@ -183,7 +184,7 @@ sub ::align sub ::picmeup { my($dst,$sym,$base,$reflabel)=@_; if ($::pic && ($::elf || $::aout)) if (($::pic && ($::elf || $::aout)) || $::macosx) { if (!defined($base)) { &::call(&::label("PIC_me_up")); &::set_label("PIC_me_up"); Loading @@ -209,13 +210,17 @@ sub ::picmeup sub ::initseg { my $f=$nmdecor.shift; if ($::elf) if ($::android) { $initseg.=<<___; .section .init_array .align 4 .long $f ___ } elsif ($::elf) { $initseg.=<<___; .section .init call $f jmp .Linitalign .align $align .Linitalign: ___ } elsif ($::coff) Loading crypto/perlasm/x86masm.pl +7 −0 Original line number Diff line number Diff line Loading @@ -185,4 +185,11 @@ ___ sub ::dataseg { push(@out,"$segment\tENDS\n_DATA\tSEGMENT\n"); $segment="_DATA"; } sub ::safeseh { my $nm=shift; push(@out,"IF \@Version GE 710\n"); push(@out,".SAFESEH ".&::LABEL($nm,$nmdecor.$nm)."\n"); push(@out,"ENDIF\n"); } 1; Loading
crypto/perlasm/ppc-xlate.pl +10 −3 Original line number Diff line number Diff line Loading @@ -31,10 +31,9 @@ my $globl = sub { $ret .= ".type $name,\@function"; last; }; /linux.*64/ && do { $ret .= ".globl .$name\n"; $ret .= ".type .$name,\@function\n"; /linux.*64/ && do { $ret .= ".globl $name\n"; $ret .= ".type $name,\@function\n"; $ret .= ".section \".opd\",\"aw\"\n"; $ret .= ".globl $name\n"; $ret .= ".align 3\n"; $ret .= "$name:\n"; $ret .= ".quad .$name,.TOC.\@tocbase,0\n"; Loading Loading @@ -62,6 +61,14 @@ my $machine = sub { } ".machine $arch"; }; my $size = sub { if ($flavour =~ /linux.*32/) { shift; ".size " . join(",",@_); } else { ""; } }; my $asciz = sub { shift; my $line = join(",",@_); Loading
crypto/perlasm/x86_64-xlate.pl +10 −8 Original line number Diff line number Diff line Loading @@ -276,6 +276,7 @@ my %globals; $self->{label} =~ s/(?<![\w\$\.])0x([0-9a-f]+)/0$1h/ig; $self->{label} = "($self->{label})" if ($self->{label} =~ /[\*\+\-\/]/); $sz="q" if ($self->{asterisk} || opcode->mnemonic() eq "movq"); $sz="l" if (opcode->mnemonic() eq "movd"); if (defined($self->{index})) { sprintf "%s[%s%s*%d%s]",$szmap{$sz}, Loading Loading @@ -518,6 +519,7 @@ my %globals; elsif ($flavour eq "mingw64") { $self->{value} = ""; } } elsif ($dir =~ /\.comm/) { $self->{value} = "$dir\t$prefix$line"; $self->{value} =~ s|,([0-9]+),([0-9]+)$|",$1,".log($2)/log(2)|e if ($flavour eq "macosx"); } $line = ""; return $self; Loading Loading @@ -567,7 +569,7 @@ my %globals; $v.=" READONLY"; $v.=" ALIGN(".($1 eq "p" ? 4 : 8).")" if ($masm>=$masmref); } elsif ($line=~/\.CRT\$/i) { $v.=" READONLY DWORD"; $v.=" READONLY ALIGN(8)"; } } $current_segment = $line; Loading @@ -589,7 +591,7 @@ my %globals; $self->{value}="${decor}SEH_end_$current_function->{name}:"; $self->{value}.=":\n" if($masm); } $self->{value}.="$current_function->{name}\tENDP" if($masm); $self->{value}.="$current_function->{name}\tENDP" if($masm && $current_function->{name}); undef $current_function; } last; Loading Loading @@ -666,14 +668,14 @@ my %regrm = ( "%eax"=>0, "%ecx"=>1, "%edx"=>2, "%ebx"=>3, my $movq = sub { # elderly gas can't handle inter-register movq my $arg = shift; my @opcode=(0x66); if ($arg =~ /%xmm([0-9]+),%r(\w+)/) { if ($arg =~ /%xmm([0-9]+),\s*%r(\w+)/) { my ($src,$dst)=($1,$2); if ($dst !~ /[0-9]+/) { $dst = $regrm{"%e$dst"}; } rex(\@opcode,$src,$dst,0x8); push @opcode,0x0f,0x7e; push @opcode,0xc0|(($src&7)<<3)|($dst&7); # ModR/M @opcode; } elsif ($arg =~ /%r(\w+),%xmm([0-9]+)/) { } elsif ($arg =~ /%r(\w+),\s*%xmm([0-9]+)/) { my ($src,$dst)=($2,$1); if ($dst !~ /[0-9]+/) { $dst = $regrm{"%e$dst"}; } rex(\@opcode,$src,$dst,0x8); Loading @@ -686,7 +688,7 @@ my $movq = sub { # elderly gas can't handle inter-register movq }; my $pextrd = sub { if (shift =~ /\$([0-9]+),%xmm([0-9]+),(%\w+)/) { if (shift =~ /\$([0-9]+),\s*%xmm([0-9]+),\s*(%\w+)/) { my @opcode=(0x66); $imm=$1; $src=$2; Loading @@ -704,7 +706,7 @@ my $pextrd = sub { }; my $pinsrd = sub { if (shift =~ /\$([0-9]+),(%\w+),%xmm([0-9]+)/) { if (shift =~ /\$([0-9]+),\s*(%\w+),\s*%xmm([0-9]+)/) { my @opcode=(0x66); $imm=$1; $src=$2; Loading @@ -722,7 +724,7 @@ my $pinsrd = sub { }; my $pshufb = sub { if (shift =~ /%xmm([0-9]+),%xmm([0-9]+)/) { if (shift =~ /%xmm([0-9]+),\s*%xmm([0-9]+)/) { my @opcode=(0x66); rex(\@opcode,$2,$1); push @opcode,0x0f,0x38,0x00; Loading @@ -734,7 +736,7 @@ my $pshufb = sub { }; my $palignr = sub { if (shift =~ /\$([0-9]+),%xmm([0-9]+),%xmm([0-9]+)/) { if (shift =~ /\$([0-9]+),\s*%xmm([0-9]+),\s*%xmm([0-9]+)/) { my @opcode=(0x66); rex(\@opcode,$3,$2); push @opcode,0x0f,0x3a,0x0f; Loading
crypto/perlasm/x86asm.pl +3 −1 Original line number Diff line number Diff line Loading @@ -218,7 +218,7 @@ sub ::asm_init $filename=$fn; $i386=$cpu; $elf=$cpp=$coff=$aout=$macosx=$win32=$netware=$mwerks=0; $elf=$cpp=$coff=$aout=$macosx=$win32=$netware=$mwerks=$android=0; if (($type eq "elf")) { $elf=1; require "x86gas.pl"; } elsif (($type eq "a\.out")) Loading @@ -235,6 +235,8 @@ sub ::asm_init { $win32=1; require "x86masm.pl"; } elsif (($type eq "macosx")) { $aout=1; $macosx=1; require "x86gas.pl"; } elsif (($type eq "android")) { $elf=1; $android=1; require "x86gas.pl"; } else { print STDERR <<"EOF"; Pick one target type from Loading
crypto/perlasm/x86gas.pl +11 −6 Original line number Diff line number Diff line Loading @@ -160,7 +160,8 @@ sub ::file_end } if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out) { my $tmp=".comm\t${nmdecor}OPENSSL_ia32cap_P,8"; if ($::elf) { push (@out,"$tmp,4\n"); } if ($::macosx) { push (@out,"$tmp,2\n"); } elsif ($::elf) { push (@out,"$tmp,4\n"); } else { push (@out,"$tmp\n"); } } push(@out,$initseg) if ($initseg); Loading @@ -183,7 +184,7 @@ sub ::align sub ::picmeup { my($dst,$sym,$base,$reflabel)=@_; if ($::pic && ($::elf || $::aout)) if (($::pic && ($::elf || $::aout)) || $::macosx) { if (!defined($base)) { &::call(&::label("PIC_me_up")); &::set_label("PIC_me_up"); Loading @@ -209,13 +210,17 @@ sub ::picmeup sub ::initseg { my $f=$nmdecor.shift; if ($::elf) if ($::android) { $initseg.=<<___; .section .init_array .align 4 .long $f ___ } elsif ($::elf) { $initseg.=<<___; .section .init call $f jmp .Linitalign .align $align .Linitalign: ___ } elsif ($::coff) Loading
crypto/perlasm/x86masm.pl +7 −0 Original line number Diff line number Diff line Loading @@ -185,4 +185,11 @@ ___ sub ::dataseg { push(@out,"$segment\tENDS\n_DATA\tSEGMENT\n"); $segment="_DATA"; } sub ::safeseh { my $nm=shift; push(@out,"IF \@Version GE 710\n"); push(@out,".SAFESEH ".&::LABEL($nm,$nmdecor.$nm)."\n"); push(@out,"ENDIF\n"); } 1;