Loading crypto/perlasm/x86asm.pl +7 −10 Original line number Diff line number Diff line Loading @@ -18,15 +18,13 @@ sub main'asm_init ($type,$fn,$i386)=@_; $filename=$fn; $elf=$cpp=$sol=$aout=$win32=$gaswin=$netware=0; $elf=$cpp=$coff=$aout=$win32=$netware=0; if ( ($type eq "elf")) { $elf=1; require "x86unix.pl"; } elsif ( ($type eq "a.out")) { $aout=1; require "x86unix.pl"; } elsif ( ($type eq "gaswin")) { $gaswin=1; $aout=1; require "x86unix.pl"; } elsif ( ($type eq "sol")) { $sol=1; require "x86unix.pl"; } elsif ( ($type eq "coff" or $type eq "gaswin")) { $coff=1; require "x86unix.pl"; } elsif ( ($type eq "cpp")) { $cpp=1; require "x86unix.pl"; } elsif ( ($type eq "win32")) Loading @@ -41,10 +39,9 @@ sub main'asm_init { print STDERR <<"EOF"; Pick one target type from elf - linux, FreeBSD etc a.out - old linux sol - x86 solaris cpp - format so x86unix.cpp can be used elf - Linux, FreeBSD, Solaris x86, etc. a.out - OpenBSD, DJGPP, etc. coff - GAS/COFF such as Win32 targets win32 - Windows 95/Windows NT win32n - Windows 95/Windows NT NASM format nw-nasm - NetWare NASM format Loading @@ -61,7 +58,7 @@ EOF &comment("Don't even think of reading this code"); &comment("It was automatically generated by $filename"); &comment("Which is a perl program used to generate the x86 assember for"); &comment("any of elf, a.out, BSDI, Win32, gaswin (for GNU as on Win32) or Solaris"); &comment("any of ELF, a.out, COFF, Win32, ..."); &comment("eric <eay\@cryptsoft.com>"); &comment(""); Loading crypto/perlasm/x86unix.pl +33 −25 Original line number Diff line number Diff line #!/usr/local/bin/perl package x86unix; package x86unix; # GAS actually... $label="L000"; $const=""; $constl=0; $align=($main'aout)?"4":"16"; $under=($main'aout)?"_":""; $com_start=($main'sol)?"/":"#"; $under=($main'aout or $main'coff)?"_":""; $com_start="#" if ($main'aout or $main'coff); sub main'asm_init_output { @out=(); } sub main'asm_get_output { return(@out); } Loading Loading @@ -322,8 +322,6 @@ sub main'file local($tmp)=<<"EOF"; .file "$file.s" .version "01.01" gcc2_compiled.: EOF push(@out,$tmp); } Loading @@ -342,10 +340,12 @@ sub main'function_begin EOF push(@out,$tmp); if ($main'cpp) { $tmp=push(@out,"\tTYPE($func,\@function)\n"); } elsif ($main'gaswin) { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } else { $tmp=push(@out,"\t.type\t$func,\@function\n"); } { $tmp=push(@out,"TYPE($func,\@function)\n"); } elsif ($main'coff) { $tmp=push(@out,".def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } elsif ($main'aout) { } else { $tmp=push(@out,".type\t$func,\@function\n"); } push(@out,"$func:\n"); $tmp=<<"EOF"; pushl %ebp Loading @@ -372,10 +372,12 @@ sub main'function_begin_B EOF push(@out,$tmp); if ($main'cpp) { push(@out,"\tTYPE($func,\@function)\n"); } elsif ($main'gaswin) { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } else { push(@out,"\t.type $func,\@function\n"); } { push(@out,"TYPE($func,\@function)\n"); } elsif ($main'coff) { $tmp=push(@out,".def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } elsif ($main'aout) { } else { push(@out,".type $func,\@function\n"); } push(@out,"$func:\n"); $stack=4; } Loading @@ -397,10 +399,10 @@ EOF push(@out,$tmp); if ($main'cpp) { push(@out,"\tSIZE($func,.L_${func}_end-$func)\n"); } elsif ($main'gaswin) { $tmp=push(@out,"\t.align 4\n"); } else { push(@out,"\t.size\t$func,.L_${func}_end-$func\n"); } { push(@out,"SIZE($func,.L_${func}_end-$func)\n"); } elsif ($main'coff or $main'aout) { $tmp=push(@out,".align $align\n"); } else { push(@out,".size\t$func,.L_${func}_end-$func\n"); } push(@out,".ident \"$func\"\n"); $stack=0; %label=(); Loading Loading @@ -428,10 +430,10 @@ sub main'function_end_B push(@out,".L_${func}_end:\n"); if ($main'cpp) { push(@out,"\tSIZE($func,.L_${func}_end-$func)\n"); } elsif ($main'gaswin) { push(@out,"\t.align 4\n"); } else { push(@out,"\t.size\t$func,.L_${func}_end-$func\n"); } { push(@out,"SIZE($func,.L_${func}_end-$func)\n"); } elsif ($main'coff or $main'aout) { push(@out,".align $align\n"); } else { push(@out,".size\t$func,.L_${func}_end-$func\n"); } push(@out,".ident \"$func\"\n"); $stack=0; %label=(); Loading Loading @@ -473,6 +475,7 @@ sub main'swtmp sub main'comment { return if (!defined($com_start); if ($main'elf) # GNU and SVR4 as'es use different comment delimiters, { # so we just skip comments... push(@out,"\n"); Loading Loading @@ -571,7 +574,13 @@ sub main'data_word sub main'align { push(@out,".align $_[0]\n"); my $val=$_[0],$p2,$i; if ($main'aout) { for ($p2=0;$val!=0;$val>>=1) { $p2++; } $val=$p2-1; $val.=",0x90"; } push(@out,".align $val\n"); } # debug output functions: puts, putx, printf Loading Loading @@ -666,7 +675,6 @@ ___ } elsif ($main'pic && ($main'elf || $main'aout)) { push(@out,"\t.align\t4\n"); &main'call(&main'label("PIC_me_up")); &main'set_label("PIC_me_up"); &main'blindpop($dst); Loading Loading
crypto/perlasm/x86asm.pl +7 −10 Original line number Diff line number Diff line Loading @@ -18,15 +18,13 @@ sub main'asm_init ($type,$fn,$i386)=@_; $filename=$fn; $elf=$cpp=$sol=$aout=$win32=$gaswin=$netware=0; $elf=$cpp=$coff=$aout=$win32=$netware=0; if ( ($type eq "elf")) { $elf=1; require "x86unix.pl"; } elsif ( ($type eq "a.out")) { $aout=1; require "x86unix.pl"; } elsif ( ($type eq "gaswin")) { $gaswin=1; $aout=1; require "x86unix.pl"; } elsif ( ($type eq "sol")) { $sol=1; require "x86unix.pl"; } elsif ( ($type eq "coff" or $type eq "gaswin")) { $coff=1; require "x86unix.pl"; } elsif ( ($type eq "cpp")) { $cpp=1; require "x86unix.pl"; } elsif ( ($type eq "win32")) Loading @@ -41,10 +39,9 @@ sub main'asm_init { print STDERR <<"EOF"; Pick one target type from elf - linux, FreeBSD etc a.out - old linux sol - x86 solaris cpp - format so x86unix.cpp can be used elf - Linux, FreeBSD, Solaris x86, etc. a.out - OpenBSD, DJGPP, etc. coff - GAS/COFF such as Win32 targets win32 - Windows 95/Windows NT win32n - Windows 95/Windows NT NASM format nw-nasm - NetWare NASM format Loading @@ -61,7 +58,7 @@ EOF &comment("Don't even think of reading this code"); &comment("It was automatically generated by $filename"); &comment("Which is a perl program used to generate the x86 assember for"); &comment("any of elf, a.out, BSDI, Win32, gaswin (for GNU as on Win32) or Solaris"); &comment("any of ELF, a.out, COFF, Win32, ..."); &comment("eric <eay\@cryptsoft.com>"); &comment(""); Loading
crypto/perlasm/x86unix.pl +33 −25 Original line number Diff line number Diff line #!/usr/local/bin/perl package x86unix; package x86unix; # GAS actually... $label="L000"; $const=""; $constl=0; $align=($main'aout)?"4":"16"; $under=($main'aout)?"_":""; $com_start=($main'sol)?"/":"#"; $under=($main'aout or $main'coff)?"_":""; $com_start="#" if ($main'aout or $main'coff); sub main'asm_init_output { @out=(); } sub main'asm_get_output { return(@out); } Loading Loading @@ -322,8 +322,6 @@ sub main'file local($tmp)=<<"EOF"; .file "$file.s" .version "01.01" gcc2_compiled.: EOF push(@out,$tmp); } Loading @@ -342,10 +340,12 @@ sub main'function_begin EOF push(@out,$tmp); if ($main'cpp) { $tmp=push(@out,"\tTYPE($func,\@function)\n"); } elsif ($main'gaswin) { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } else { $tmp=push(@out,"\t.type\t$func,\@function\n"); } { $tmp=push(@out,"TYPE($func,\@function)\n"); } elsif ($main'coff) { $tmp=push(@out,".def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } elsif ($main'aout) { } else { $tmp=push(@out,".type\t$func,\@function\n"); } push(@out,"$func:\n"); $tmp=<<"EOF"; pushl %ebp Loading @@ -372,10 +372,12 @@ sub main'function_begin_B EOF push(@out,$tmp); if ($main'cpp) { push(@out,"\tTYPE($func,\@function)\n"); } elsif ($main'gaswin) { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } else { push(@out,"\t.type $func,\@function\n"); } { push(@out,"TYPE($func,\@function)\n"); } elsif ($main'coff) { $tmp=push(@out,".def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } elsif ($main'aout) { } else { push(@out,".type $func,\@function\n"); } push(@out,"$func:\n"); $stack=4; } Loading @@ -397,10 +399,10 @@ EOF push(@out,$tmp); if ($main'cpp) { push(@out,"\tSIZE($func,.L_${func}_end-$func)\n"); } elsif ($main'gaswin) { $tmp=push(@out,"\t.align 4\n"); } else { push(@out,"\t.size\t$func,.L_${func}_end-$func\n"); } { push(@out,"SIZE($func,.L_${func}_end-$func)\n"); } elsif ($main'coff or $main'aout) { $tmp=push(@out,".align $align\n"); } else { push(@out,".size\t$func,.L_${func}_end-$func\n"); } push(@out,".ident \"$func\"\n"); $stack=0; %label=(); Loading Loading @@ -428,10 +430,10 @@ sub main'function_end_B push(@out,".L_${func}_end:\n"); if ($main'cpp) { push(@out,"\tSIZE($func,.L_${func}_end-$func)\n"); } elsif ($main'gaswin) { push(@out,"\t.align 4\n"); } else { push(@out,"\t.size\t$func,.L_${func}_end-$func\n"); } { push(@out,"SIZE($func,.L_${func}_end-$func)\n"); } elsif ($main'coff or $main'aout) { push(@out,".align $align\n"); } else { push(@out,".size\t$func,.L_${func}_end-$func\n"); } push(@out,".ident \"$func\"\n"); $stack=0; %label=(); Loading Loading @@ -473,6 +475,7 @@ sub main'swtmp sub main'comment { return if (!defined($com_start); if ($main'elf) # GNU and SVR4 as'es use different comment delimiters, { # so we just skip comments... push(@out,"\n"); Loading Loading @@ -571,7 +574,13 @@ sub main'data_word sub main'align { push(@out,".align $_[0]\n"); my $val=$_[0],$p2,$i; if ($main'aout) { for ($p2=0;$val!=0;$val>>=1) { $p2++; } $val=$p2-1; $val.=",0x90"; } push(@out,".align $val\n"); } # debug output functions: puts, putx, printf Loading Loading @@ -666,7 +675,6 @@ ___ } elsif ($main'pic && ($main'elf || $main'aout)) { push(@out,"\t.align\t4\n"); &main'call(&main'label("PIC_me_up")); &main'set_label("PIC_me_up"); &main'blindpop($dst); Loading