From patchwork Thu Sep 27 22:39:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187557 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 83A8F2C007E for ; Fri, 28 Sep 2012 09:39:23 +1000 (EST) Received: from localhost ([::1]:38896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THMlh-0004PE-RR for incoming@patchwork.ozlabs.org; Thu, 27 Sep 2012 18:41:17 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THMkz-0003bL-Qd for qemu-devel@nongnu.org; Thu, 27 Sep 2012 18:40:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THMkx-00038i-8X for qemu-devel@nongnu.org; Thu, 27 Sep 2012 18:40:33 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:37069) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THMkx-00031E-1d for qemu-devel@nongnu.org; Thu, 27 Sep 2012 18:40:31 -0400 Received: by mail-pa0-f45.google.com with SMTP id fb10so1737833pad.4 for ; Thu, 27 Sep 2012 15:40:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=8cQLxf2qoX9XKwAA564F9P6eGGKCI/iMBqnJcgexvvM=; b=u0udhOkbXsBCntnFLVeCMtz576FvEZWaYH3YAcGK4agT8lzWQCuZl7qfVqW79yF+KR FgvHErBWae81We0RLVqkHGIeOXrvd4uiyaUfU5sCF2kt8PYuaq/t4Eblf2ia3iYn3PKK n+Ug7d/6MDDtzvYjf+3sSh/eRw2CJNZnlGH0papSEojkQzv6aDQbrS5n/neBBk4UZynw rWlZdJKZ49z6gTGDkdAmGuXFMyc7sVAWaUAnstkDkwO0rn4AxBP1LqgC890U5EgXavfX 1osOW6CxQ98X856zWe9dKxJypSR30trSqP24/3bkIfFWfZ1uJE9p/9uT9/K/vhQMF8cO 6lGA== Received: by 10.68.197.194 with SMTP id iw2mr15182711pbc.121.1348785630599; Thu, 27 Sep 2012 15:40:30 -0700 (PDT) Received: from anchor.twiddle.home.com ([173.160.232.49]) by mx.google.com with ESMTPS id sj5sm4480267pbc.30.2012.09.27.15.40.29 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 15:40:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Sep 2012 15:39:53 -0700 Message-Id: <1348785610-23418-13-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1348785610-23418-1-git-send-email-rth@twiddle.net> References: <1348785610-23418-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.220.45 Cc: Alexander Graf Subject: [Qemu-devel] [PATCH 012/147] target-s390: Fix PSW_MASK handling 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 We were treating psw.mask as the 32-bit quantity it is in ESA mode. In particular, the CC field was at the wrong place. Signed-off-by: Richard Henderson --- target-s390x/helper.c | 9 +++++---- target-s390x/translate.c | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/target-s390x/helper.c b/target-s390x/helper.c index 22256b0..27c3123 100644 --- a/target-s390x/helper.c +++ b/target-s390x/helper.c @@ -454,18 +454,19 @@ void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr) env->psw.addr = addr; env->psw.mask = mask; - env->cc_op = (mask >> 13) & 3; + env->cc_op = (mask >> 44) & 3; } static uint64_t get_psw_mask(CPUS390XState *env) { - uint64_t r = env->psw.mask; + uint64_t r; env->cc_op = calc_cc(env, env->cc_op, env->cc_src, env->cc_dst, env->cc_vr); - r &= ~(3ULL << 13); + r = env->psw.mask; + r &= ~PSW_MASK_CC; assert(!(env->cc_op & ~3)); - r |= env->cc_op << 13; + r |= (uint64_t)env->cc_op << 44; return r; } diff --git a/target-s390x/translate.c b/target-s390x/translate.c index 5a7612c..e140c79 100644 --- a/target-s390x/translate.c +++ b/target-s390x/translate.c @@ -4559,6 +4559,8 @@ static void disas_s390_insn(CPUS390XState *env, DisasContext *s) tcg_gen_qemu_ld32u(tmp2, tmp, get_mem_index(s)); tcg_gen_addi_i64(tmp, tmp, 4); tcg_gen_qemu_ld32u(tmp3, tmp, get_mem_index(s)); + /* Convert the 32-bit PSW_MASK into the 64-bit PSW_MASK. */ + tcg_gen_shli_i64(tmp2, tmp2, 32); gen_helper_load_psw(cpu_env, tmp2, tmp3); tcg_temp_free_i64(tmp); tcg_temp_free_i64(tmp2);