From patchwork Thu Oct 4 15:28:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 979004 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42QxnF0CTMz9s7W for ; Fri, 5 Oct 2018 01:36:17 +1000 (AEST) Received: from localhost ([::1]:56376 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g85fi-0004ng-Gg for incoming@patchwork.ozlabs.org; Thu, 04 Oct 2018 11:36:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53645) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g85aG-0000ca-1J for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:30:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g85aA-0005o1-76 for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:30:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41638) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g85a9-0005mJ-Vl; Thu, 04 Oct 2018 11:30:30 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE509A048A; Thu, 4 Oct 2018 15:30:28 +0000 (UTC) Received: from localhost (dhcp-192-213.str.redhat.com [10.33.192.213]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E1FE672FF; Thu, 4 Oct 2018 15:30:28 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Date: Thu, 4 Oct 2018 17:28:55 +0200 Message-Id: <20181004152857.14525-14-cohuck@redhat.com> In-Reply-To: <20181004152857.14525-1-cohuck@redhat.com> References: <20181004152857.14525-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 04 Oct 2018 15:30:28 +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] [PULL 13/15] 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 , qemu-devel@nongnu.org, Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: David Hildenbrand 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 Reviewed-by: Thomas Huth Signed-off-by: David Hildenbrand Message-Id: <20180927130303.12236-9-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/translate.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index f93ad20951..f6813d0674 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -6024,6 +6024,12 @@ static bool is_afp_reg(int reg) return reg % 2 || reg > 6; } +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; @@ -6106,17 +6112,11 @@ static DisasJumpType translate_one(CPUS390XState *env, DisasContext *s) excp = PGM_SPECIFICATION; } } - if (spec & SPEC_r1_f128) { - r = get_field(&f, r1); - if (r > 13) { - excp = PGM_SPECIFICATION; - } + if (spec & SPEC_r1_f128 && !is_fp_pair(get_field(&f, r1))) { + excp = PGM_SPECIFICATION; } - if (spec & SPEC_r2_f128) { - r = get_field(&f, r2); - if (r > 13) { - excp = PGM_SPECIFICATION; - } + if (spec & SPEC_r2_f128 && !is_fp_pair(get_field(&f, r2))) { + excp = PGM_SPECIFICATION; } if (excp) { gen_program_exception(s, excp);