From nobody Sun Feb 8 10:18:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1537177332655590.0343633127006; Mon, 17 Sep 2018 02:42:12 -0700 (PDT) Received: from localhost ([::1]:34676 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1q2l-0005mC-GX for importer@patchew.org; Mon, 17 Sep 2018 05:42:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1pwT-0000bX-0B for qemu-devel@nongnu.org; Mon, 17 Sep 2018 05:35:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1pwQ-0008Bg-R5 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 05:35:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43256) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1pwP-0007sX-5F; Mon, 17 Sep 2018 05:35:37 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6D13D356D5; Mon, 17 Sep 2018 09:35:30 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9672653; Mon, 17 Sep 2018 09:35:28 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 11:34:58 +0200 Message-Id: <20180917093459.28099-9-david@redhat.com> In-Reply-To: <20180917093459.28099-1-david@redhat.com> References: <20180917093459.28099-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 17 Sep 2018 09:35:30 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 8/9] s390x/tcg: fix FP register pair checks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Valid register pairs are 0/2, 1/3, 4/6, 5/7, 8/10, 9/11, 12/14, 13/15. R1/R2 always selects the lower number, so the current checks are not correct as e.g. 2/4 could be selected as a pair. Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand Reviewed-by: Thomas Huth --- target/s390x/translate.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index f9a78c4304..5cc65b0840 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -1110,7 +1110,7 @@ typedef struct { #define IF_HFP3 0x0004 /* r3 points at fp reg for HFP instruction= s */ #define IF_BFP 0x0008 /* binary floating point instruction */ #define IF_DFP 0x0010 /* decimal floating point instruction */ -#define IF_PRIV 0x0020 /* priviledged instruction */ +#define IF_PRIV 0x0020 /* privileged instruction */ =20 struct DisasInsn { unsigned opc:16; @@ -5985,6 +5985,12 @@ static bool is_afp_reg(int reg) return reg % 2 || reg > 6; } =20 +static bool is_fp_pair(int reg) +{ + /* 0,1,4,5,8,9,12,13: to exclude the others, check for single bit */ + return !(reg & 0x2); +} + static DisasJumpType translate_one(CPUS390XState *env, DisasContext *s) { const DisasInsn *insn; @@ -6067,17 +6073,11 @@ static DisasJumpType translate_one(CPUS390XState *e= nv, DisasContext *s) excp =3D PGM_SPECIFICATION; } } - if (spec & SPEC_r1_f128) { - r =3D get_field(&f, r1); - if (r > 13) { - excp =3D PGM_SPECIFICATION; - } + if (spec & SPEC_r1_f128 && !is_fp_pair(get_field(&f, r1))) { + excp =3D PGM_SPECIFICATION; } - if (spec & SPEC_r2_f128) { - r =3D get_field(&f, r2); - if (r > 13) { - excp =3D PGM_SPECIFICATION; - } + if (spec & SPEC_r2_f128 && !is_fp_pair(get_field(&f, r2))) { + excp =3D PGM_SPECIFICATION; } if (excp) { gen_program_exception(s, excp); --=20 2.17.1