X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fperlasm%2Fx86nasm.pl;h=5d92f6092ac94e84622457f527a92579a53e5228;hb=94782e0e9c28bd872107b8f814f4db68c9fbf5ab;hp=0ec03ff8e0a6fe0142d9f30b31002462ee5c4064;hpb=3a87756fed55879c5aaab0546654d30e434ff7dc;p=oweals%2Fopenssl.git diff --git a/crypto/perlasm/x86nasm.pl b/crypto/perlasm/x86nasm.pl index 0ec03ff8e0..5d92f6092a 100644 --- a/crypto/perlasm/x86nasm.pl +++ b/crypto/perlasm/x86nasm.pl @@ -4,7 +4,7 @@ package x86nasm; *out=\@::out; -$::lbdecor="\@L"; # local label decoration +$::lbdecor="L\$"; # local label decoration $nmdecor=$::netware?"":"_"; # external name decoration $drdecor=$::mwerks?".":""; # directive decoration @@ -19,6 +19,8 @@ sub ::generic { $_[0] = "NEAR $_[0]"; } elsif ($opcode eq "lea" && $#_==1) # wipe storage qualifier from lea { $_[1] =~ s/^[^\[]*\[/\[/o; } + elsif ($opcode eq "clflush" && $#_==0) + { $_[0] =~ s/^[^\[]*\[/\[/o; } } &::emit($opcode,@_); 1; @@ -34,6 +36,8 @@ sub get_mem { my($size,$addr,$reg1,$reg2,$idx)=@_; my($post,$ret); + if (!defined($idx) && 1*$reg2) { $idx=$reg2; $reg2=$reg1; undef $reg1; } + if ($size ne "") { $ret .= "$size"; $ret .= " PTR" if ($::mwerks); @@ -67,6 +71,7 @@ sub get_mem } sub ::BP { &get_mem("BYTE",@_); } sub ::DWP { &get_mem("DWORD",@_); } +sub ::WP { &get_mem("WORD",@_); } sub ::QWP { &get_mem("",@_); } sub ::BC { (($::mwerks)?"":"BYTE ")."@_"; } sub ::DWC { (($::mwerks)?"":"DWORD ")."@_"; } @@ -75,10 +80,13 @@ sub ::file { if ($::mwerks) { push(@out,".section\t.text,64\n"); } else { my $tmp=<<___; -%ifdef __omf__ +%ifidn __OUTPUT_FORMAT__,obj section code use32 class=code align=64 -%else +%elifidn __OUTPUT_FORMAT__,win32 +\$\@feat.00 equ 1 section .text code align=64 +%else +section .text code %endif ___ push(@out,$tmp); @@ -111,7 +119,7 @@ sub ::file_end { if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out) { my $comm=<<___; ${drdecor}segment .bss -${drdecor}common ${nmdecor}OPENSSL_ia32cap_P 4 +${drdecor}common ${nmdecor}OPENSSL_ia32cap_P 16 ___ # comment out OPENSSL_ia32cap_P declarations grep {s/(^extern\s+${nmdecor}OPENSSL_ia32cap_P)/\;$1/} @out; @@ -132,7 +140,8 @@ sub ::public_label sub ::data_byte { push(@out,(($::mwerks)?".byte\t":"db\t").join(',',@_)."\n"); } - +sub ::data_short +{ push(@out,(($::mwerks)?".word\t":"dw\t").join(',',@_)."\n"); } sub ::data_word { push(@out,(($::mwerks)?".long\t":"dd\t").join(',',@_)."\n"); } @@ -155,4 +164,16 @@ ___ } } +sub ::dataseg +{ if ($mwerks) { push(@out,".section\t.data,4\n"); } + else { push(@out,"section\t.data align=4\n"); } +} + +sub ::safeseh +{ my $nm=shift; + push(@out,"%if __NASM_VERSION_ID__ >= 0x02030000\n"); + push(@out,"safeseh ".&::LABEL($nm,$nmdecor.$nm)."\n"); + push(@out,"%endif\n"); +} + 1;