]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add Ijk_EmFail, a new kind of IR block exit: an emulation failure
authorJulian Seward <jseward@acm.org>
Fri, 20 Jan 2006 14:13:55 +0000 (14:13 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 20 Jan 2006 14:13:55 +0000 (14:13 +0000)
(fatal error) from which Vex (generated code) cannot recover.

Handle this in the ppc(64) backend.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1542

VEX/priv/host-ppc/hdefs.c
VEX/priv/ir/irdefs.c
VEX/priv/main/vex_main.c
VEX/pub/libvex_emwarn.h
VEX/pub/libvex_ir.h
VEX/pub/libvex_trc_values.h

index 066ba2631f57fab4d57c992a947351865f0029ba..e88e5f148fc44142548e0bc3d4d6d9966e9148ec 100644 (file)
@@ -2939,6 +2939,7 @@ Int emit_PPCInstr ( UChar* buf, Int nbuf, PPCInstr* i,
          case Ijk_Sys_syscall: trc = VEX_TRC_JMP_SYS_SYSCALL; break;
          case Ijk_Yield:       trc = VEX_TRC_JMP_YIELD;       break;
          case Ijk_EmWarn:      trc = VEX_TRC_JMP_EMWARN;      break;
+         case Ijk_EmFail:      trc = VEX_TRC_JMP_EMFAIL;      break;
          case Ijk_MapFail:     trc = VEX_TRC_JMP_MAPFAIL;     break;
          case Ijk_NoDecode:    trc = VEX_TRC_JMP_NODECODE;    break;
          case Ijk_TInval:      trc = VEX_TRC_JMP_TINVAL;      break;
index c04b7da4a51f2b59a020ae9f5117f86eb8ceba06..20da033b768ed19ccd8c261fe676553023318f0f 100644 (file)
@@ -681,6 +681,7 @@ void ppIRJumpKind ( IRJumpKind kind )
       case Ijk_ClientReq:    vex_printf("ClientReq"); break;
       case Ijk_Yield:        vex_printf("Yield"); break;
       case Ijk_EmWarn:       vex_printf("EmWarn"); break;
+      case Ijk_EmFail:       vex_printf("EmFail"); break;
       case Ijk_NoDecode:     vex_printf("NoDecode"); break;
       case Ijk_MapFail:      vex_printf("MapFail"); break;
       case Ijk_TInval:       vex_printf("Invalidate"); break;
index 311f2845e9d3b4119108fe0c2a4cbe6fb276f54a..b232fbf63a796d32e3007602217c8dad5bac0a12 100644 (file)
@@ -664,8 +664,12 @@ HChar* LibVEX_EmWarn_string ( VexEmWarn ew )
         return "Setting %mxcsr.daz (SSE treat-denormals-as-zero mode)";
      case EmWarn_X86_acFlag:
         return "Setting %eflags.ac (setting noted but ignored)";
-     case EmWarn_PPC32exns:
-        return "Unmasking PPC32 FP exceptions";
+     case EmWarn_PPCexns:
+        return "Unmasking PPC32/64 FP exceptions";
+     case EmWarn_PPC64_redir_overflow:
+        return "PPC64 function redirection stack overflow";
+     case EmWarn_PPC64_redir_underflow:
+        return "PPC64 function redirection stack underflow";
      default: 
         vpanic("LibVEX_EmWarn_string: unknown warning");
    }
index 8ef6c8d8df876f37f827fe49f7660bf4fbea888e..6733a442a9b278908243370e2946919851d2cc17 100644 (file)
@@ -87,8 +87,12 @@ typedef
       /* settings to %eflags.ac (alignment check) are noted but ignored */
       EmWarn_X86_acFlag,
       
-      /* unmasking PPC32 FP exceptions is not supported */
-      EmWarn_PPC32exns,
+      /* unmasking PPC32/64 FP exceptions is not supported */
+      EmWarn_PPCexns,
+
+      /* overflow/underflow of the PPC64 _REDIR stack (ppc64 only) */
+      EmWarn_PPC64_redir_overflow,
+      EmWarn_PPC64_redir_underflow,
 
       EmWarn_NUMBER
    }
index 130a4fe13edeb93b84b9348612e2ce65636ec2b3..1e480b59e8cfe0be7e4fa70d3918ce842f0f4430 100644 (file)
@@ -843,6 +843,14 @@ extern Bool eqIRAtom ( IRExpr*, IRExpr* );
    the size of a guest word. It is the responsibility of the relevant
    toIR.c to ensure that these are filled in with suitable values
    before issuing a jump of kind Ijk_TInval.  
+
+   Re Ijk_EmWarn and Ijk_EmFail: the guest state must have a
+   pseudo-register guest_EMWARN, which is 32-bits regardless of
+   the host or guest word size.  That register should be made
+   to hold an EmWarn_* value to indicate the reason for the exit.
+
+   In the case of Ijk_EmFail, the exit is fatal (Vex-generated code
+   cannot continue) and so the jump destination can be anything.
 */
 typedef
    enum { 
@@ -852,6 +860,7 @@ typedef
       Ijk_ClientReq,      /* do guest client req before continuing */
       Ijk_Yield,          /* client is yielding to thread scheduler */
       Ijk_EmWarn,         /* report emulation warning before continuing */
+      Ijk_EmFail,         /* emulation critical (FATAL) error; give up */
       Ijk_NoDecode,       /* next instruction cannot be decoded */
       Ijk_MapFail,        /* Vex-provided address translation failed */
       Ijk_TInval,         /* Invalidate translations before continuing. */
index ccba4e3cbffdf1ee35d54909762b0c03da2a3344..a82518e001814472a550e3a86e71387f827d2230 100644 (file)
@@ -54,6 +54,9 @@
 
    This file may get included in assembly code, so do not put
    C-specific constructs in it.
+
+   These values should be 61 or above so as not to conflict
+   with Valgrind's VG_TRC_ values, which are 60 or below.
 */
 
 #define VEX_TRC_JMP_TINVAL     61  /* invalidate translations before
@@ -61,6 +64,8 @@
 #define VEX_TRC_JMP_NOREDIR    81  /* jump to undirected guest addr */
 #define VEX_TRC_JMP_EMWARN     63  /* deliver emulation warning before
                                       continuing */
+#define VEX_TRC_JMP_EMFAIL     83  /* emulation fatal error; abort system */
+
 #define VEX_TRC_JMP_CLIENTREQ  65  /* do a client req before continuing */
 #define VEX_TRC_JMP_YIELD      67  /* yield to thread sched 
                                       before continuing */