From: Florian Krohm Date: Sat, 6 Sep 2014 21:43:28 +0000 (+0000) Subject: Minor refactoring to avoid special handling of emulation X-Git-Tag: svn/VALGRIND_3_10_1^2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=529e1e97c597be7a4b043696126db7e5dd6a3321;p=thirdparty%2Fvalgrind.git Minor refactoring to avoid special handling of emulation failures in s390_irgen_PFPO. git-svn-id: svn://svn.valgrind.org/vex/trunk@2948 --- diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index 1f6bc6b238..2bcbf34873 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -482,22 +482,38 @@ put_dpr_pair(UInt archreg, IRExpr *expr) /* 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 @@ s390_irgen_PFPO(void) /* 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(