summaryrefslogtreecommitdiffstats
path: root/crypto/perlasm
diff options
context:
space:
mode:
authorUlf Möller <ulf@openssl.org>2000-12-05 05:10:05 +0000
committerUlf Möller <ulf@openssl.org>2000-12-05 05:10:05 +0000
commitb50118ca3e1d66a32f96b515b43620e0962558be (patch)
treedad5e7042bbeedba5b0eedef0929e6d3516351d2 /crypto/perlasm
parenta57ecb95f6e22274610c0e313804cbbdfe346c29 (diff)
save registers in the debug output code (return value is overwritten too)
Diffstat (limited to 'crypto/perlasm')
-rw-r--r--crypto/perlasm/x86unix.pl24
1 files changed, 23 insertions, 1 deletions
diff --git a/crypto/perlasm/x86unix.pl b/crypto/perlasm/x86unix.pl
index 560da0a708..51494e2a44 100644
--- a/crypto/perlasm/x86unix.pl
+++ b/crypto/perlasm/x86unix.pl
@@ -464,23 +464,29 @@ sub main'data_word
push(@out,"\t.long $_[0]\n");
}
+# debug output functions: puts, putx, printf
+
sub main'puts
{
+ &pushvars();
&main'push('$Lstring' . ++$constl);
&main'call('puts');
$stack-=4;
&main'add("esp",4);
+ &popvars();
$const .= "Lstring$constl:\n\t.string \"@_[0]\"\n";
}
sub main'putx
{
+ &pushvars();
&main'push($_[0]);
&main'push('$Lstring' . ++$constl);
&main'call('printf');
$stack-=8;
&main'add("esp",8);
+ &popvars();
$const .= "Lstring$constl:\n\t.string \"\%X\"\n";
}
@@ -488,6 +494,7 @@ sub main'putx
sub main'printf
{
$ostack = $stack;
+ &pushvars();
for ($i = @_ - 1; $i >= 0; $i--)
{
$constl++;
@@ -509,6 +516,21 @@ sub main'printf
}
}
&main'call('printf');
- $stack=$ostack;
+ $stack-=4*@_;
+ &popvars();
&main'add("esp",4*@_);
}
+
+sub pushvars
+ {
+ &main'push("edx");
+ &main'push("ecx");
+ &main'push("eax");
+ }
+
+sub popvars
+ {
+ &main'pop("eax");
+ &main'pop("ecx");
+ &main'pop("edx");
+ }