From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0em5-0003Y6-Dy for qemu-devel@nongnu.org; Thu, 04 Jun 2015 19:42:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0em0-0001y6-5r for qemu-devel@nongnu.org; Thu, 04 Jun 2015 19:42:13 -0400 Received: from cantor2.suse.de ([195.135.220.15]:48790 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0elz-0001x4-TP for qemu-devel@nongnu.org; Thu, 04 Jun 2015 19:42:08 -0400 From: Alexander Graf Date: Fri, 5 Jun 2015 01:41:31 +0200 Message-Id: <1433461324-23584-2-git-send-email-agraf@suse.de> In-Reply-To: <1433461324-23584-1-git-send-email-agraf@suse.de> References: <1433461324-23584-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PULL 01/34] target-s390x: fix CC computation for EX instruction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, aurel@aurel32.net, Aurelien Jarno , rth@twiddle.net From: Aurelien Jarno Commit 7a6c7067f optimized CC computation by only saving cc_op before calling helpers as they either don't touch the CC or generate a new static value. This however doesn't work for the EX instruction as the helper changes or not the CC value depending on the actual executed instruction (e.g. MVC vs CLC). This patches force a CC computation before calling the helper. This fixes random memory corruption occuring in guests. Signed-off-by: Aurelien Jarno [agraf: remove set_cc_static in op_ex as suggested by rth] Signed-off-by: Alexander Graf --- target-s390x/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target-s390x/translate.c b/target-s390x/translate.c index fbffd30..497733d 100644 --- a/target-s390x/translate.c +++ b/target-s390x/translate.c @@ -2101,13 +2101,12 @@ static ExitStatus op_ex(DisasContext *s, DisasOps *o) TCGv_i64 tmp; update_psw_addr(s); - update_cc_op(s); + gen_op_calc_cc(s); tmp = tcg_const_i64(s->next_pc); gen_helper_ex(cc_op, cpu_env, cc_op, o->in1, o->in2, tmp); tcg_temp_free_i64(tmp); - set_cc_static(s); return NO_EXIT; } -- 1.7.12.4