From 0f247decd0d29c92afa404791daac75c58b5db3b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ulf=20M=C3=B6ller?= Date: Tue, 30 Mar 1999 12:49:36 +0000 Subject: [PATCH] New switch "386" to generate 80386 code (emulate bswap). --- crypto/perlasm/x86asm.pl | 7 +++++++ crypto/perlasm/x86unix.pl | 23 ++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/crypto/perlasm/x86asm.pl b/crypto/perlasm/x86asm.pl index d62c9bc9ee..b35dd1bc53 100644 --- a/crypto/perlasm/x86asm.pl +++ b/crypto/perlasm/x86asm.pl @@ -18,6 +18,11 @@ sub main'asm_init ($type,$fn)=@_; $filename=$fn; + if ($ARGV[$#ARGV] eq "386") + { + $i386=1; + } + $cpp=$sol=$aout=$win32=0; if ( ($type eq "elf")) { require "x86unix.pl"; } @@ -32,6 +37,8 @@ sub main'asm_init else { print STDERR <<"EOF"; +Usage: $filename [386] + Pick one target type from elf - linux, FreeBSD etc a.out - old linux diff --git a/crypto/perlasm/x86unix.pl b/crypto/perlasm/x86unix.pl index efaef87a0b..bc9e42e4e7 100644 --- a/crypto/perlasm/x86unix.pl +++ b/crypto/perlasm/x86unix.pl @@ -1,11 +1,5 @@ #!/usr/local/bin/perl -# Because the bswapl instruction is not supported for old assembers -# (it was a new instruction for the 486), I've added .byte xxxx code -# to put it in. -# eric 24-Apr-1998 -# - package x86unix; $label="L000"; @@ -158,12 +152,27 @@ sub main'dec { &out1("decl",@_); } sub main'inc { &out1("incl",@_); } sub main'push { &out1("pushl",@_); $stack+=4; } sub main'pop { &out1("popl",@_); $stack-=4; } -sub main'bswap { &out1("bswapl",@_); } sub main'not { &out1("notl",@_); } sub main'call { &out1("call",$under.$_[0]); } sub main'ret { &out0("ret"); } sub main'nop { &out0("nop"); } +# The bswapl instruction is new for the 486. Emulate if i386. +sub main'bswap + { + if ($main'i386) + { + &main'comment("bswapl @_"); + &main'exch(main'HB(@_),main'LB(@_)); + &main'rotr(@_,16); + &main'exch(main'HB(@_),main'LB(@_)); + } + else + { + &out1("bswapl",@_); + } + } + sub out2 { local($name,$p1,$p2)=@_; -- 2.34.1