]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Merge r1740 (Tolerate redundant REX.W prefix produced by Mono for
authorJulian Seward <jseward@acm.org>
Sun, 29 Apr 2007 10:07:20 +0000 (10:07 +0000)
committerJulian Seward <jseward@acm.org>
Sun, 29 Apr 2007 10:07:20 +0000 (10:07 +0000)
'fsqrt' (a lame kludge).)

git-svn-id: svn://svn.valgrind.org/vex/branches/VEX_3_2_BRANCH@1754

VEX/priv/guest-amd64/toIR.c

index a717ab3e943a36f8ee70a86b5d10f8f2931089bb..9265a251345201db048c365c209de598d46c60e3 100644 (file)
@@ -12363,9 +12363,21 @@ DisResult disInstr_AMD64_WRK (
    case 0xDC:
    case 0xDD:
    case 0xDE:
-   case 0xDF:
-      if (haveF2orF3(pfx)) goto decode_failure;
-      if (sz == 4 && haveNo66noF2noF3(pfx)) {
+   case 0xDF: {
+      Bool redundantREXWok = False;
+
+      if (haveF2orF3(pfx)) 
+         goto decode_failure;
+
+      /* kludge to tolerate redundant rex.w prefixes (should do this
+         properly one day) */
+      /* mono 1.1.18.1 produces 48 D9 FA, which is rex.w fsqrt */
+      if ( (opc == 0xD9 && getUChar(delta+0) == 0xFA)/*fsqrt*/ )
+         redundantREXWok = True;
+
+      if ( (sz == 4
+           || (sz == 8 && redundantREXWok))
+           && haveNo66noF2noF3(pfx)) {
          Long delta0    = delta;
          Bool decode_OK = False;
          delta = dis_FPU ( &decode_OK, pfx, delta );
@@ -12377,6 +12389,7 @@ DisResult disInstr_AMD64_WRK (
       } else {
          goto decode_failure;
       }
+   }
 
    /* ------------------------ INT ------------------------ */