perlasm: update from HEAD.
authorAndy Polyakov <appro@openssl.org>
Tue, 5 May 2009 19:21:12 +0000 (19:21 +0000)
committerAndy Polyakov <appro@openssl.org>
Tue, 5 May 2009 19:21:12 +0000 (19:21 +0000)
crypto/perlasm/x86_64-xlate.pl
crypto/perlasm/x86masm.pl

index 131109d84950ebf74f04de9c46b76e16e62d84e1..c09c3216add8c9f12d7a5b788d0893e88a3faf5c 100755 (executable)
@@ -575,8 +575,8 @@ my %globals;
                                    my @arr = split(',',$line);
                                    my $last = pop(@arr);
                                    my $conv = sub  {   my $var=shift;
-                                                       $var=~s/(0b[0-1]+)/oct($1)/eig;
-                                                       $var=~s/0x([0-9a-f]+)/0$1h/ig if ($masm);
+                                                       $var=~s/^(0b[0-1]+)/oct($1)/eig;
+                                                       $var=~s/^0x([0-9a-f]+)/0$1h/ig if ($masm);
                                                        if ($sz eq "D" && ($current_segment=~/.[px]data/ || $dir eq ".rva"))
                                                        { $var=~s/([_a-z\$\@][_a-z0-9\$\@]*)/$nasm?"$1 wrt ..imagebase":"imagerel $1"/egi; }
                                                        $var;
@@ -662,6 +662,7 @@ while($line=<>) {
                $insn = $opcode->out($#args>=1?$args[$#args]->size():$sz);
            } else {
                $insn = $opcode->out();
+               $insn .= $sz if (map($_->out() =~ /xmm|mmx/,@args));
                @args = reverse(@args);
                undef $sz if ($nasm && $opcode->mnemonic() eq "lea");
            }
@@ -831,6 +832,7 @@ close STDOUT;
 #      CONTEXT.R14                             232
 #      CONTEXT.R15                             240
 #      CONTEXT.Rip                             248
+#      CONTEXT.Xmm6                            512
 #      sizeof(CONTEXT)                         1232
 #      DISPATCHER_CONTEXT.ControlPc            0
 #      DISPATCHER_CONTEXT.ImageBase            8
index 4eca7bc367f04ad22a286d90afc93430b7101a29..30774f0a25085c0d5945dd4710234cad0baccb45 100644 (file)
@@ -16,9 +16,11 @@ sub ::generic
     # fix hexadecimal constants
     for (@arg) { s/0x([0-9a-f]+)/0$1h/oi; }
 
-    # fix xmm references
-    $arg[0] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[1]=~/\bxmm[0-7]\b/i);
-    $arg[1] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[0]=~/\bxmm[0-7]\b/i);
+    if ($opcode !~ /movq/)
+    {  # fix xmm references
+       $arg[0] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[1]=~/\bxmm[0-7]\b/i);
+       $arg[1] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[0]=~/\bxmm[0-7]\b/i);
+    }
 
     &::emit($opcode,@arg);
   1;