|
From: <sv...@va...> - 2014-09-06 21:43:37
|
Author: florian
Date: Sat Sep 6 21:43:28 2014
New Revision: 2948
Log:
Minor refactoring to avoid special handling of emulation
failures in s390_irgen_PFPO.
Modified:
trunk/priv/guest_s390_toIR.c
Modified: trunk/priv/guest_s390_toIR.c
==============================================================================
--- trunk/priv/guest_s390_toIR.c (original)
+++ trunk/priv/guest_s390_toIR.c Sat Sep 6 21:43:28 2014
@@ -482,22 +482,38 @@
/* Terminate the current IRSB with an emulation failure. */
static void
-emulation_failure(VexEmNote fail_kind)
+emulation_failure_with_expr(IRExpr *emfailure)
{
- stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_EMNOTE), mkU32(fail_kind)));
+ vassert(typeOfIRExpr(irsb->tyenv, emfailure) == Ity_I32);
+
+ stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_EMNOTE), emfailure));
dis_res->whatNext = Dis_StopHere;
dis_res->jk_StopHere = Ijk_EmFail;
}
+static void
+emulation_failure(VexEmNote fail_kind)
+{
+ emulation_failure_with_expr(mkU32(fail_kind));
+}
+
/* Terminate the current IRSB with an emulation warning. */
static void
-emulation_warning(VexEmNote warn_kind)
+emulation_warning_with_expr(IRExpr *emwarning)
{
- stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_EMNOTE), mkU32(warn_kind)));
+ vassert(typeOfIRExpr(irsb->tyenv, emwarning) == Ity_I32);
+
+ stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_EMNOTE), emwarning));
dis_res->whatNext = Dis_StopHere;
dis_res->jk_StopHere = Ijk_EmWarn;
}
+static void
+emulation_warning(VexEmNote warn_kind)
+{
+ emulation_warning_with_expr(mkU32(warn_kind));
+}
+
/*------------------------------------------------------------*/
/*--- IR Debugging aids. ---*/
/*------------------------------------------------------------*/
@@ -7262,12 +7278,7 @@
/* Check validity of function code in GR 0 */
assign(ef, s390_call_pfpo_helper(unop(Iop_32Uto64, mkexpr(gr0))));
-
- /* fixs390: Function emulation_failure can be used if it takes argument as
- IRExpr * instead of VexEmNote. */
- stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_EMNOTE), mkexpr(ef)));
- dis_res->whatNext = Dis_StopHere;
- dis_res->jk_StopHere = Ijk_EmFail;
+ emulation_failure_with_expr(mkexpr(ef));
stmt(
IRStmt_Exit(
|