A switch to x86unix.pl to optionally generate 80386 code.

Index: x86asm.pl
===================================================================
RCS file: /e/openssl/cvs/openssl/crypto/perlasm/x86asm.pl,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 x86asm.pl
--- x86asm.pl   1998/12/21 10:55:30     1.1.1.1
+++ x86asm.pl   1999/03/30 01:31:14
@@ -18,6 +18,11 @@
        ($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 @@
        else
                {
                print STDERR <<"EOF";
+Usage: $filename <target> [386]
+
 Pick one target type from
        elf     - linux, FreeBSD etc
        a.out   - old linux
Index: x86unix.pl
===================================================================
RCS file: /e/openssl/cvs/openssl/crypto/perlasm/x86unix.pl,v
retrieving revision 1.2
diff -u -r1.2 x86unix.pl
--- x86unix.pl  1999/03/07 15:07:59     1.2
+++ x86unix.pl  1999/03/30 01:31:38
@@ -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,11 +152,26 @@
 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
        {
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to