Changes to make function wrapping work better on ppc64-linux:

- when recording the non-redirected address in guest_NRADDR, also
  snapshot the current R2 value, as that will be needed to run the
  original safely

- As a consequence, the original-function information extracted by
  VALGRIND_GET_ORIG_FN is different on ppc64-linux (2 words) from
  all other platforms (1 word).  So change the type of it from
  void* to a new type OrigFn which can be defined differently for
  each platform.

- Change the CALL_FN_* macros for ppc64-linux to save/restore
  R2 values appropriately.

- ppc64-linux: detect overflow/underflow of the redirect stack
  and bring Valgrind to a halt if this happens

- Update VG_CLREQ_SZB for ppc32/64 (was out of date).





git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5569 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c
index cb9adcb..5ba430f 100644
--- a/coregrind/m_scheduler/scheduler.c
+++ b/coregrind/m_scheduler/scheduler.c
@@ -923,7 +923,7 @@
          show = (ew < 0 || ew >= EmWarn_NUMBER)
                    ? True
                    : counts[ew]++ < 3;
-         if (show && VG_(clo_show_emwarns)) {
+         if (show && VG_(clo_show_emwarns) && !VG_(clo_xml)) {
             VG_(message)( Vg_UserMsg,
                           "Emulation warning: unsupported action:");
             VG_(message)( Vg_UserMsg, "  %s", what);
@@ -932,6 +932,24 @@
          break;
       }
 
+      case VEX_TRC_JMP_EMFAIL: {
+         VexEmWarn ew;
+         HChar*    what;
+         ew   = (VexEmWarn)VG_(threads)[tid].arch.vex.guest_EMWARN;
+         what = (ew < 0 || ew >= EmWarn_NUMBER)
+                   ? "unknown (?!)"
+                   : LibVEX_EmWarn_string(ew);
+         VG_(message)( Vg_UserMsg,
+                       "Emulation fatal error -- Valgrind cannot continue:");
+         VG_(message)( Vg_UserMsg, "  %s", what);
+         VG_(get_and_pp_StackTrace)( tid, VG_(clo_backtrace_size) );
+         VG_(message)(Vg_UserMsg, "");
+         VG_(message)(Vg_UserMsg, "Valgrind has to exit now.  Sorry.");
+         VG_(message)(Vg_UserMsg, "");
+         VG_(exit)(1);
+         break;
+      }
+
       case VEX_TRC_JMP_NODECODE:
 #define M(a) VG_(message)(Vg_UserMsg, a);
    M("Your program just tried to execute an instruction that Valgrind" );