Support for .asciz directive in perlasm modules.
authorAndy Polyakov <appro@openssl.org>
Tue, 17 Oct 2006 06:43:11 +0000 (06:43 +0000)
committerAndy Polyakov <appro@openssl.org>
Tue, 17 Oct 2006 06:43:11 +0000 (06:43 +0000)
crypto/perlasm/ppc-xlate.pl
crypto/perlasm/x86_64-xlate.pl
crypto/perlasm/x86asm.pl

index bedaa99cb46ad064775b82cd9d3a4d4a5dc72a23..e36b5aedb257770a9d6d0a707a794457bb749d95 100755 (executable)
@@ -64,6 +64,14 @@ my $machine = sub {
     }
     ".machine  $arch";
 };
+my $asciz = sub {
+    shift;
+    my $line = join(",",@_);
+    if ($line =~ /^"(.*)"$/)
+    {  ".byte  " . join(",",unpack("C*",$1),0);        }
+    else
+    {  "";     }
+};
 
 ################################################################
 # simplified mnemonics not handled by at least one assembler
index b158f72971a1678be7dd3cb0f1f51ff76f100e7a..4370a97b6af2c2552ee7c675b3bb540a07c29589 100755 (executable)
@@ -323,6 +323,8 @@ my $current_function;
                $line =~ s/\@function.*/\@function/;
                if ($line =~ /\.picmeup\s+(%r[\w]+)/i) {
                    $self->{value} = sprintf "\t.long\t0x%x,0x90000000",$opcode{$1};
+               } elsif ($line =~ /\.asciz\s+"(.*)"$/) {
+                   $self->{value} = ".byte\t".join(",",unpack("C*",$1),0);
                } else {
                    $self->{value} = $line;
                }
@@ -378,6 +380,12 @@ my $current_function;
                /\.picmeup/ && do { $self->{value} = sprintf"\tDD\t 0%Xh,090000000h",$opcode{$line};
                                    last;
                                  };
+               /\.asciz/   && do { if ($line =~ /^"(.*)"$/) {
+                                       $self->{value} = "DB\t"
+                                               .join(",",unpack("C*",$1),0);
+                                   }
+                                   last;
+                                 };
            }
            $line = "";
        }
index 24f21e17ee70fa45fe649893816ccfa514166869..7a08dbfdc56c429cdb27c1bba6b36976584c10d1 100644 (file)
@@ -94,6 +94,8 @@ sub ::function_end_A
     $stack+=16;        # readjust esp as if we didn't pop anything
 }
 
+sub ::asciz {   foreach (@_) { &data_byte(unpack("C*",$_[0]),0); }   }
+
 sub ::asm_finish
 {   &file_end();
     print @out;