Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/coregrind/m_main.c valgrind-3.8.1/coregrind/m_main.c
Mark Wielaard ada208
--- valgrind-3.8.1.orig/coregrind/m_main.c	2012-11-04 21:57:03.722415879 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/coregrind/m_main.c	2012-11-04 21:57:37.250896792 +0100
Mark Wielaard ada208
@@ -198,6 +198,7 @@
Mark Wielaard ada208
 "              To use a non-libc malloc library that is\n"
Mark Wielaard ada208
 "                  in the main exe:  --soname-synonyms=somalloc=NONE\n"
Mark Wielaard ada208
 "                  in libxyzzy.so:   --soname-synonyms=somalloc=libxyzzy.so\n"
Mark Wielaard ada208
+"    --sigill-diagnostics=yes|no  warn about illegal instructions? [yes]\n"
Mark Wielaard ada208
 "\n";
Mark Wielaard ada208
 
Mark Wielaard ada208
    Char* usage2 = 
Mark Wielaard ada208
@@ -422,6 +423,10 @@
Mark Wielaard ada208
    Char* log_fsname_unexpanded = NULL;
Mark Wielaard ada208
    Char* xml_fsname_unexpanded = NULL;
Mark Wielaard ada208
 
Mark Wielaard ada208
+   /* Whether the user has explicitly provided --sigill-diagnostics.
Mark Wielaard ada208
+      If not explicitly given depends on general verbosity setting. */
Mark Wielaard ada208
+   Bool sigill_diag_set = False;
Mark Wielaard ada208
+
Mark Wielaard ada208
    /* Log to stderr by default, but usage message goes to stdout.  XML
Mark Wielaard ada208
       output is initially disabled. */
Mark Wielaard ada208
    tmp_log_fd = 2; 
Mark Wielaard ada208
@@ -516,6 +521,9 @@
Mark Wielaard ada208
                VG_STREQ(arg, "--quiet"))
Mark Wielaard ada208
          VG_(clo_verbosity)--;
Mark Wielaard ada208
 
Mark Wielaard ada208
+      else if VG_BOOL_CLO(arg, "--sigill-diagnostics", VG_(clo_sigill_diag))
Mark Wielaard ada208
+         sigill_diag_set = True;
Mark Wielaard ada208
+
Mark Wielaard ada208
       else if VG_BOOL_CLO(arg, "--stats",          VG_(clo_stats)) {}
Mark Wielaard ada208
       else if VG_BOOL_CLO(arg, "--xml",            VG_(clo_xml))
Mark Wielaard ada208
          VG_(debugLog_setXml)(VG_(clo_xml));
Mark Wielaard ada208
@@ -777,6 +785,9 @@
Mark Wielaard ada208
    if (VG_(clo_verbosity) < 0)
Mark Wielaard ada208
       VG_(clo_verbosity) = 0;
Mark Wielaard ada208
 
Mark Wielaard ada208
+   if (!sigill_diag_set)
Mark Wielaard ada208
+      VG_(clo_sigill_diag) = (VG_(clo_verbosity) > 0);
Mark Wielaard ada208
+
Mark Wielaard ada208
    if (VG_(clo_trace_notbelow) == -1) {
Mark Wielaard ada208
      if (VG_(clo_trace_notabove) == -1) {
Mark Wielaard ada208
        /* [] */
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/coregrind/m_main.c.orig valgrind-3.8.1/coregrind/m_main.c.orig
Mark Wielaard ada208
--- valgrind-3.8.1.orig/coregrind/m_main.c.orig	2012-11-04 21:57:03.719415834 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/coregrind/m_main.c.orig	2012-11-04 21:56:19.950788253 +0100
Mark Wielaard ada208
@@ -2537,7 +2537,7 @@
Mark Wielaard ada208
 
Mark Wielaard ada208
    /* terminate gdbserver if ever it was started. We terminate it here so that it get
Mark Wielaard ada208
       the output above if output was redirected to gdb */
Mark Wielaard ada208
-   VG_(gdbserver) (0);
Mark Wielaard ada208
+   VG_(gdbserver_exit) (tid, tids_schedretcode);
Mark Wielaard ada208
 
Mark Wielaard ada208
    /* Ok, finally exit in the os-specific way, according to the scheduler's
Mark Wielaard ada208
       return code.  In short, if the (last) thread exited by calling
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/coregrind/m_options.c valgrind-3.8.1/coregrind/m_options.c
Mark Wielaard ada208
--- valgrind-3.8.1.orig/coregrind/m_options.c	2012-11-04 21:57:03.709415680 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/coregrind/m_options.c	2012-11-04 21:57:37.251896807 +0100
Mark Wielaard ada208
@@ -118,7 +118,7 @@
Mark Wielaard ada208
 VgSmc  VG_(clo_smc_check)      = Vg_SmcStack;
Mark Wielaard ada208
 HChar* VG_(clo_kernel_variant) = NULL;
Mark Wielaard ada208
 Bool   VG_(clo_dsymutil)       = False;
Mark Wielaard ada208
-
Mark Wielaard ada208
+Bool   VG_(clo_sigill_diag)    = True;
Mark Wielaard ada208
 
Mark Wielaard ada208
 /*====================================================================*/
Mark Wielaard ada208
 /*=== File expansion                                               ===*/
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/coregrind/m_scheduler/scheduler.c valgrind-3.8.1/coregrind/m_scheduler/scheduler.c
Mark Wielaard ada208
--- valgrind-3.8.1.orig/coregrind/m_scheduler/scheduler.c	2012-11-04 21:57:03.720415849 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/coregrind/m_scheduler/scheduler.c	2012-11-04 21:57:37.252896823 +0100
Mark Wielaard ada208
@@ -1427,9 +1427,10 @@
Mark Wielaard ada208
       case VEX_TRC_JMP_NODECODE: {
Mark Wielaard ada208
          Addr addr = VG_(get_IP)(tid);
Mark Wielaard ada208
 
Mark Wielaard ada208
-         VG_(umsg)(
Mark Wielaard ada208
-            "valgrind: Unrecognised instruction at address %#lx.\n", addr);
Mark Wielaard ada208
-         VG_(get_and_pp_StackTrace)(tid, VG_(clo_backtrace_size));
Mark Wielaard ada208
+         if (VG_(clo_sigill_diag)) {
Mark Wielaard ada208
+            VG_(umsg)(
Mark Wielaard ada208
+               "valgrind: Unrecognised instruction at address %#lx.\n", addr);
Mark Wielaard ada208
+            VG_(get_and_pp_StackTrace)(tid, VG_(clo_backtrace_size));
Mark Wielaard ada208
 #define M(a) VG_(umsg)(a "\n");
Mark Wielaard ada208
    M("Your program just tried to execute an instruction that Valgrind" );
Mark Wielaard ada208
    M("did not recognise.  There are two possible reasons for this."    );
Mark Wielaard ada208
@@ -1442,6 +1443,7 @@
Mark Wielaard ada208
    M("Either way, Valgrind will now raise a SIGILL signal which will"  );
Mark Wielaard ada208
    M("probably kill your program."                                     );
Mark Wielaard ada208
 #undef M
Mark Wielaard ada208
+         }
Mark Wielaard ada208
 
Mark Wielaard ada208
 #if defined(VGA_s390x)
Mark Wielaard ada208
          /* Now that the complaint is out we need to adjust the guest_IA. The
Mark Wielaard ada208
Only in valgrind-3.8.1/coregrind/m_scheduler: scheduler.c.orig
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/coregrind/m_translate.c valgrind-3.8.1/coregrind/m_translate.c
Mark Wielaard ada208
--- valgrind-3.8.1.orig/coregrind/m_translate.c	2012-11-04 21:57:03.721415864 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/coregrind/m_translate.c	2012-11-04 21:57:37.261896960 +0100
Mark Wielaard ada208
@@ -1524,6 +1524,7 @@
Mark Wielaard ada208
    vta.needs_self_check  = needs_self_check;
Mark Wielaard ada208
    vta.preamble_function = preamble_fn;
Mark Wielaard ada208
    vta.traceflags        = verbosity;
Mark Wielaard ada208
+   vta.sigill_diag       = VG_(clo_sigill_diag);
Mark Wielaard ada208
    vta.addProfInc        = VG_(clo_profile_flags) > 0
Mark Wielaard ada208
                            && kind != T_NoRedir;
Mark Wielaard ada208
 
Mark Wielaard ada208
Only in valgrind-3.8.1/coregrind: m_translate.c.orig
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/coregrind/pub_core_options.h valgrind-3.8.1/coregrind/pub_core_options.h
Mark Wielaard ada208
--- valgrind-3.8.1.orig/coregrind/pub_core_options.h	2012-11-04 21:57:03.704415605 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/coregrind/pub_core_options.h	2012-11-04 21:57:37.300897526 +0100
Mark Wielaard ada208
@@ -275,6 +275,11 @@
Mark Wielaard ada208
 extern Bool VG_(should_we_trace_this_child) ( HChar* child_exe_name,
Mark Wielaard ada208
                                               HChar** child_argv );
Mark Wielaard ada208
 
Mark Wielaard ada208
+/* Whether illegal instructions should be reported/diagnosed.
Mark Wielaard ada208
+   Can be explicitly set through --sigill-diagnostics otherwise
Mark Wielaard ada208
+   depends on verbosity (False if -q). */
Mark Wielaard ada208
+extern Bool VG_(clo_sigill_diag);
Mark Wielaard ada208
+
Mark Wielaard ada208
 #endif   // __PUB_CORE_OPTIONS_H
Mark Wielaard ada208
 
Mark Wielaard ada208
 /*--------------------------------------------------------------------*/
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/docs/xml/manual-core.xml valgrind-3.8.1/docs/xml/manual-core.xml
Mark Wielaard ada208
--- valgrind-3.8.1.orig/docs/xml/manual-core.xml	2012-11-04 21:57:03.689415507 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/docs/xml/manual-core.xml	2012-11-04 21:57:37.302897560 +0100
Mark Wielaard ada208
@@ -1036,6 +1036,26 @@
Mark Wielaard ada208
     </listitem>
Mark Wielaard ada208
   </varlistentry>
Mark Wielaard ada208
 
Mark Wielaard ada208
+  <varlistentry id="opt.sigill-diagnostics" xreflabel="--sigill-diagnostics">
Mark Wielaard ada208
+    <term>
Mark Wielaard ada208
+      <option> [default: yes] ]]></option>
Mark Wielaard ada208
+    </term>
Mark Wielaard ada208
+    <listitem>
Mark Wielaard ada208
+      <para>Enable/disable printing of illegal instruction diagnostics.
Mark Wielaard ada208
+      Enabled by default, but defaults to disabled when
Mark Wielaard ada208
+      <option>--quiet</option> is given. The default can always be explicitly
Mark Wielaard ada208
+      overridden by giving this option.</para>
Mark Wielaard ada208
+
Mark Wielaard ada208
+      <para>When enabled a warning message will be printed with some
Mark Wielaard ada208
+      diagnostics whenever some instruction is encountered that valgrind
Mark Wielaard ada208
+      cannot decode or translate before the program is given a SIGILL signal.
Mark Wielaard ada208
+      Often an illegal instruction indicates a bug in the program or missing
Mark Wielaard ada208
+      support for the particular instruction in Valgrind. But some programs
Mark Wielaard ada208
+      do deliberately try to execute an instruction that might be missing
Mark Wielaard ada208
+      and trap the SIGILL signal to detect processor features.</para>
Mark Wielaard ada208
+    </listitem>
Mark Wielaard ada208
+  </varlistentry>
Mark Wielaard ada208
+
Mark Wielaard ada208
   <varlistentry id="opt.stack-traces" xreflabel="--show-below-main">
Mark Wielaard ada208
     <term>
Mark Wielaard ada208
       <option> [default: no] ]]></option>
Mark Wielaard ada208
Only in valgrind-3.8.1/docs/xml: manual-core.xml.orig
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/none/tests/cmdline1.stdout.exp valgrind-3.8.1/none/tests/cmdline1.stdout.exp
Mark Wielaard ada208
--- valgrind-3.8.1.orig/none/tests/cmdline1.stdout.exp	2012-11-04 21:57:03.844417741 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/none/tests/cmdline1.stdout.exp	2012-11-04 21:57:37.385898730 +0100
Mark Wielaard ada208
@@ -87,6 +87,7 @@
Mark Wielaard ada208
               To use a non-libc malloc library that is
Mark Wielaard ada208
                   in the main exe:  --soname-synonyms=somalloc=NONE
Mark Wielaard ada208
                   in libxyzzy.so:   --soname-synonyms=somalloc=libxyzzy.so
Mark Wielaard ada208
+    --sigill-diagnostics=yes|no  warn about illegal instructions? [yes]
Mark Wielaard ada208
 
Mark Wielaard ada208
   user options for Nulgrind:
Mark Wielaard ada208
     (none)
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/none/tests/cmdline2.stdout.exp valgrind-3.8.1/none/tests/cmdline2.stdout.exp
Mark Wielaard ada208
--- valgrind-3.8.1.orig/none/tests/cmdline2.stdout.exp	2012-11-04 21:57:03.811417238 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/none/tests/cmdline2.stdout.exp	2012-11-04 21:57:37.386898745 +0100
Mark Wielaard ada208
@@ -87,6 +87,7 @@
Mark Wielaard ada208
               To use a non-libc malloc library that is
Mark Wielaard ada208
                   in the main exe:  --soname-synonyms=somalloc=NONE
Mark Wielaard ada208
                   in libxyzzy.so:   --soname-synonyms=somalloc=libxyzzy.so
Mark Wielaard ada208
+    --sigill-diagnostics=yes|no  warn about illegal instructions? [yes]
Mark Wielaard ada208
 
Mark Wielaard ada208
   user options for Nulgrind:
Mark Wielaard ada208
     (none)
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/priv/guest_amd64_defs.h valgrind-3.8.1/VEX/priv/guest_amd64_defs.h
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/priv/guest_amd64_defs.h	2012-11-04 21:57:03.782416795 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/priv/guest_amd64_defs.h	2012-11-04 21:57:36.328883370 +0100
Mark Wielaard ada208
@@ -56,7 +56,8 @@
Mark Wielaard ada208
                            VexArch      guest_arch,
Mark Wielaard ada208
                            VexArchInfo* archinfo,
Mark Wielaard ada208
                            VexAbiInfo*  abiinfo,
Mark Wielaard ada208
-                           Bool         host_bigendian );
Mark Wielaard ada208
+                           Bool         host_bigendian,
Mark Wielaard ada208
+                           Bool         sigill_diag );
Mark Wielaard ada208
 
Mark Wielaard ada208
 /* Used by the optimiser to specialise calls to helpers. */
Mark Wielaard ada208
 extern
Mark Wielaard ada208
Only in valgrind-3.8.1/VEX/priv: guest_amd64_defs.h.orig
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/priv/guest_amd64_toIR.c valgrind-3.8.1/VEX/priv/guest_amd64_toIR.c
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/priv/guest_amd64_toIR.c	2012-11-04 21:57:03.784416825 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/priv/guest_amd64_toIR.c	2012-11-04 21:57:36.465885366 +0100
Mark Wielaard ada208
@@ -30426,7 +30426,8 @@
Mark Wielaard ada208
              void*        callback_opaque,
Mark Wielaard ada208
              Long         delta64,
Mark Wielaard ada208
              VexArchInfo* archinfo,
Mark Wielaard ada208
-             VexAbiInfo*  vbi
Mark Wielaard ada208
+             VexAbiInfo*  vbi,
Mark Wielaard ada208
+             Bool         sigill_diag
Mark Wielaard ada208
           )
Mark Wielaard ada208
 {
Mark Wielaard ada208
    IRTemp    t1, t2, t3, t4, t5, t6;
Mark Wielaard ada208
@@ -30956,29 +30957,31 @@
Mark Wielaard ada208
      //default:
Mark Wielaard ada208
   decode_failure:
Mark Wielaard ada208
    /* All decode failures end up here. */
Mark Wielaard ada208
-   vex_printf("vex amd64->IR: unhandled instruction bytes: "
Mark Wielaard ada208
-              "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
Mark Wielaard ada208
-              (Int)getUChar(delta_start+0),
Mark Wielaard ada208
-              (Int)getUChar(delta_start+1),
Mark Wielaard ada208
-              (Int)getUChar(delta_start+2),
Mark Wielaard ada208
-              (Int)getUChar(delta_start+3),
Mark Wielaard ada208
-              (Int)getUChar(delta_start+4),
Mark Wielaard ada208
-              (Int)getUChar(delta_start+5),
Mark Wielaard ada208
-              (Int)getUChar(delta_start+6),
Mark Wielaard ada208
-              (Int)getUChar(delta_start+7) );
Mark Wielaard ada208
-   vex_printf("vex amd64->IR:   REX=%d REX.W=%d REX.R=%d REX.X=%d REX.B=%d\n",
Mark Wielaard ada208
-              haveREX(pfx) ? 1 : 0, getRexW(pfx), getRexR(pfx),
Mark Wielaard ada208
-              getRexX(pfx), getRexB(pfx));
Mark Wielaard ada208
-   vex_printf("vex amd64->IR:   VEX=%d VEX.L=%d VEX.nVVVV=0x%x ESC=%s\n",
Mark Wielaard ada208
-              haveVEX(pfx) ? 1 : 0, getVexL(pfx),
Mark Wielaard ada208
-              getVexNvvvv(pfx),
Mark Wielaard ada208
-              esc==ESC_NONE ? "NONE" :
Mark Wielaard ada208
-                esc==ESC_0F ? "0F" :
Mark Wielaard ada208
-                esc==ESC_0F38 ? "0F38" :
Mark Wielaard ada208
-                esc==ESC_0F3A ? "0F3A" : "???");
Mark Wielaard ada208
-   vex_printf("vex amd64->IR:   PFX.66=%d PFX.F2=%d PFX.F3=%d\n",
Mark Wielaard ada208
-              have66(pfx) ? 1 : 0, haveF2(pfx) ? 1 : 0,
Mark Wielaard ada208
-              haveF3(pfx) ? 1 : 0);
Mark Wielaard ada208
+   if (sigill_diag) {
Mark Wielaard ada208
+      vex_printf("vex amd64->IR: unhandled instruction bytes: "
Mark Wielaard ada208
+                 "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
Mark Wielaard ada208
+                 (Int)getUChar(delta_start+0),
Mark Wielaard ada208
+                 (Int)getUChar(delta_start+1),
Mark Wielaard ada208
+                 (Int)getUChar(delta_start+2),
Mark Wielaard ada208
+                 (Int)getUChar(delta_start+3),
Mark Wielaard ada208
+                 (Int)getUChar(delta_start+4),
Mark Wielaard ada208
+                 (Int)getUChar(delta_start+5),
Mark Wielaard ada208
+                 (Int)getUChar(delta_start+6),
Mark Wielaard ada208
+                 (Int)getUChar(delta_start+7) );
Mark Wielaard ada208
+      vex_printf("vex amd64->IR:   REX=%d REX.W=%d REX.R=%d REX.X=%d REX.B=%d\n",
Mark Wielaard ada208
+                 haveREX(pfx) ? 1 : 0, getRexW(pfx), getRexR(pfx),
Mark Wielaard ada208
+                 getRexX(pfx), getRexB(pfx));
Mark Wielaard ada208
+      vex_printf("vex amd64->IR:   VEX=%d VEX.L=%d VEX.nVVVV=0x%x ESC=%s\n",
Mark Wielaard ada208
+                 haveVEX(pfx) ? 1 : 0, getVexL(pfx),
Mark Wielaard ada208
+                 getVexNvvvv(pfx),
Mark Wielaard ada208
+                 esc==ESC_NONE ? "NONE" :
Mark Wielaard ada208
+                   esc==ESC_0F ? "0F" :
Mark Wielaard ada208
+                   esc==ESC_0F38 ? "0F38" :
Mark Wielaard ada208
+                   esc==ESC_0F3A ? "0F3A" : "???");
Mark Wielaard ada208
+      vex_printf("vex amd64->IR:   PFX.66=%d PFX.F2=%d PFX.F3=%d\n",
Mark Wielaard ada208
+                 have66(pfx) ? 1 : 0, haveF2(pfx) ? 1 : 0,
Mark Wielaard ada208
+                 haveF3(pfx) ? 1 : 0);
Mark Wielaard ada208
+   }
Mark Wielaard ada208
 
Mark Wielaard ada208
    /* Tell the dispatcher that this insn cannot be decoded, and so has
Mark Wielaard ada208
       not been executed, and (is currently) the next to be executed.
Mark Wielaard ada208
@@ -31041,7 +31044,8 @@
Mark Wielaard ada208
                            VexArch      guest_arch,
Mark Wielaard ada208
                            VexArchInfo* archinfo,
Mark Wielaard ada208
                            VexAbiInfo*  abiinfo,
Mark Wielaard ada208
-                           Bool         host_bigendian_IN )
Mark Wielaard ada208
+                           Bool         host_bigendian_IN,
Mark Wielaard ada208
+                           Bool         sigill_diag_IN )
Mark Wielaard ada208
 {
Mark Wielaard ada208
    Int       i, x1, x2;
Mark Wielaard ada208
    Bool      expect_CAS, has_CAS;
Mark Wielaard ada208
@@ -31064,7 +31068,7 @@
Mark Wielaard ada208
    dres = disInstr_AMD64_WRK ( &expect_CAS, resteerOkFn,
Mark Wielaard ada208
                                resteerCisOk,
Mark Wielaard ada208
                                callback_opaque,
Mark Wielaard ada208
-                               delta, archinfo, abiinfo );
Mark Wielaard ada208
+                               delta, archinfo, abiinfo, sigill_diag_IN );
Mark Wielaard ada208
    x2 = irsb_IN->stmts_used;
Mark Wielaard ada208
    vassert(x2 >= x1);
Mark Wielaard ada208
 
Mark Wielaard ada208
@@ -31097,7 +31101,7 @@
Mark Wielaard ada208
       dres = disInstr_AMD64_WRK ( &expect_CAS, resteerOkFn,
Mark Wielaard ada208
                                   resteerCisOk,
Mark Wielaard ada208
                                   callback_opaque,
Mark Wielaard ada208
-                                  delta, archinfo, abiinfo );
Mark Wielaard ada208
+                                  delta, archinfo, abiinfo, sigill_diag_IN );
Mark Wielaard ada208
       for (i = x1; i < x2; i++) {
Mark Wielaard ada208
          vex_printf("\t\t");
Mark Wielaard ada208
          ppIRStmt(irsb_IN->stmts[i]);
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/priv/guest_amd64_toIR.c.orig valgrind-3.8.1/VEX/priv/guest_amd64_toIR.c.orig
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/priv/guest_amd64_toIR.c.orig	2012-11-04 21:57:03.788416887 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/priv/guest_amd64_toIR.c.orig	2012-11-04 21:56:20.017789271 +0100
Mark Wielaard ada208
@@ -20986,6 +20986,14 @@
Mark Wielaard ada208
       delta = dis_movx_E_G ( vbi, pfx, delta, 2, sz, True );
Mark Wielaard ada208
       return delta;
Mark Wielaard ada208
 
Mark Wielaard ada208
+   case 0xC0: { /* XADD Gb,Eb */ 
Mark Wielaard ada208
+      Bool decode_OK = False;
Mark Wielaard ada208
+      delta = dis_xadd_G_E ( &decode_OK, vbi, pfx, 1, delta );
Mark Wielaard ada208
+      if (!decode_OK)
Mark Wielaard ada208
+         goto decode_failure;
Mark Wielaard ada208
+      return delta;
Mark Wielaard ada208
+   }
Mark Wielaard ada208
+
Mark Wielaard ada208
    case 0xC1: { /* XADD Gv,Ev */ 
Mark Wielaard ada208
       Bool decode_OK = False;
Mark Wielaard ada208
       delta = dis_xadd_G_E ( &decode_OK, vbi, pfx, sz, delta );
Mark Wielaard ada208
@@ -30932,14 +30940,6 @@
Mark Wielaard ada208
 
Mark Wielaard ada208
       /* =-=-=-=-=-=-=-=-=- XADD -=-=-=-=-=-=-=-=-=-= */
Mark Wielaard ada208
 
Mark Wielaard ada208
-      case 0xC0: { /* XADD Gb,Eb */ 
Mark Wielaard ada208
-         Bool decode_OK = False;
Mark Wielaard ada208
-         delta = dis_xadd_G_E ( &decode_OK, vbi, pfx, 1, delta );
Mark Wielaard ada208
-         if (!decode_OK)
Mark Wielaard ada208
-            goto decode_failure;
Mark Wielaard ada208
-         break;
Mark Wielaard ada208
-      }
Mark Wielaard ada208
-
Mark Wielaard ada208
       /* =-=-=-=-=-=-=-=-=- SGDT and SIDT =-=-=-=-=-=-=-=-=-=-= */
Mark Wielaard ada208
 
Mark Wielaard ada208
       /* =-=-=-=-=-=-=-=-=- unimp2 =-=-=-=-=-=-=-=-=-=-= */
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/priv/guest_arm_defs.h valgrind-3.8.1/VEX/priv/guest_arm_defs.h
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/priv/guest_arm_defs.h	2012-11-04 21:57:03.790416917 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/priv/guest_arm_defs.h	2012-11-04 21:57:36.588887153 +0100
Mark Wielaard ada208
@@ -50,7 +50,8 @@
Mark Wielaard ada208
                          VexArch      guest_arch,
Mark Wielaard ada208
                          VexArchInfo* archinfo,
Mark Wielaard ada208
                          VexAbiInfo*  abiinfo,
Mark Wielaard ada208
-                         Bool         host_bigendian );
Mark Wielaard ada208
+                         Bool         host_bigendian,
Mark Wielaard ada208
+                         Bool         sigill_diag );
Mark Wielaard ada208
 
Mark Wielaard ada208
 /* Used by the optimiser to specialise calls to helpers. */
Mark Wielaard ada208
 extern
Mark Wielaard ada208
Only in valgrind-3.8.1/VEX/priv: guest_arm_defs.h.orig
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/priv/guest_arm_toIR.c valgrind-3.8.1/VEX/priv/guest_arm_toIR.c
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/priv/guest_arm_toIR.c	2012-11-04 21:57:03.787416871 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/priv/guest_arm_toIR.c	2012-11-04 21:57:36.812890419 +0100
Mark Wielaard ada208
@@ -12564,7 +12564,8 @@
Mark Wielaard ada208
              void*        callback_opaque,
Mark Wielaard ada208
              UChar*       guest_instr,
Mark Wielaard ada208
              VexArchInfo* archinfo,
Mark Wielaard ada208
-             VexAbiInfo*  abiinfo
Mark Wielaard ada208
+             VexAbiInfo*  abiinfo,
Mark Wielaard ada208
+             Bool         sigill_diag
Mark Wielaard ada208
           )
Mark Wielaard ada208
 {
Mark Wielaard ada208
    // A macro to fish bits out of 'insn'.
Mark Wielaard ada208
@@ -14643,15 +14644,17 @@
Mark Wielaard ada208
 
Mark Wielaard ada208
   decode_failure:
Mark Wielaard ada208
    /* All decode failures end up here. */
Mark Wielaard ada208
-   vex_printf("disInstr(arm): unhandled instruction: "
Mark Wielaard ada208
-              "0x%x\n", insn);
Mark Wielaard ada208
-   vex_printf("                 cond=%d(0x%x) 27:20=%u(0x%02x) "
Mark Wielaard ada208
-                                "4:4=%d "
Mark Wielaard ada208
-                                "3:0=%u(0x%x)\n",
Mark Wielaard ada208
-              (Int)INSN_COND, (UInt)INSN_COND,
Mark Wielaard ada208
-              (Int)INSN(27,20), (UInt)INSN(27,20),
Mark Wielaard ada208
-              (Int)INSN(4,4),
Mark Wielaard ada208
-              (Int)INSN(3,0), (UInt)INSN(3,0) );
Mark Wielaard ada208
+   if (sigill_diag) {
Mark Wielaard ada208
+      vex_printf("disInstr(arm): unhandled instruction: "
Mark Wielaard ada208
+                 "0x%x\n", insn);
Mark Wielaard ada208
+      vex_printf("                 cond=%d(0x%x) 27:20=%u(0x%02x) "
Mark Wielaard ada208
+                                   "4:4=%d "
Mark Wielaard ada208
+                                   "3:0=%u(0x%x)\n",
Mark Wielaard ada208
+                 (Int)INSN_COND, (UInt)INSN_COND,
Mark Wielaard ada208
+                 (Int)INSN(27,20), (UInt)INSN(27,20),
Mark Wielaard ada208
+                 (Int)INSN(4,4),
Mark Wielaard ada208
+                 (Int)INSN(3,0), (UInt)INSN(3,0) );
Mark Wielaard ada208
+   }
Mark Wielaard ada208
 
Mark Wielaard ada208
    /* Tell the dispatcher that this insn cannot be decoded, and so has
Mark Wielaard ada208
       not been executed, and (is currently) the next to be executed.
Mark Wielaard ada208
@@ -14760,7 +14763,8 @@
Mark Wielaard ada208
              void*        callback_opaque,
Mark Wielaard ada208
              UChar*       guest_instr,
Mark Wielaard ada208
              VexArchInfo* archinfo,
Mark Wielaard ada208
-             VexAbiInfo*  abiinfo
Mark Wielaard ada208
+             VexAbiInfo*  abiinfo,
Mark Wielaard ada208
+             Bool         sigill_diag
Mark Wielaard ada208
           )
Mark Wielaard ada208
 {
Mark Wielaard ada208
    /* A macro to fish bits out of insn0.  There's also INSN1, to fish
Mark Wielaard ada208
@@ -18746,8 +18750,9 @@
Mark Wielaard ada208
 
Mark Wielaard ada208
   decode_failure:
Mark Wielaard ada208
    /* All decode failures end up here. */
Mark Wielaard ada208
-   vex_printf("disInstr(thumb): unhandled instruction: "
Mark Wielaard ada208
-              "0x%04x 0x%04x\n", (UInt)insn0, (UInt)insn1);
Mark Wielaard ada208
+   if (sigill_diag)
Mark Wielaard ada208
+      vex_printf("disInstr(thumb): unhandled instruction: "
Mark Wielaard ada208
+                 "0x%04x 0x%04x\n", (UInt)insn0, (UInt)insn1);
Mark Wielaard ada208
 
Mark Wielaard ada208
    /* Back up ITSTATE to the initial value for this instruction.
Mark Wielaard ada208
       If we don't do that, any subsequent restart of the instruction
Mark Wielaard ada208
@@ -18892,7 +18897,8 @@
Mark Wielaard ada208
                          VexArch      guest_arch,
Mark Wielaard ada208
                          VexArchInfo* archinfo,
Mark Wielaard ada208
                          VexAbiInfo*  abiinfo,
Mark Wielaard ada208
-                         Bool         host_bigendian_IN )
Mark Wielaard ada208
+                         Bool         host_bigendian_IN,
Mark Wielaard ada208
+                         Bool         sigill_diag_IN )
Mark Wielaard ada208
 {
Mark Wielaard ada208
    DisResult dres;
Mark Wielaard ada208
    Bool isThumb = (Bool)(guest_IP_ENCODED & 1);
Mark Wielaard ada208
@@ -18914,12 +18920,12 @@
Mark Wielaard ada208
       dres = disInstr_THUMB_WRK ( resteerOkFn,
Mark Wielaard ada208
                                   resteerCisOk, callback_opaque,
Mark Wielaard ada208
                                   &guest_code_IN[delta_ENCODED - 1],
Mark Wielaard ada208
-                                  archinfo, abiinfo );
Mark Wielaard ada208
+                                  archinfo, abiinfo, sigill_diag_IN );
Mark Wielaard ada208
    } else {
Mark Wielaard ada208
       dres = disInstr_ARM_WRK ( resteerOkFn,
Mark Wielaard ada208
                                 resteerCisOk, callback_opaque,
Mark Wielaard ada208
                                 &guest_code_IN[delta_ENCODED],
Mark Wielaard ada208
-                                archinfo, abiinfo );
Mark Wielaard ada208
+                                archinfo, abiinfo, sigill_diag_IN );
Mark Wielaard ada208
    }
Mark Wielaard ada208
 
Mark Wielaard ada208
    return dres;
Mark Wielaard ada208
Only in valgrind-3.8.1/VEX/priv: guest_arm_toIR.c.orig
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/priv/guest_generic_bb_to_IR.c valgrind-3.8.1/VEX/priv/guest_generic_bb_to_IR.c
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/priv/guest_generic_bb_to_IR.c	2012-11-04 21:57:03.790416917 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/priv/guest_generic_bb_to_IR.c	2012-11-04 21:57:36.918891974 +0100
Mark Wielaard ada208
@@ -187,6 +187,7 @@
Mark Wielaard ada208
          /*IN*/ Addr64           guest_IP_bbstart,
Mark Wielaard ada208
          /*IN*/ Bool             (*chase_into_ok)(void*,Addr64),
Mark Wielaard ada208
          /*IN*/ Bool             host_bigendian,
Mark Wielaard ada208
+         /*IN*/ Bool             sigill_diag,
Mark Wielaard ada208
          /*IN*/ VexArch          arch_guest,
Mark Wielaard ada208
          /*IN*/ VexArchInfo*     archinfo_guest,
Mark Wielaard ada208
          /*IN*/ VexAbiInfo*      abiinfo_both,
Mark Wielaard ada208
@@ -361,7 +362,8 @@
Mark Wielaard ada208
                             arch_guest,
Mark Wielaard ada208
                             archinfo_guest,
Mark Wielaard ada208
                             abiinfo_both,
Mark Wielaard ada208
-                            host_bigendian );
Mark Wielaard ada208
+                            host_bigendian,
Mark Wielaard ada208
+                            sigill_diag );
Mark Wielaard ada208
 
Mark Wielaard ada208
       /* stay sane ... */
Mark Wielaard ada208
       vassert(dres.whatNext == Dis_StopHere
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/priv/guest_generic_bb_to_IR.h valgrind-3.8.1/VEX/priv/guest_generic_bb_to_IR.h
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/priv/guest_generic_bb_to_IR.h	2012-11-04 21:57:03.790416917 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/priv/guest_generic_bb_to_IR.h	2012-11-04 21:57:36.970892726 +0100
Mark Wielaard ada208
@@ -150,7 +150,10 @@
Mark Wielaard ada208
       /*IN*/  VexAbiInfo*  abiinfo,
Mark Wielaard ada208
 
Mark Wielaard ada208
       /* Is the host bigendian? */
Mark Wielaard ada208
-      /*IN*/  Bool         host_bigendian
Mark Wielaard ada208
+      /*IN*/  Bool         host_bigendian,
Mark Wielaard ada208
+
Mark Wielaard ada208
+      /* Should diagnostics be printed for illegal instructions? */
Mark Wielaard ada208
+      /*IN*/  Bool         sigill_diag
Mark Wielaard ada208
 
Mark Wielaard ada208
    );
Mark Wielaard ada208
 
Mark Wielaard ada208
@@ -171,6 +174,7 @@
Mark Wielaard ada208
          /*IN*/ Addr64           guest_IP_bbstart,
Mark Wielaard ada208
          /*IN*/ Bool             (*chase_into_ok)(void*,Addr64),
Mark Wielaard ada208
          /*IN*/ Bool             host_bigendian,
Mark Wielaard ada208
+         /*IN*/ Bool             sigill_diag,
Mark Wielaard ada208
          /*IN*/ VexArch          arch_guest,
Mark Wielaard ada208
          /*IN*/ VexArchInfo*     archinfo_guest,
Mark Wielaard ada208
          /*IN*/ VexAbiInfo*      abiinfo_both,
Mark Wielaard ada208
Only in valgrind-3.8.1/VEX/priv: guest_generic_bb_to_IR.h.orig
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/priv/guest_mips_defs.h valgrind-3.8.1/VEX/priv/guest_mips_defs.h
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/priv/guest_mips_defs.h	2012-11-04 21:57:03.790416917 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/priv/guest_mips_defs.h	2012-11-04 21:57:36.984892934 +0100
Mark Wielaard ada208
@@ -49,7 +49,8 @@
Mark Wielaard ada208
                                  VexArch      guest_arch,
Mark Wielaard ada208
                                  VexArchInfo* archinfo,
Mark Wielaard ada208
                                  VexAbiInfo*  abiinfo,
Mark Wielaard ada208
-                                 Bool         host_bigendian );
Mark Wielaard ada208
+                                 Bool         host_bigendian,
Mark Wielaard ada208
+                                 Bool         sigill_diag );
Mark Wielaard ada208
 
Mark Wielaard ada208
 /* Used by the optimiser to specialise calls to helpers. */
Mark Wielaard ada208
 extern IRExpr *guest_mips32_spechelper(HChar * function_name, IRExpr ** args,
Mark Wielaard ada208
Only in valgrind-3.8.1/VEX/priv: guest_mips_defs.h.orig
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/priv/guest_mips_toIR.c valgrind-3.8.1/VEX/priv/guest_mips_toIR.c
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/priv/guest_mips_toIR.c	2012-11-04 21:57:03.785416840 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/priv/guest_mips_toIR.c	2012-11-04 21:57:36.986892956 +0100
Mark Wielaard ada208
@@ -1195,7 +1195,8 @@
Mark Wielaard ada208
                                      void*        callback_opaque,
Mark Wielaard ada208
                                      Long         delta64,
Mark Wielaard ada208
                                      VexArchInfo* archinfo,
Mark Wielaard ada208
-                                     VexAbiInfo*  abiinfo )
Mark Wielaard ada208
+                                     VexAbiInfo*  abiinfo,
Mark Wielaard ada208
+                                     Bool         sigill_diag )
Mark Wielaard ada208
 {
Mark Wielaard ada208
    IRTemp t0, t1, t2, t3, t4, t5, t6, t7, t8;
Mark Wielaard ada208
    UInt opcode, cins, rs, rt, rd, sa, ft, fs, fd, fmt, tf, nd, function,
Mark Wielaard ada208
@@ -3399,12 +3400,13 @@
Mark Wielaard ada208
 
Mark Wielaard ada208
  decode_failure:
Mark Wielaard ada208
       /* All decode failures end up here. */
Mark Wielaard ada208
-      DIP("vex mips->IR: unhandled instruction bytes: "
Mark Wielaard ada208
-          "0x%x 0x%x 0x%x 0x%x\n",
Mark Wielaard ada208
-          (Int) getIByte(delta_start + 0),
Mark Wielaard ada208
-          (Int) getIByte(delta_start + 1),
Mark Wielaard ada208
-          (Int) getIByte(delta_start + 2),
Mark Wielaard ada208
-          (Int) getIByte(delta_start + 3));
Mark Wielaard ada208
+      if (sigill_diag)
Mark Wielaard ada208
+         vex_printf("vex mips->IR: unhandled instruction bytes: "
Mark Wielaard ada208
+                    "0x%x 0x%x 0x%x 0x%x\n",
Mark Wielaard ada208
+                    (Int) getIByte(delta_start + 0),
Mark Wielaard ada208
+                    (Int) getIByte(delta_start + 1),
Mark Wielaard ada208
+                    (Int) getIByte(delta_start + 2),
Mark Wielaard ada208
+                    (Int) getIByte(delta_start + 3));
Mark Wielaard ada208
 
Mark Wielaard ada208
       /* Tell the dispatcher that this insn cannot be decoded, and so has
Mark Wielaard ada208
          not been executed, and (is currently) the next to be executed.
Mark Wielaard ada208
@@ -3494,7 +3496,8 @@
Mark Wielaard ada208
               VexArch      guest_arch,
Mark Wielaard ada208
               VexArchInfo* archinfo,
Mark Wielaard ada208
               VexAbiInfo*  abiinfo,
Mark Wielaard ada208
-              Bool         host_bigendian_IN)
Mark Wielaard ada208
+              Bool         host_bigendian_IN,
Mark Wielaard ada208
+              Bool         sigill_diag_IN)
Mark Wielaard ada208
 {
Mark Wielaard ada208
    DisResult dres;
Mark Wielaard ada208
 
Mark Wielaard ada208
@@ -3510,7 +3513,7 @@
Mark Wielaard ada208
    guest_PC_bbstart = (Addr32) toUInt(guest_IP - delta);
Mark Wielaard ada208
 
Mark Wielaard ada208
    dres = disInstr_MIPS_WRK(resteerOkFn, resteerCisOk, callback_opaque,
Mark Wielaard ada208
-                            delta, archinfo, abiinfo);
Mark Wielaard ada208
+                            delta, archinfo, abiinfo, sigill_diag_IN);
Mark Wielaard ada208
 
Mark Wielaard ada208
    return dres;
Mark Wielaard ada208
 }
Mark Wielaard ada208
Only in valgrind-3.8.1/VEX/priv: guest_mips_toIR.c.orig
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/priv/guest_ppc_defs.h valgrind-3.8.1/VEX/priv/guest_ppc_defs.h
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/priv/guest_ppc_defs.h	2012-11-04 21:57:03.782416795 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/priv/guest_ppc_defs.h	2012-11-04 21:57:37.030893654 +0100
Mark Wielaard ada208
@@ -57,7 +57,8 @@
Mark Wielaard ada208
                          VexArch      guest_arch,
Mark Wielaard ada208
                          VexArchInfo* archinfo,
Mark Wielaard ada208
                          VexAbiInfo*  abiinfo,
Mark Wielaard ada208
-                         Bool         host_bigendian );
Mark Wielaard ada208
+                         Bool         host_bigendian,
Mark Wielaard ada208
+                         Bool         sigill_diag );
Mark Wielaard ada208
 
Mark Wielaard ada208
 /* Used by the optimiser to specialise calls to helpers. */
Mark Wielaard ada208
 extern
Mark Wielaard ada208
Only in valgrind-3.8.1/VEX/priv: guest_ppc_defs.h.orig
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/priv/guest_ppc_toIR.c valgrind-3.8.1/VEX/priv/guest_ppc_toIR.c
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/priv/guest_ppc_toIR.c	2012-11-04 21:57:03.784416825 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/priv/guest_ppc_toIR.c	2012-11-04 21:57:37.034893677 +0100
Mark Wielaard ada208
@@ -16475,7 +16475,8 @@
Mark Wielaard ada208
              void*        callback_opaque,
Mark Wielaard ada208
              Long         delta64,
Mark Wielaard ada208
              VexArchInfo* archinfo,
Mark Wielaard ada208
-             VexAbiInfo*  abiinfo
Mark Wielaard ada208
+             VexAbiInfo*  abiinfo,
Mark Wielaard ada208
+             Bool         sigill_diag
Mark Wielaard ada208
           )
Mark Wielaard ada208
 {
Mark Wielaard ada208
    UChar     opc1;
Mark Wielaard ada208
@@ -17688,10 +17689,12 @@
Mark Wielaard ada208
    decode_failure:
Mark Wielaard ada208
    /* All decode failures end up here. */
Mark Wielaard ada208
    opc2 = (theInstr) & 0x7FF;
Mark Wielaard ada208
-   vex_printf("disInstr(ppc): unhandled instruction: "
Mark Wielaard ada208
-              "0x%x\n", theInstr);
Mark Wielaard ada208
-   vex_printf("                 primary %d(0x%x), secondary %u(0x%x)\n", 
Mark Wielaard ada208
-              opc1, opc1, opc2, opc2);
Mark Wielaard ada208
+   if (sigill_diag) {
Mark Wielaard ada208
+      vex_printf("disInstr(ppc): unhandled instruction: "
Mark Wielaard ada208
+                 "0x%x\n", theInstr);
Mark Wielaard ada208
+      vex_printf("                 primary %d(0x%x), secondary %u(0x%x)\n", 
Mark Wielaard ada208
+                 opc1, opc1, opc2, opc2);
Mark Wielaard ada208
+   }
Mark Wielaard ada208
 
Mark Wielaard ada208
    /* Tell the dispatcher that this insn cannot be decoded, and so has
Mark Wielaard ada208
       not been executed, and (is currently) the next to be executed.
Mark Wielaard ada208
@@ -17752,7 +17755,8 @@
Mark Wielaard ada208
                          VexArch      guest_arch,
Mark Wielaard ada208
                          VexArchInfo* archinfo,
Mark Wielaard ada208
                          VexAbiInfo*  abiinfo,
Mark Wielaard ada208
-                         Bool         host_bigendian_IN )
Mark Wielaard ada208
+                         Bool         host_bigendian_IN,
Mark Wielaard ada208
+                         Bool         sigill_diag_IN )
Mark Wielaard ada208
 {
Mark Wielaard ada208
    IRType     ty;
Mark Wielaard ada208
    DisResult  dres;
Mark Wielaard ada208
@@ -17788,7 +17792,7 @@
Mark Wielaard ada208
    guest_CIA_bbstart    = mkSzAddr(ty, guest_IP - delta);
Mark Wielaard ada208
 
Mark Wielaard ada208
    dres = disInstr_PPC_WRK ( resteerOkFn, resteerCisOk, callback_opaque,
Mark Wielaard ada208
-                             delta, archinfo, abiinfo );
Mark Wielaard ada208
+                             delta, archinfo, abiinfo, sigill_diag_IN );
Mark Wielaard ada208
 
Mark Wielaard ada208
    return dres;
Mark Wielaard ada208
 }
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/priv/guest_ppc_toIR.c.orig valgrind-3.8.1/VEX/priv/guest_ppc_toIR.c.orig
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/priv/guest_ppc_toIR.c.orig	2012-11-04 21:57:03.786416855 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/priv/guest_ppc_toIR.c.orig	2012-11-04 21:56:20.081790240 +0100
Mark Wielaard ada208
@@ -16629,6 +16629,7 @@
Mark Wielaard ada208
 
Mark Wielaard ada208
    /* 64bit Integer Rotate Instructions */
Mark Wielaard ada208
    case 0x1E: // rldcl, rldcr, rldic, rldicl, rldicr, rldimi
Mark Wielaard ada208
+      if (!mode64) goto decode_failure;
Mark Wielaard ada208
       if (dis_int_rot( theInstr )) goto decode_success;
Mark Wielaard ada208
       goto decode_failure;
Mark Wielaard ada208
 
Mark Wielaard ada208
@@ -16663,7 +16664,12 @@
Mark Wielaard ada208
       goto decode_failure;
Mark Wielaard ada208
 
Mark Wielaard ada208
    /* Trap Instructions */
Mark Wielaard ada208
-   case 0x02: case 0x03: // tdi, twi
Mark Wielaard ada208
+   case 0x02:    // tdi
Mark Wielaard ada208
+      if (!mode64) goto decode_failure;
Mark Wielaard ada208
+      if (dis_trapi(theInstr, &dres)) goto decode_success;
Mark Wielaard ada208
+      goto decode_failure;
Mark Wielaard ada208
+
Mark Wielaard ada208
+   case 0x03:   // twi
Mark Wielaard ada208
       if (dis_trapi(theInstr, &dres)) goto decode_success;
Mark Wielaard ada208
       goto decode_failure;
Mark Wielaard ada208
 
Mark Wielaard ada208
@@ -17264,7 +17270,12 @@
Mark Wielaard ada208
          goto decode_failure;
Mark Wielaard ada208
 
Mark Wielaard ada208
          /* 64bit Integer Parity Instructions */
Mark Wielaard ada208
-      case 0xba: case 0x9a: // prtyd, prtyw
Mark Wielaard ada208
+      case 0xba: // prtyd
Mark Wielaard ada208
+         if (!mode64) goto decode_failure;
Mark Wielaard ada208
+         if (dis_int_parity( theInstr )) goto decode_success;
Mark Wielaard ada208
+         goto decode_failure;
Mark Wielaard ada208
+
Mark Wielaard ada208
+      case 0x9a: // prtyw
Mark Wielaard ada208
          if (dis_int_parity( theInstr )) goto decode_success;
Mark Wielaard ada208
          goto decode_failure;
Mark Wielaard ada208
 
Mark Wielaard ada208
@@ -17309,9 +17320,13 @@
Mark Wielaard ada208
          goto decode_failure;
Mark Wielaard ada208
 
Mark Wielaard ada208
       /* Integer Load and Store with Byte Reverse Instructions */
Mark Wielaard ada208
-      case 0x316: case 0x216: case 0x396: // lhbrx, lwbrx, sthbrx
Mark Wielaard ada208
-      case 0x296: case 0x214:             // stwbrx, ldbrx
Mark Wielaard ada208
-      case 0x294:                         // stdbrx
Mark Wielaard ada208
+      case 0x214: case 0x294: // ldbrx, stdbrx
Mark Wielaard ada208
+         if (!mode64) goto decode_failure;
Mark Wielaard ada208
+         if (dis_int_ldst_rev( theInstr )) goto decode_success;
Mark Wielaard ada208
+         goto decode_failure;
Mark Wielaard ada208
+
Mark Wielaard ada208
+      case 0x216: case 0x316: case 0x296:    // lwbrx, lhbrx, stwbrx
Mark Wielaard ada208
+      case 0x396:                            // sthbrx
Mark Wielaard ada208
          if (dis_int_ldst_rev( theInstr )) goto decode_success;
Mark Wielaard ada208
          goto decode_failure;
Mark Wielaard ada208
          
Mark Wielaard ada208
@@ -17361,7 +17376,12 @@
Mark Wielaard ada208
 //zz          goto decode_failure;
Mark Wielaard ada208
 
Mark Wielaard ada208
       /* Trap Instructions */
Mark Wielaard ada208
-      case 0x004: case 0x044:             // tw,   td
Mark Wielaard ada208
+      case 0x004:             // tw
Mark Wielaard ada208
+         if (dis_trap(theInstr, &dres)) goto decode_success;
Mark Wielaard ada208
+         goto decode_failure;
Mark Wielaard ada208
+
Mark Wielaard ada208
+      case 0x044:             // td
Mark Wielaard ada208
+         if (!mode64) goto decode_failure;
Mark Wielaard ada208
          if (dis_trap(theInstr, &dres)) goto decode_success;
Mark Wielaard ada208
          goto decode_failure;
Mark Wielaard ada208
 
Mark Wielaard ada208
@@ -17455,6 +17475,7 @@
Mark Wielaard ada208
     	  goto decode_failure;
Mark Wielaard ada208
 
Mark Wielaard ada208
       case 0x0FC: // bpermd
Mark Wielaard ada208
+         if (!mode64) goto decode_failure;
Mark Wielaard ada208
          if (dis_int_logic( theInstr )) goto decode_success;
Mark Wielaard ada208
          goto decode_failure;
Mark Wielaard ada208
 
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/priv/guest_s390_defs.h valgrind-3.8.1/VEX/priv/guest_s390_defs.h
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/priv/guest_s390_defs.h	2012-11-04 21:57:03.782416795 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/priv/guest_s390_defs.h	2012-11-04 21:57:37.098894575 +0100
Mark Wielaard ada208
@@ -52,7 +52,8 @@
Mark Wielaard ada208
                           VexArch      guest_arch,
Mark Wielaard ada208
                           VexArchInfo* archinfo,
Mark Wielaard ada208
                           VexAbiInfo*  abiinfo,
Mark Wielaard ada208
-                          Bool         host_bigendian );
Mark Wielaard ada208
+                          Bool         host_bigendian,
Mark Wielaard ada208
+                          Bool         sigill_diag );
Mark Wielaard ada208
 
Mark Wielaard ada208
 /* Used by the optimiser to specialise calls to helpers. */
Mark Wielaard ada208
 IRExpr* guest_s390x_spechelper ( HChar   *function_name,
Mark Wielaard ada208
Only in valgrind-3.8.1/VEX/priv: guest_s390_defs.h.orig
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/priv/guest_s390_toIR.c valgrind-3.8.1/VEX/priv/guest_s390_toIR.c
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/priv/guest_s390_toIR.c	2012-11-04 21:57:03.789416902 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/priv/guest_s390_toIR.c	2012-11-04 21:57:37.102894640 +0100
Mark Wielaard ada208
@@ -73,6 +73,9 @@
Mark Wielaard ada208
 static Bool (*resteer_fn)(void *, Addr64);
Mark Wielaard ada208
 static void *resteer_data;
Mark Wielaard ada208
 
Mark Wielaard ada208
+/* Whether to print diagnostics for illegal instructions. */
Mark Wielaard ada208
+static Bool sigill_diag;
Mark Wielaard ada208
+
Mark Wielaard ada208
 /* The last seen execute target instruction */
Mark Wielaard ada208
 ULong last_execute_target;
Mark Wielaard ada208
 
Mark Wielaard ada208
@@ -14143,34 +14146,36 @@
Mark Wielaard ada208
    if (status == S390_DECODE_OK) return insn_length;  /* OK */
Mark Wielaard ada208
 
Mark Wielaard ada208
    /* Decoding failed somehow */
Mark Wielaard ada208
-   vex_printf("vex s390->IR: ");
Mark Wielaard ada208
-   switch (status) {
Mark Wielaard ada208
-   case S390_DECODE_UNKNOWN_INSN:
Mark Wielaard ada208
-      vex_printf("unknown insn: ");
Mark Wielaard ada208
-      break;
Mark Wielaard ada208
+   if (sigill_diag) {
Mark Wielaard ada208
+      vex_printf("vex s390->IR: ");
Mark Wielaard ada208
+      switch (status) {
Mark Wielaard ada208
+      case S390_DECODE_UNKNOWN_INSN:
Mark Wielaard ada208
+         vex_printf("unknown insn: ");
Mark Wielaard ada208
+         break;
Mark Wielaard ada208
 
Mark Wielaard ada208
-   case S390_DECODE_UNIMPLEMENTED_INSN:
Mark Wielaard ada208
-      vex_printf("unimplemented insn: ");
Mark Wielaard ada208
-      break;
Mark Wielaard ada208
+      case S390_DECODE_UNIMPLEMENTED_INSN:
Mark Wielaard ada208
+         vex_printf("unimplemented insn: ");
Mark Wielaard ada208
+         break;
Mark Wielaard ada208
 
Mark Wielaard ada208
-   case S390_DECODE_UNKNOWN_SPECIAL_INSN:
Mark Wielaard ada208
-      vex_printf("unimplemented special insn: ");
Mark Wielaard ada208
-      break;
Mark Wielaard ada208
+      case S390_DECODE_UNKNOWN_SPECIAL_INSN:
Mark Wielaard ada208
+         vex_printf("unimplemented special insn: ");
Mark Wielaard ada208
+         break;
Mark Wielaard ada208
 
Mark Wielaard ada208
-   default:
Mark Wielaard ada208
-   case S390_DECODE_ERROR:
Mark Wielaard ada208
-      vex_printf("decoding error: ");
Mark Wielaard ada208
-      break;
Mark Wielaard ada208
-   }
Mark Wielaard ada208
+      default:
Mark Wielaard ada208
+      case S390_DECODE_ERROR:
Mark Wielaard ada208
+         vex_printf("decoding error: ");
Mark Wielaard ada208
+         break;
Mark Wielaard ada208
+      }
Mark Wielaard ada208
 
Mark Wielaard ada208
-   vex_printf("%02x%02x", bytes[0], bytes[1]);
Mark Wielaard ada208
-   if (insn_length > 2) {
Mark Wielaard ada208
-      vex_printf(" %02x%02x", bytes[2], bytes[3]);
Mark Wielaard ada208
-   }
Mark Wielaard ada208
-   if (insn_length > 4) {
Mark Wielaard ada208
-      vex_printf(" %02x%02x", bytes[4], bytes[5]);
Mark Wielaard ada208
+      vex_printf("%02x%02x", bytes[0], bytes[1]);
Mark Wielaard ada208
+      if (insn_length > 2) {
Mark Wielaard ada208
+         vex_printf(" %02x%02x", bytes[2], bytes[3]);
Mark Wielaard ada208
+      }
Mark Wielaard ada208
+      if (insn_length > 4) {
Mark Wielaard ada208
+         vex_printf(" %02x%02x", bytes[4], bytes[5]);
Mark Wielaard ada208
+      }
Mark Wielaard ada208
+      vex_printf("\n");
Mark Wielaard ada208
    }
Mark Wielaard ada208
-   vex_printf("\n");
Mark Wielaard ada208
 
Mark Wielaard ada208
    return 0;  /* Failed */
Mark Wielaard ada208
 }
Mark Wielaard ada208
@@ -14261,7 +14266,8 @@
Mark Wielaard ada208
               VexArch      guest_arch,
Mark Wielaard ada208
               VexArchInfo *archinfo,
Mark Wielaard ada208
               VexAbiInfo  *abiinfo,
Mark Wielaard ada208
-              Bool         host_bigendian)
Mark Wielaard ada208
+              Bool         host_bigendian,
Mark Wielaard ada208
+              Bool         sigill_diag_IN)
Mark Wielaard ada208
 {
Mark Wielaard ada208
    vassert(guest_arch == VexArchS390X);
Mark Wielaard ada208
 
Mark Wielaard ada208
@@ -14273,6 +14279,7 @@
Mark Wielaard ada208
    irsb = irsb_IN;
Mark Wielaard ada208
    resteer_fn = resteerOkFn;
Mark Wielaard ada208
    resteer_data = callback_opaque;
Mark Wielaard ada208
+   sigill_diag = sigill_diag_IN;
Mark Wielaard ada208
 
Mark Wielaard ada208
    return disInstr_S390_WRK(guest_code + delta);
Mark Wielaard ada208
 }
Mark Wielaard ada208
Only in valgrind-3.8.1/VEX/priv: guest_s390_toIR.c.orig
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/priv/guest_x86_defs.h valgrind-3.8.1/VEX/priv/guest_x86_defs.h
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/priv/guest_x86_defs.h	2012-11-04 21:57:03.782416795 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/priv/guest_x86_defs.h	2012-11-04 21:57:37.169895603 +0100
Mark Wielaard ada208
@@ -56,7 +56,8 @@
Mark Wielaard ada208
                          VexArch      guest_arch,
Mark Wielaard ada208
                          VexArchInfo* archinfo,
Mark Wielaard ada208
                          VexAbiInfo*  abiinfo,
Mark Wielaard ada208
-                         Bool         host_bigendian );
Mark Wielaard ada208
+                         Bool         host_bigendian,
Mark Wielaard ada208
+                         Bool         sigill_diag );
Mark Wielaard ada208
 
Mark Wielaard ada208
 /* Used by the optimiser to specialise calls to helpers. */
Mark Wielaard ada208
 extern
Mark Wielaard ada208
Only in valgrind-3.8.1/VEX/priv: guest_x86_defs.h.orig
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/priv/guest_x86_toIR.c valgrind-3.8.1/VEX/priv/guest_x86_toIR.c
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/priv/guest_x86_toIR.c	2012-11-04 21:57:03.790416917 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/priv/guest_x86_toIR.c	2012-11-04 21:57:37.176895720 +0100
Mark Wielaard ada208
@@ -7927,7 +7927,8 @@
Mark Wielaard ada208
              void*        callback_opaque,
Mark Wielaard ada208
              Long         delta64,
Mark Wielaard ada208
              VexArchInfo* archinfo,
Mark Wielaard ada208
-             VexAbiInfo*  vbi
Mark Wielaard ada208
+             VexAbiInfo*  vbi,
Mark Wielaard ada208
+             Bool         sigill_diag
Mark Wielaard ada208
           )
Mark Wielaard ada208
 {
Mark Wielaard ada208
    IRType    ty;
Mark Wielaard ada208
@@ -15157,12 +15158,14 @@
Mark Wielaard ada208
   default:
Mark Wielaard ada208
   decode_failure:
Mark Wielaard ada208
    /* All decode failures end up here. */
Mark Wielaard ada208
-   vex_printf("vex x86->IR: unhandled instruction bytes: "
Mark Wielaard ada208
-              "0x%x 0x%x 0x%x 0x%x\n",
Mark Wielaard ada208
-              (Int)getIByte(delta_start+0),
Mark Wielaard ada208
-              (Int)getIByte(delta_start+1),
Mark Wielaard ada208
-              (Int)getIByte(delta_start+2),
Mark Wielaard ada208
-              (Int)getIByte(delta_start+3) );
Mark Wielaard ada208
+   if (sigill_diag) {
Mark Wielaard ada208
+      vex_printf("vex x86->IR: unhandled instruction bytes: "
Mark Wielaard ada208
+                 "0x%x 0x%x 0x%x 0x%x\n",
Mark Wielaard ada208
+                 (Int)getIByte(delta_start+0),
Mark Wielaard ada208
+                 (Int)getIByte(delta_start+1),
Mark Wielaard ada208
+                 (Int)getIByte(delta_start+2),
Mark Wielaard ada208
+                 (Int)getIByte(delta_start+3) );
Mark Wielaard ada208
+   }
Mark Wielaard ada208
 
Mark Wielaard ada208
    /* Tell the dispatcher that this insn cannot be decoded, and so has
Mark Wielaard ada208
       not been executed, and (is currently) the next to be executed.
Mark Wielaard ada208
@@ -15225,7 +15228,8 @@
Mark Wielaard ada208
                          VexArch      guest_arch,
Mark Wielaard ada208
                          VexArchInfo* archinfo,
Mark Wielaard ada208
                          VexAbiInfo*  abiinfo,
Mark Wielaard ada208
-                         Bool         host_bigendian_IN )
Mark Wielaard ada208
+                         Bool         host_bigendian_IN,
Mark Wielaard ada208
+                         Bool         sigill_diag_IN )
Mark Wielaard ada208
 {
Mark Wielaard ada208
    Int       i, x1, x2;
Mark Wielaard ada208
    Bool      expect_CAS, has_CAS;
Mark Wielaard ada208
@@ -15244,7 +15248,7 @@
Mark Wielaard ada208
    dres = disInstr_X86_WRK ( &expect_CAS, resteerOkFn,
Mark Wielaard ada208
                              resteerCisOk,
Mark Wielaard ada208
                              callback_opaque,
Mark Wielaard ada208
-                             delta, archinfo, abiinfo );
Mark Wielaard ada208
+                             delta, archinfo, abiinfo, sigill_diag_IN );
Mark Wielaard ada208
    x2 = irsb_IN->stmts_used;
Mark Wielaard ada208
    vassert(x2 >= x1);
Mark Wielaard ada208
 
Mark Wielaard ada208
@@ -15264,7 +15268,7 @@
Mark Wielaard ada208
       dres = disInstr_X86_WRK ( &expect_CAS, resteerOkFn,
Mark Wielaard ada208
                                 resteerCisOk,
Mark Wielaard ada208
                                 callback_opaque,
Mark Wielaard ada208
-                                delta, archinfo, abiinfo );
Mark Wielaard ada208
+                                delta, archinfo, abiinfo, sigill_diag_IN );
Mark Wielaard ada208
       for (i = x1; i < x2; i++) {
Mark Wielaard ada208
          vex_printf("\t\t");
Mark Wielaard ada208
          ppIRStmt(irsb_IN->stmts[i]);
Mark Wielaard ada208
Only in valgrind-3.8.1/VEX/priv: guest_x86_toIR.c.orig
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/priv/main_main.c valgrind-3.8.1/VEX/priv/main_main.c
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/priv/main_main.c	2012-11-04 21:57:03.784416825 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/priv/main_main.c	2012-11-04 21:57:37.247896750 +0100
Mark Wielaard ada208
@@ -605,6 +605,7 @@
Mark Wielaard ada208
                      vta->guest_bytes_addr,
Mark Wielaard ada208
                      vta->chase_into_ok,
Mark Wielaard ada208
                      host_is_bigendian,
Mark Wielaard ada208
+                     vta->sigill_diag,
Mark Wielaard ada208
                      vta->arch_guest,
Mark Wielaard ada208
                      &vta->archinfo_guest,
Mark Wielaard ada208
                      &vta->abiinfo_both,
Mark Wielaard ada208
diff -ur valgrind-3.8.1.orig/VEX/pub/libvex.h valgrind-3.8.1/VEX/pub/libvex.h
Mark Wielaard ada208
--- valgrind-3.8.1.orig/VEX/pub/libvex.h	2012-11-04 21:57:03.781416780 +0100
Mark Wielaard ada208
+++ valgrind-3.8.1/VEX/pub/libvex.h	2012-11-04 21:57:37.248896764 +0100
Mark Wielaard ada208
@@ -622,6 +622,9 @@
Mark Wielaard ada208
       /* IN: debug: trace vex activity at various points */
Mark Wielaard ada208
       Int     traceflags;
Mark Wielaard ada208
 
Mark Wielaard ada208
+      /* IN: debug: print diagnostics when an illegal instr is detected */
Mark Wielaard ada208
+      Bool    sigill_diag;
Mark Wielaard ada208
+
Mark Wielaard ada208
       /* IN: profiling: add a 64 bit profiler counter increment to the
Mark Wielaard ada208
          translation? */
Mark Wielaard ada208
       Bool    addProfInc;
Mark Wielaard ada208
Only in valgrind-3.8.1/VEX/pub: libvex.h.orig