From patchwork Sat May 16 23:28:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 473099 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C6C9B140A98 for ; Sun, 17 May 2015 09:29:15 +1000 (AEST) Received: from localhost ([::1]:35682 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtlW2-0003iu-Qh for incoming@patchwork.ozlabs.org; Sat, 16 May 2015 19:29:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtlVp-0003SX-Je for qemu-devel@nongnu.org; Sat, 16 May 2015 19:28:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YtlVm-0000xD-89 for qemu-devel@nongnu.org; Sat, 16 May 2015 19:28:57 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:101::1]:52500) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtlVl-0000wr-Ps for qemu-devel@nongnu.org; Sat, 16 May 2015 19:28:54 -0400 Received: from [188.85.25.251] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84) (envelope-from ) id 1YtlVY-0007Bq-Rg; Sun, 17 May 2015 01:28:41 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.84) (envelope-from ) id 1YtlVH-0003th-6B; Sun, 17 May 2015 01:28:23 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Sun, 17 May 2015 01:28:03 +0200 Message-Id: <1431818883-14944-1-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 2.1.4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:bc8:30d7:101::1 Cc: Alexander Graf , Aurelien Jarno , Richard Henderson Subject: [Qemu-devel] [PATCH] target-s390x: fix CC computation for EX instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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. Cc: Richard Henderson Cc: Alexander Graf Signed-off-by: Aurelien Jarno --- target-s390x/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-s390x/translate.c b/target-s390x/translate.c index 80e3a54..10522df 100644 --- a/target-s390x/translate.c +++ b/target-s390x/translate.c @@ -2095,7 +2095,7 @@ 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);