From nobody Wed Nov 5 00:33:05 2025 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500642039394582.6166080956581; Fri, 21 Jul 2017 06:00:39 -0700 (PDT) Received: from localhost ([::1]:42998 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYXXn-00071q-3t for importer@patchew.org; Fri, 21 Jul 2017 09:00:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58358) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYXTq-0003tO-QH for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYXTl-0002Lk-Vl for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36328) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dYXTl-0002LW-PQ for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:25 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA4E04A6E9; Fri, 21 Jul 2017 12:56:24 +0000 (UTC) Received: from t460s.redhat.com (unknown [10.36.118.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id C99A1845B5; Fri, 21 Jul 2017 12:56:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AA4E04A6E9 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AA4E04A6E9 From: David Hildenbrand To: qemu-devel@nongnu.org Date: Fri, 21 Jul 2017 14:56:04 +0200 Message-Id: <20170721125609.11117-2-david@redhat.com> In-Reply-To: <20170721125609.11117-1-david@redhat.com> References: <20170721125609.11117-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 21 Jul 2017 12:56:24 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v1 1/6] target/s390x: fix pgm irq ilen for stsi 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, borntraeger@de.ibm.com, Aurelien Jarno , rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The instruction is 4 bytes long. Signed-off-by: David Hildenbrand Reviewed-by: Thomas Huth --- target/s390x/misc_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index b508101..2ec49c9 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -385,7 +385,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, if ((r0 & STSI_LEVEL_MASK) <=3D STSI_LEVEL_3 && ((r0 & STSI_R0_RESERVED_MASK) || (r1 & STSI_R1_RESERVED_MASK))) { /* valid function code, invalid reserved bits */ - program_interrupt(env, PGM_SPECIFICATION, 2); + program_interrupt(env, PGM_SPECIFICATION, 4); } =20 sel1 =3D r0 & STSI_R0_SEL1_MASK; --=20 2.9.4 From nobody Wed Nov 5 00:33:05 2025 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500642209447681.8454757712464; Fri, 21 Jul 2017 06:03:29 -0700 (PDT) Received: from localhost ([::1]:43020 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYXaS-0000sd-JN for importer@patchew.org; Fri, 21 Jul 2017 09:03:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYXTs-0003tR-Gz for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYXTr-0002Nk-Nq for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57678) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dYXTr-0002NV-HC for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:31 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 53B8FC008297; Fri, 21 Jul 2017 12:56:30 +0000 (UTC) Received: from t460s.redhat.com (unknown [10.36.118.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0793B845B5; Fri, 21 Jul 2017 12:56:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 53B8FC008297 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 53B8FC008297 From: David Hildenbrand To: qemu-devel@nongnu.org Date: Fri, 21 Jul 2017 14:56:05 +0200 Message-Id: <20170721125609.11117-3-david@redhat.com> In-Reply-To: <20170721125609.11117-1-david@redhat.com> References: <20170721125609.11117-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 21 Jul 2017 12:56:30 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v1 2/6] target/s390x: fix pgm irq ilen in translate_pages() 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, borntraeger@de.ibm.com, Aurelien Jarno , rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 0 is certainly wrong. Let's use ILEN_AUTO. Signed-off-by: David Hildenbrand Reviewed-by: Thomas Huth --- target/s390x/mmu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index a873dc4..1ad0158 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -440,7 +440,7 @@ static int translate_pages(S390CPU *cpu, vaddr addr, in= t nr_pages, } if (!address_space_access_valid(&address_space_memory, pages[i], TARGET_PAGE_SIZE, is_write)) { - program_interrupt(env, PGM_ADDRESSING, 0); + program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO); return -EFAULT; } addr +=3D TARGET_PAGE_SIZE; --=20 2.9.4 From nobody Wed Nov 5 00:33:05 2025 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500642283238192.6832318958393; Fri, 21 Jul 2017 06:04:43 -0700 (PDT) Received: from localhost ([::1]:43040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYXbf-0001y6-5u for importer@patchew.org; Fri, 21 Jul 2017 09:04:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58444) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYXU1-00041A-74 for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYXTw-0002P5-9X for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41448) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dYXTw-0002Oo-3I for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:36 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06465935E7; Fri, 21 Jul 2017 12:56:35 +0000 (UTC) Received: from t460s.redhat.com (unknown [10.36.118.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2DDE845B5; Fri, 21 Jul 2017 12:56:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 06465935E7 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 06465935E7 From: David Hildenbrand To: qemu-devel@nongnu.org Date: Fri, 21 Jul 2017 14:56:06 +0200 Message-Id: <20170721125609.11117-4-david@redhat.com> In-Reply-To: <20170721125609.11117-1-david@redhat.com> References: <20170721125609.11117-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 21 Jul 2017 12:56:35 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v1 3/6] target/s390x: implement spm (SET PROGRAM MASK) 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, borntraeger@de.ibm.com, Aurelien Jarno , rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson --- target/s390x/cpu.h | 2 ++ target/s390x/insn-data.def | 2 ++ target/s390x/translate.c | 16 ++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 7732d01..4f7c6b7 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -308,6 +308,7 @@ void s390x_cpu_debug_excp_handler(CPUState *cs); #undef PSW_SHIFT_ASC #undef PSW_MASK_CC #undef PSW_MASK_PM +#undef PSW_SHIFT_MASK_PM #undef PSW_MASK_64 #undef PSW_MASK_32 #undef PSW_MASK_ESA_ADDR @@ -325,6 +326,7 @@ void s390x_cpu_debug_excp_handler(CPUState *cs); #define PSW_SHIFT_ASC 46 #define PSW_MASK_CC 0x0000300000000000ULL #define PSW_MASK_PM 0x00000F0000000000ULL +#define PSW_SHIFT_MASK_PM 40 #define PSW_MASK_64 0x0000000100000000ULL #define PSW_MASK_32 0x0000000080000000ULL #define PSW_MASK_ESA_ADDR 0x000000007fffffffULL diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index ad84c74..84233a4 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -755,6 +755,8 @@ C(0xb2b8, SRNMB, S, FPE, 0, 0, 0, 0, srnm, 0) /* SET DFP ROUNDING MODE */ C(0xb2b9, SRNMT, S, DFPR, 0, 0, 0, 0, srnm, 0) +/* SET PROGRAM MASK */ + C(0x0400, SPM, RR_a, Z, r1, 0, 0, 0, spm, 0) =20 /* SHIFT LEFT SINGLE */ D(0x8b00, SLA, RS_a, Z, r1, sh32, new, r1_32, sla, 0, 31) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 1dffcee..7fc07a4 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3854,6 +3854,22 @@ static ExitStatus op_srnm(DisasContext *s, DisasOps = *o) return NO_EXIT; } =20 +static ExitStatus op_spm(DisasContext *s, DisasOps *o) +{ + TCGv_i32 cc =3D tcg_temp_new_i32(); + + tcg_gen_extrl_i64_i32(cc, o->in1); + tcg_gen_shri_i32(cc, cc, 28); + tcg_gen_andi_i32(cc, cc, 0x3ul); + tcg_gen_mov_i32(cc_op, cc); + tcg_temp_free_i32(cc); + set_cc_static(s); + + tcg_gen_shri_i64(o->in1, o->in1, 24); + tcg_gen_deposit_i64(psw_mask, psw_mask, o->in1, PSW_SHIFT_MASK_PM, 4); + return NO_EXIT; +} + #ifndef CONFIG_USER_ONLY static ExitStatus op_spka(DisasContext *s, DisasOps *o) { --=20 2.9.4 From nobody Wed Nov 5 00:33:05 2025 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500641911597599.3408292934427; Fri, 21 Jul 2017 05:58:31 -0700 (PDT) Received: from localhost ([::1]:42985 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYXVm-0005CT-8T for importer@patchew.org; Fri, 21 Jul 2017 08:58:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYXU1-000419-71 for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYXTz-0002QC-0j for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41654) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dYXTy-0002Pf-R0 for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:38 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A8DD8561E1; Fri, 21 Jul 2017 12:56:37 +0000 (UTC) Received: from t460s.redhat.com (unknown [10.36.118.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F963845B5; Fri, 21 Jul 2017 12:56:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A8DD8561E1 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A8DD8561E1 From: David Hildenbrand To: qemu-devel@nongnu.org Date: Fri, 21 Jul 2017 14:56:07 +0200 Message-Id: <20170721125609.11117-5-david@redhat.com> In-Reply-To: <20170721125609.11117-1-david@redhat.com> References: <20170721125609.11117-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 21 Jul 2017 12:56:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v1 4/6] target/s390x: move wrap_address to cpu.h 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, borntraeger@de.ibm.com, Aurelien Jarno , rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson --- target/s390x/cpu.h | 14 ++++++++++++++ target/s390x/mem_helper.c | 14 -------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 4f7c6b7..13df41c 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -409,6 +409,20 @@ static inline uint64_t cpu_mmu_idx_to_asc(int mmu_idx) } } =20 +static inline uint64_t wrap_address(CPUS390XState *env, uint64_t a) +{ + if (!(env->psw.mask & PSW_MASK_64)) { + if (!(env->psw.mask & PSW_MASK_32)) { + /* 24-Bit mode */ + a &=3D 0x00ffffff; + } else { + /* 31-Bit mode */ + a &=3D 0x7fffffff; + } + } + return a; +} + static inline void cpu_get_tb_cpu_state(CPUS390XState* env, target_ulong *= pc, target_ulong *cs_base, uint32_t *f= lags) { diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index cdc78aa..369d291 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -110,20 +110,6 @@ static inline void cpu_stsize_data_ra(CPUS390XState *e= nv, uint64_t addr, } } =20 -static inline uint64_t wrap_address(CPUS390XState *env, uint64_t a) -{ - if (!(env->psw.mask & PSW_MASK_64)) { - if (!(env->psw.mask & PSW_MASK_32)) { - /* 24-Bit mode */ - a &=3D 0x00ffffff; - } else { - /* 31-Bit mode */ - a &=3D 0x7fffffff; - } - } - return a; -} - static void fast_memset(CPUS390XState *env, uint64_t dest, uint8_t byte, uint32_t l, uintptr_t ra) { --=20 2.9.4 From nobody Wed Nov 5 00:33:05 2025 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500642208742723.725719481472; Fri, 21 Jul 2017 06:03:28 -0700 (PDT) Received: from localhost ([::1]:43019 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYXaS-0000sU-KP for importer@patchew.org; Fri, 21 Jul 2017 09:03:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYXU8-00047b-5W for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYXU6-0002Xt-8Q for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37212) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dYXU5-0002Wv-Ts for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:46 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BCEFF4E4D4; Fri, 21 Jul 2017 12:56:44 +0000 (UTC) Received: from t460s.redhat.com (unknown [10.36.118.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08679845C6; Fri, 21 Jul 2017 12:56:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BCEFF4E4D4 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BCEFF4E4D4 From: David Hildenbrand To: qemu-devel@nongnu.org Date: Fri, 21 Jul 2017 14:56:08 +0200 Message-Id: <20170721125609.11117-6-david@redhat.com> In-Reply-To: <20170721125609.11117-1-david@redhat.com> References: <20170721125609.11117-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 21 Jul 2017 12:56:44 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v1 5/6] target/s390x: add basic MSA features 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, borntraeger@de.ibm.com, Aurelien Jarno , rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The STFLE bits for the MSA (extension) facilities simply indicate that the respective instructions can be executed. The QUERY subfunction can then be used to identify which features exactly are available. Availability of subfunctions can also vary on real hardware. For now, we simply implement a CPU model without any available subfunctions except QUERY (which is always around). As all MSA functions behave quite similarly, we can use one translation handler for now. Prepare the code for implementation of actual subfunctions. At least MSA is helpful for now, as older Linux kernels require this facility when compiled for a z9 model. Allow to enable the facilities for the qemu cpu model. Signed-off-by: David Hildenbrand --- target/s390x/Makefile.objs | 2 +- target/s390x/cpu_models.c | 4 +++ target/s390x/crypto_helper.c | 65 ++++++++++++++++++++++++++++++++++++++++= ++++ target/s390x/helper.h | 1 + target/s390x/insn-data.def | 13 +++++++++ target/s390x/translate.c | 56 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 target/s390x/crypto_helper.c diff --git a/target/s390x/Makefile.objs b/target/s390x/Makefile.objs index 46f6a8c..9d261ed 100644 --- a/target/s390x/Makefile.objs +++ b/target/s390x/Makefile.objs @@ -1,4 +1,4 @@ -obj-y +=3D translate.o helper.o cpu.o interrupt.o +obj-y +=3D translate.o helper.o cpu.o interrupt.o crypto_helper.o obj-y +=3D int_helper.o fpu_helper.o cc_helper.o mem_helper.o misc_helper.o obj-y +=3D gdbstub.o cpu_models.o cpu_features.o obj-$(CONFIG_SOFTMMU) +=3D machine.o ioinst.o arch_dump.o mmu_helper.o diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 92120f4..45bd920 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -792,6 +792,7 @@ static void add_qemu_cpu_model_features(S390FeatBitmap = fbm) S390_FEAT_STFLE, S390_FEAT_EXTENDED_IMMEDIATE, S390_FEAT_EXTENDED_TRANSLATION_2, + S390_FEAT_MSA, S390_FEAT_EXTENDED_TRANSLATION_3, S390_FEAT_LONG_DISPLACEMENT, S390_FEAT_LONG_DISPLACEMENT_FAST, @@ -808,6 +809,9 @@ static void add_qemu_cpu_model_features(S390FeatBitmap = fbm) S390_FEAT_STFLE_49, S390_FEAT_LOCAL_TLB_CLEARING, S390_FEAT_STFLE_53, + S390_FEAT_MSA_EXT_5, + S390_FEAT_MSA_EXT_3, + S390_FEAT_MSA_EXT_4, }; int i; =20 diff --git a/target/s390x/crypto_helper.c b/target/s390x/crypto_helper.c new file mode 100644 index 0000000..125bd9b --- /dev/null +++ b/target/s390x/crypto_helper.c @@ -0,0 +1,65 @@ +/* + * s390x crypto helpers + * + * Copyright (c) 2017 Red Hat Inc + * + * Authors: + * David Hildenbrand + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "qemu/main-loop.h" +#include "cpu.h" +#include "exec/helper-proto.h" +#include "exec/exec-all.h" +#include "exec/cpu_ldst.h" + +uint32_t HELPER(msa)(CPUS390XState *env, uint32_t r1, uint32_t r2, uint32_= t r3, + uint32_t type) +{ + const uintptr_t ra =3D GETPC(); + const uint8_t mod =3D env->regs[0] & 0x80ULL; + const uint8_t fc =3D env->regs[0] & 0x7fULL; + CPUState *cs =3D CPU(s390_env_get_cpu(env)); + uint8_t subfunc[16] =3D { 0 }; + uint64_t param_addr; + int i; + + switch (type) { + case S390_FEAT_TYPE_KMAC: + case S390_FEAT_TYPE_KIMD: + case S390_FEAT_TYPE_KLMD: + case S390_FEAT_TYPE_PCKMO: + case S390_FEAT_TYPE_PCC: + if (mod) { + cpu_restore_state(cs, ra); + program_interrupt(env, PGM_SPECIFICATION, 4); + return 0; + } + break; + } + + s390_get_feat_block(type, subfunc); + if (fc >=3D 128 || !test_be_bit(fc, subfunc)) { + cpu_restore_state(cs, ra); + program_interrupt(env, PGM_SPECIFICATION, 4); + return 0; + } + + switch (fc) { + case 0: + for (i =3D 0; i < 16; i++) { + param_addr =3D wrap_address(env, env->regs[1] + i); + cpu_stb_data_ra(env, param_addr, subfunc[i], ra); + } + break; + default: + /* we don't implement any other subfunction yet */ + g_assert_not_reached(); + } + + return 0; +} diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 4b02907..75ba04f 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -115,6 +115,7 @@ DEF_HELPER_4(cu21, i32, env, i32, i32, i32) DEF_HELPER_4(cu24, i32, env, i32, i32, i32) DEF_HELPER_4(cu41, i32, env, i32, i32, i32) DEF_HELPER_4(cu42, i32, env, i32, i32, i32) +DEF_HELPER_5(msa, i32, env, i32, i32, i32, i32) =20 #ifndef CONFIG_USER_ONLY DEF_HELPER_3(servc, i32, env, i64, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 84233a4..d09f2ed 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -941,6 +941,19 @@ /* UNPACK UNICODE */ C(0xe200, UNPKU, SS_a, E2, la1, a2, 0, 0, unpku, 0) =20 +/* MSA Instructions */ + D(0xb91e, KMAC, RRE, MSA, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMA= C) + D(0xb928, PCKMO, RRE, MSA3, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_PCK= MO) + D(0xb92a, KMF, RRE, MSA4, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMF) + D(0xb92b, KMO, RRE, MSA4, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMO) + D(0xb92c, PCC, RRE, MSA4, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_PCC) + D(0xb92d, KMCTR, RRF_b, MSA4, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMC= TR) + D(0xb92e, KM, RRE, MSA, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KM) + D(0xb92f, KMC, RRE, MSA, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMC) + D(0xb93c, PPNO, RRE, MSA5, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_PPN= O) + D(0xb93e, KIMD, RRE, MSA, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KIM= D) + D(0xb93f, KLMD, RRE, MSA, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KLM= D) + #ifndef CONFIG_USER_ONLY /* COMPARE AND SWAP AND PURGE */ D(0xb250, CSP, RRE, Z, r1_32u, ra2, r1_P, 0, csp, 0, MO_TEUL) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 7fc07a4..2d975b4 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -2480,6 +2480,58 @@ static ExitStatus op_iske(DisasContext *s, DisasOps = *o) } #endif =20 +static ExitStatus op_msa(DisasContext *s, DisasOps *o) +{ + int r1 =3D have_field(s->fields, r1) ? get_field(s->fields, r1) : 0; + int r2 =3D have_field(s->fields, r2) ? get_field(s->fields, r2) : 0; + int r3 =3D have_field(s->fields, r3) ? get_field(s->fields, r3) : 0; + TCGv_i32 t_r1, t_r2, t_r3, type; + + switch (s->insn->data) { + case S390_FEAT_TYPE_KMCTR: + if (r3 & 1 || !r3) { + gen_program_exception(s, PGM_SPECIFICATION); + return EXIT_NORETURN; + } + /* FALL THROUGH */ + case S390_FEAT_TYPE_PPNO: + case S390_FEAT_TYPE_KMF: + case S390_FEAT_TYPE_KMC: + case S390_FEAT_TYPE_KMO: + case S390_FEAT_TYPE_KM: + if (r1 & 1 || !r1) { + gen_program_exception(s, PGM_SPECIFICATION); + return EXIT_NORETURN; + } + /* FALL THROUGH */ + case S390_FEAT_TYPE_KMAC: + case S390_FEAT_TYPE_KIMD: + case S390_FEAT_TYPE_KLMD: + if (r2 & 1 || !r2) { + gen_program_exception(s, PGM_SPECIFICATION); + return EXIT_NORETURN; + } + /* FALL THROUGH */ + case S390_FEAT_TYPE_PCKMO: + case S390_FEAT_TYPE_PCC: + break; + default: + g_assert_not_reached(); + }; + + t_r1 =3D tcg_const_i32(r1); + t_r2 =3D tcg_const_i32(r2); + t_r3 =3D tcg_const_i32(r3); + type =3D tcg_const_i32(s->insn->data); + gen_helper_msa(cc_op, cpu_env, t_r1, t_r2, t_r3, type); + set_cc_static(s); + tcg_temp_free_i32(t_r1); + tcg_temp_free_i32(t_r2); + tcg_temp_free_i32(t_r3); + tcg_temp_free_i32(type); + return NO_EXIT; +} + static ExitStatus op_keb(DisasContext *s, DisasOps *o) { gen_helper_keb(cc_op, cpu_env, o->in1, o->in2); @@ -5571,6 +5623,10 @@ enum DisasInsnEnum { #define FAC_PPA S390_FEAT_STFLE_49 /* processor-assist */ #define FAC_LZRB S390_FEAT_STFLE_53 /* load-and-zero-rightmost-byte= */ #define FAC_ETF3 S390_FEAT_EXTENDED_TRANSLATION_3 +#define FAC_MSA S390_FEAT_MSA /* message-security-assist facility = */ +#define FAC_MSA3 S390_FEAT_MSA_EXT_3 /* msa-extension-3 facility */ +#define FAC_MSA4 S390_FEAT_MSA_EXT_4 /* msa-extension-4 facility */ +#define FAC_MSA5 S390_FEAT_MSA_EXT_5 /* msa-extension-5 facility */ =20 static const DisasInsn insn_info[] =3D { #include "insn-data.def" --=20 2.9.4 From nobody Wed Nov 5 00:33:05 2025 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500642096669794.0001373696158; Fri, 21 Jul 2017 06:01:36 -0700 (PDT) Received: from localhost ([::1]:43002 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYXYL-0007OD-DJ for importer@patchew.org; Fri, 21 Jul 2017 09:01:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58779) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYXUD-0004CQ-C9 for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYXU8-0002aC-Nj for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52330) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dYXU8-0002ZC-Di for qemu-devel@nongnu.org; Fri, 21 Jul 2017 08:56:48 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41DC580468; Fri, 21 Jul 2017 12:56:47 +0000 (UTC) Received: from t460s.redhat.com (unknown [10.36.118.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A82A845B8; Fri, 21 Jul 2017 12:56:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 41DC580468 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 41DC580468 From: David Hildenbrand To: qemu-devel@nongnu.org Date: Fri, 21 Jul 2017 14:56:09 +0200 Message-Id: <20170721125609.11117-7-david@redhat.com> In-Reply-To: <20170721125609.11117-1-david@redhat.com> References: <20170721125609.11117-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 21 Jul 2017 12:56:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v1 6/6] target/s390x: various alignment check 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, borntraeger@de.ibm.com, Aurelien Jarno , rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Let's add proper alignment checks for a handful of instructions that require a SPECIFICATION exception in case alignment is violated. Signed-off-by: David Hildenbrand --- target/s390x/insn-data.def | 14 +++++++------- target/s390x/mem_helper.c | 35 +++++++++++++++++++++++++++++++++++ target/s390x/misc_helper.c | 8 +++++++- target/s390x/translate.c | 7 +++++++ 4 files changed, 56 insertions(+), 8 deletions(-) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index d09f2ed..7ba7304 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -998,11 +998,11 @@ /* ??? Not implemented - is it necessary? */ C(0xb204, SCK, S, Z, 0, 0, 0, 0, 0, 0) /* SET CLOCK COMPARATOR */ - C(0xb206, SCKC, S, Z, 0, m2_64, 0, 0, sckc, 0) + C(0xb206, SCKC, S, Z, 0, a2, 0, 0, sckc, 0) /* SET CPU TIMER */ - C(0xb208, SPT, S, Z, 0, m2_64, 0, 0, spt, 0) + C(0xb208, SPT, S, Z, 0, a2, 0, 0, spt, 0) /* SET PREFIX */ - C(0xb210, SPX, S, Z, 0, m2_32u, 0, 0, spx, 0) + C(0xb210, SPX, S, Z, 0, a2, 0, 0, spx, 0) /* SET PSW KEY FROM ADDRESS */ C(0xb20a, SPKA, S, Z, 0, a2, 0, 0, spka, 0) /* SET STORAGE KEY EXTENDED */ @@ -1017,20 +1017,20 @@ /* STORE CLOCK EXTENDED */ C(0xb278, STCKE, S, Z, 0, a2, 0, 0, stcke, 0) /* STORE CLOCK COMPARATOR */ - C(0xb207, STCKC, S, Z, la2, 0, new, m1_64, stckc, 0) + C(0xb207, STCKC, S, Z, la2, 0, new, 0, stckc, 0) /* STORE CONTROL */ C(0xb600, STCTL, RS_a, Z, 0, a2, 0, 0, stctl, 0) C(0xeb25, STCTG, RSY_a, Z, 0, a2, 0, 0, stctg, 0) /* STORE CPU ADDRESS */ - C(0xb212, STAP, S, Z, la2, 0, new, m1_16, stap, 0) + C(0xb212, STAP, S, Z, la2, 0, new, 0, stap, 0) /* STORE CPU ID */ C(0xb202, STIDP, S, Z, la2, 0, new, 0, stidp, 0) /* STORE CPU TIMER */ - C(0xb209, STPT, S, Z, la2, 0, new, m1_64, stpt, 0) + C(0xb209, STPT, S, Z, la2, 0, new, 0, stpt, 0) /* STORE FACILITY LIST */ C(0xb2b1, STFL, S, Z, 0, 0, 0, 0, stfl, 0) /* STORE PREFIX */ - C(0xb211, STPX, S, Z, la2, 0, new, m1_32, stpx, 0) + C(0xb211, STPX, S, Z, la2, 0, new, 0, stpx, 0) /* STORE SYSTEM INFORMATION */ C(0xb27d, STSI, S, Z, 0, a2, 0, 0, stsi, 0) /* STORE THEN AND SYSTEM MASK */ diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 369d291..87bdbba 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -683,8 +683,15 @@ uint64_t HELPER(mvst)(CPUS390XState *env, uint64_t c, = uint64_t d, uint64_t s) void HELPER(lam)(CPUS390XState *env, uint32_t r1, uint64_t a2, uint32_t r3) { uintptr_t ra =3D GETPC(); + CPUState *cs =3D CPU(s390_env_get_cpu(env)); int i; =20 + if (a2 & 0x3) { + /* we can come here either by lam or lamy, which have different si= ze */ + cpu_restore_state(cs, ra); + program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO); + } + for (i =3D r1;; i =3D (i + 1) % 16) { env->aregs[i] =3D cpu_ldl_data_ra(env, a2, ra); a2 +=3D 4; @@ -699,8 +706,14 @@ void HELPER(lam)(CPUS390XState *env, uint32_t r1, uint= 64_t a2, uint32_t r3) void HELPER(stam)(CPUS390XState *env, uint32_t r1, uint64_t a2, uint32_t r= 3) { uintptr_t ra =3D GETPC(); + CPUState *cs =3D CPU(s390_env_get_cpu(env)); int i; =20 + if (a2 & 0x3) { + cpu_restore_state(cs, ra); + program_interrupt(env, PGM_SPECIFICATION, 4); + } + for (i =3D r1;; i =3D (i + 1) % 16) { cpu_stl_data_ra(env, a2, env->aregs[i], ra); a2 +=3D 4; @@ -1588,6 +1601,11 @@ void HELPER(lctlg)(CPUS390XState *env, uint32_t r1, = uint64_t a2, uint32_t r3) uint64_t src =3D a2; uint32_t i; =20 + if (src & 0x7) { + cpu_restore_state(CPU(cpu), ra); + program_interrupt(env, PGM_SPECIFICATION, 6); + } + for (i =3D r1;; i =3D (i + 1) % 16) { uint64_t val =3D cpu_ldq_data_ra(env, src, ra); if (env->cregs[i] !=3D val && i >=3D 9 && i <=3D 11) { @@ -1618,6 +1636,11 @@ void HELPER(lctl)(CPUS390XState *env, uint32_t r1, u= int64_t a2, uint32_t r3) uint64_t src =3D a2; uint32_t i; =20 + if (src & 0x3) { + cpu_restore_state(CPU(cpu), ra); + program_interrupt(env, PGM_SPECIFICATION, 4); + } + for (i =3D r1;; i =3D (i + 1) % 16) { uint32_t val =3D cpu_ldl_data_ra(env, src, ra); if ((uint32_t)env->cregs[i] !=3D val && i >=3D 9 && i <=3D 11) { @@ -1642,9 +1665,15 @@ void HELPER(lctl)(CPUS390XState *env, uint32_t r1, u= int64_t a2, uint32_t r3) void HELPER(stctg)(CPUS390XState *env, uint32_t r1, uint64_t a2, uint32_t = r3) { uintptr_t ra =3D GETPC(); + CPUState *cs =3D CPU(s390_env_get_cpu(env)); uint64_t dest =3D a2; uint32_t i; =20 + if (dest & 0x7) { + cpu_restore_state(cs, ra); + program_interrupt(env, PGM_SPECIFICATION, 6); + } + for (i =3D r1;; i =3D (i + 1) % 16) { cpu_stq_data_ra(env, dest, env->cregs[i], ra); dest +=3D sizeof(uint64_t); @@ -1658,9 +1687,15 @@ void HELPER(stctg)(CPUS390XState *env, uint32_t r1, = uint64_t a2, uint32_t r3) void HELPER(stctl)(CPUS390XState *env, uint32_t r1, uint64_t a2, uint32_t = r3) { uintptr_t ra =3D GETPC(); + CPUState *cs =3D CPU(s390_env_get_cpu(env)); uint64_t dest =3D a2; uint32_t i; =20 + if (dest & 0x3) { + cpu_restore_state(cs, ra); + program_interrupt(env, PGM_SPECIFICATION, 4); + } + for (i =3D r1;; i =3D (i + 1) % 16) { cpu_stl_data_ra(env, dest, env->cregs[i], ra); dest +=3D sizeof(uint32_t); diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 2ec49c9..a8694da 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -391,7 +391,9 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, sel1 =3D r0 & STSI_R0_SEL1_MASK; sel2 =3D r1 & STSI_R1_SEL2_MASK; =20 - /* XXX: spec exception if sysib is not 4k-aligned */ + if (a0 & 0xfff) { + program_interrupt(env, PGM_SPECIFICATION, 4); + } =20 switch (r0 & STSI_LEVEL_MASK) { case STSI_LEVEL_1: @@ -728,6 +730,10 @@ uint32_t HELPER(stfle)(CPUS390XState *env, uint64_t ad= dr) unsigned max_m1 =3D do_stfle(env, words); unsigned i; =20 + if (addr & 0x7) { + program_interrupt(env, PGM_SPECIFICATION, 4); + } + for (i =3D 0; i <=3D count_m1; ++i) { cpu_stq_data(env, addr + 8 * i, words[i]); } diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 2d975b4..36d13a6 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3953,6 +3953,7 @@ static ExitStatus op_stap(DisasContext *s, DisasOps *= o) version of this stored more than the required half-word, so it is unlikely this has ever been tested. */ tcg_gen_ld32u_i64(o->out, cpu_env, offsetof(CPUS390XState, cpu_num)); + tcg_gen_qemu_st_tl(o->out, o->addr1, get_mem_index(s), MO_TEUW | MO_AL= IGN); return NO_EXIT; } =20 @@ -3989,6 +3990,7 @@ static ExitStatus op_stcke(DisasContext *s, DisasOps = *o) static ExitStatus op_sckc(DisasContext *s, DisasOps *o) { check_privileged(s); + tcg_gen_qemu_ld_i64(o->in2, o->in2, get_mem_index(s), MO_TEQ | MO_ALIG= N); gen_helper_sckc(cpu_env, o->in2); return NO_EXIT; } @@ -3997,6 +3999,7 @@ static ExitStatus op_stckc(DisasContext *s, DisasOps = *o) { check_privileged(s); gen_helper_stckc(o->out, cpu_env); + tcg_gen_qemu_st_i64(o->out, o->addr1, get_mem_index(s), MO_TEQ | MO_AL= IGN); return NO_EXIT; } =20 @@ -4033,6 +4036,7 @@ static ExitStatus op_stidp(DisasContext *s, DisasOps = *o) static ExitStatus op_spt(DisasContext *s, DisasOps *o) { check_privileged(s); + tcg_gen_qemu_ld_i64(o->in2, o->in2, get_mem_index(s), MO_TEQ | MO_ALIG= N); gen_helper_spt(cpu_env, o->in2); return NO_EXIT; } @@ -4048,6 +4052,7 @@ static ExitStatus op_stpt(DisasContext *s, DisasOps *= o) { check_privileged(s); gen_helper_stpt(o->out, cpu_env); + tcg_gen_qemu_st_i64(o->out, o->addr1, get_mem_index(s), MO_TEQ | MO_AL= IGN); return NO_EXIT; } =20 @@ -4063,6 +4068,7 @@ static ExitStatus op_stsi(DisasContext *s, DisasOps *= o) static ExitStatus op_spx(DisasContext *s, DisasOps *o) { check_privileged(s); + tcg_gen_qemu_ld_tl(o->in2, o->in2, get_mem_index(s), MO_TEUL | MO_ALIG= N); gen_helper_spx(cpu_env, o->in2); return NO_EXIT; } @@ -4162,6 +4168,7 @@ static ExitStatus op_stpx(DisasContext *s, DisasOps *= o) check_privileged(s); tcg_gen_ld_i64(o->out, cpu_env, offsetof(CPUS390XState, psa)); tcg_gen_andi_i64(o->out, o->out, 0x7fffe000); + tcg_gen_qemu_st_tl(o->out, o->addr1, get_mem_index(s), MO_TEUL | MO_AL= IGN); return NO_EXIT; } =20 --=20 2.9.4