Deal with LibVEX-supplied insn decode failures, and with LibVEX-supplied
address-mapping failures (x86 LDT/GDT failures).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3195 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/core.h b/coregrind/core.h
index b1bc0e3..ffc2fbe 100644
--- a/coregrind/core.h
+++ b/coregrind/core.h
@@ -983,6 +983,7 @@
extern void VG_(synth_fault) (ThreadId tid);
extern void VG_(synth_fault_mapping)(ThreadId tid, Addr addr);
extern void VG_(synth_fault_perms) (ThreadId tid, Addr addr);
+extern void VG_(synth_sigill) (ThreadId tid, Addr addr);
extern void VG_(get_sigstack_bounds)( Addr* low, Addr* high );
diff --git a/coregrind/core_asm.h b/coregrind/core_asm.h
index e0c319a..4b49b50 100644
--- a/coregrind/core_asm.h
+++ b/coregrind/core_asm.h
@@ -49,9 +49,9 @@
/* And some more of our own. These must not have the same values as
those from libvex_trc_values.h. */
-#define VG_TRC_INNER_FASTMISS 31 /* TRC only; means fast-cache miss. */
-#define VG_TRC_INNER_COUNTERZERO 29 /* TRC only; means bb ctr == 0 */
-#define VG_TRC_UNRESUMABLE_SIGNAL 37 /* TRC only; got sigsegv/sigbus */
+#define VG_TRC_INNER_FASTMISS 37 /* TRC only; means fast-cache miss. */
+#define VG_TRC_INNER_COUNTERZERO 41 /* TRC only; means bb ctr == 0 */
+#define VG_TRC_UNRESUMABLE_SIGNAL 43 /* TRC only; got sigsegv/sigbus */
/* Constants for the fast translation lookup cache. */
diff --git a/coregrind/vg_scheduler.c b/coregrind/vg_scheduler.c
index 1614555..8e0c5ed 100644
--- a/coregrind/vg_scheduler.c
+++ b/coregrind/vg_scheduler.c
@@ -1090,6 +1090,14 @@
unresumable_siginfo.si_signo = 0; /* done */
break;
+ case VEX_TRC_JMP_NODECODE:
+ VG_(synth_sigill)(tid, INSTR_PTR(VG_(threads)[tid].arch));
+ break;
+
+ case VEX_TRC_JMP_MAPFAIL:
+ VG_(synth_fault)(tid);
+ break;
+
default:
VG_(printf)("\ntrc = %d\n", trc);
VG_(core_panic)("VG_(scheduler), phase 3: "
diff --git a/coregrind/vg_signals.c b/coregrind/vg_signals.c
index c4928d1..97281db 100644
--- a/coregrind/vg_signals.c
+++ b/coregrind/vg_signals.c
@@ -1493,6 +1493,22 @@
synth_fault_common(tid, 0, 0x80);
}
+// Synthesise a SIGILL.
+void VG_(synth_sigill)(ThreadId tid, Addr addr)
+{
+ vki_siginfo_t info;
+
+ vg_assert(VG_(threads)[tid].status == VgTs_Runnable);
+
+ info.si_signo = VKI_SIGILL;
+ info.si_code = 1; /* jrs: no idea what this should be */
+ info._sifields._sigfault._addr = (void*)addr;
+
+ VG_(resume_scheduler)(VKI_SIGILL, &info);
+ VG_(deliver_signal)(tid, &info, False);
+}
+
+
void VG_(deliver_signal) ( ThreadId tid, const vki_siginfo_t *info, Bool async )
{
Int sigNo = info->si_signo;