From 270fa8aedae8595f9c95a03f019b69cffc31baee Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Sat, 14 Dec 2002 17:54:30 +0000 Subject: [PATCH] DES PIC-ification. Windows companion. --- crypto/perlasm/x86ms.pl | 7 +++++-- crypto/perlasm/x86nasm.pl | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/crypto/perlasm/x86ms.pl b/crypto/perlasm/x86ms.pl index 5229afeb64..abcb7c1303 100644 --- a/crypto/perlasm/x86ms.pl +++ b/crypto/perlasm/x86ms.pl @@ -92,6 +92,8 @@ sub get_mem $addr="_$addr"; } + if ($addr =~ /^.+\-.+$/) { $addr="($addr)"; } + $reg1="$regs{$reg1}" if defined($regs{$reg1}); $reg2="$regs{$reg2}" if defined($regs{$reg2}); if (($addr ne "") && ($addr ne 0)) @@ -111,6 +113,7 @@ sub get_mem { $ret.="[$reg1$post]" } + $ret =~ s/\[\]//; # in case $addr was the only argument return($ret); } @@ -151,7 +154,7 @@ sub main'push { &out1("push",@_); $stack+=4; } sub main'pop { &out1("pop",@_); $stack-=4; } sub main'bswap { &out1("bswap",@_); &using486(); } sub main'not { &out1("not",@_); } -sub main'call { &out1("call",'_'.$_[0]); } +sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); } sub main'ret { &out0("ret"); } sub main'nop { &out0("nop"); } @@ -338,7 +341,7 @@ sub main'set_label { if (!defined($label{$_[0]})) { - $label{$_[0]}="${label}${_[0]}"; + $label{$_[0]}="\$${label}${_[0]}"; $label++; } if((defined $_[2]) && ($_[2] == 1)) diff --git a/crypto/perlasm/x86nasm.pl b/crypto/perlasm/x86nasm.pl index 819151c6bc..85cb3885ec 100644 --- a/crypto/perlasm/x86nasm.pl +++ b/crypto/perlasm/x86nasm.pl @@ -98,6 +98,8 @@ sub get_mem $addr="_$addr"; } + if ($addr =~ /^.+\-.+$/) { $addr="($addr)"; } + $reg1="$regs{$reg1}" if defined($regs{$reg1}); $reg2="$regs{$reg2}" if defined($regs{$reg2}); if (($addr ne "") && ($addr ne 0)) @@ -117,6 +119,7 @@ sub get_mem { $ret.="$reg1$post]" } + $ret =~ s/\+\]/]/; # in case $addr was the only argument return($ret); } @@ -160,7 +163,7 @@ sub main'push { &out1("push",@_); $stack+=4; } sub main'pop { &out1("pop",@_); $stack-=4; } sub main'bswap { &out1("bswap",@_); &using486(); } sub main'not { &out1("not",@_); } -sub main'call { &out1("call",'_'.$_[0]); } +sub main'call { &out1("call",($_[0]=~/^\.L/?'':'_').$_[0]); } sub main'ret { &out0("ret"); } sub main'nop { &out0("nop"); } @@ -312,7 +315,7 @@ sub main'label { if (!defined($label{$_[0]})) { - $label{$_[0]}="\$${label}${_[0]}"; + $label{$_[0]}=".${label}${_[0]}"; $label++; } return($label{$_[0]}); @@ -322,7 +325,7 @@ sub main'set_label { if (!defined($label{$_[0]})) { - $label{$_[0]}="${label}${_[0]}"; + $label{$_[0]}=".${label}${_[0]}"; $label++; } push(@out,"$label{$_[0]}:\n"); -- 2.25.1