From 21b2ab1798ec85f10e91acb9ea664bd60b200bc4 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sun, 26 Aug 2012 14:32:28 +0000 Subject: [PATCH] On s390: Terminate the superblock with Ijk_EmFail if an stckf insn is encountered but not supported on the host. git-svn-id: svn://svn.valgrind.org/vex/trunk@2487 --- VEX/priv/guest_s390_toIR.c | 29 ++++++++++++++++++----------- VEX/priv/main_main.c | 2 ++ VEX/pub/libvex_emnote.h | 3 +++ 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index f9ec22caca..3612f05671 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -10774,18 +10774,25 @@ s390_irgen_STCK(IRTemp op2addr) static HChar * s390_irgen_STCKF(IRTemp op2addr) { - IRDirty *d; - IRTemp cc = newTemp(Ity_I64); + if (! s390_host_has_stckf) { + stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_EMNOTE), + mkU32(EmFail_S390X_stckf))); + put_IA(mkaddr_expr(guest_IA_next_instr)); + dis_res->whatNext = Dis_StopHere; + dis_res->jk_StopHere = Ijk_EmFail; + } else { + IRTemp cc = newTemp(Ity_I64); - d = unsafeIRDirty_1_N(cc, 0, "s390x_dirtyhelper_STCKF", - &s390x_dirtyhelper_STCKF, - mkIRExprVec_1(mkexpr(op2addr))); - d->mFx = Ifx_Write; - d->mAddr = mkexpr(op2addr); - d->mSize = 8; - stmt(IRStmt_Dirty(d)); - s390_cc_thunk_fill(mkU64(S390_CC_OP_SET), - mkexpr(cc), mkU64(0), mkU64(0)); + IRDirty *d = unsafeIRDirty_1_N(cc, 0, "s390x_dirtyhelper_STCKF", + &s390x_dirtyhelper_STCKF, + mkIRExprVec_1(mkexpr(op2addr))); + d->mFx = Ifx_Write; + d->mAddr = mkexpr(op2addr); + d->mSize = 8; + stmt(IRStmt_Dirty(d)); + s390_cc_thunk_fill(mkU64(S390_CC_OP_SET), + mkexpr(cc), mkU64(0), mkU64(0)); + } return "stckf"; } diff --git a/VEX/priv/main_main.c b/VEX/priv/main_main.c index 12946d8172..26f259efb4 100644 --- a/VEX/priv/main_main.c +++ b/VEX/priv/main_main.c @@ -1028,6 +1028,8 @@ HChar* LibVEX_EmNote_string ( VexEmNote ew ) return "PPC64 function redirection stack underflow"; case EmFail_S390X_stfle: return "Instruction stfle is not supported on this host"; + case EmFail_S390X_stckf: + return "Instruction stckf is not supported on this host"; default: vpanic("LibVEX_EmNote_string: unknown warning"); } diff --git a/VEX/pub/libvex_emnote.h b/VEX/pub/libvex_emnote.h index cdedfe2e78..5f02bba1fe 100644 --- a/VEX/pub/libvex_emnote.h +++ b/VEX/pub/libvex_emnote.h @@ -88,6 +88,9 @@ typedef /* stfle insn is not supported on this host */ EmFail_S390X_stfle, + /* stckf insn is not supported on this host */ + EmFail_S390X_stckf, + EmNote_NUMBER } VexEmNote; -- 2.47.2