From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495746438401218.36972277781035; Thu, 25 May 2017 14:07:18 -0700 (PDT) Received: from localhost ([::1]:33699 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzyU-0006qx-Qa for importer@patchew.org; Thu, 25 May 2017 17:07:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwZ-0005cu-A4 for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwY-0001JT-Fl for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:15 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37364) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwY-0001IY-9x for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:14 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwV-0008Qo-Sy; Thu, 25 May 2017 23:05:11 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwV-0001Ie-1j; Thu, 25 May 2017 23:05:11 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:04:43 +0200 Message-Id: <20170525210508.4910-2-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 01/26] target/s390x: remove dead code in translate.c 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/translate.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 4bd16d9f99..850df26ce1 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -5455,10 +5455,7 @@ void gen_intermediate_code(CPUS390XState *env, struc= t TranslationBlock *tb) gen_io_start(); } =20 - status =3D NO_EXIT; - if (status =3D=3D NO_EXIT) { - status =3D translate_one(env, &dc); - } + status =3D translate_one(env, &dc); =20 /* If we reach a page boundary, are single stepping, or exhaust instruction count, stop generation. */ --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495746592961931.0895742066289; Thu, 25 May 2017 14:09:52 -0700 (PDT) Received: from localhost ([::1]:33706 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE00z-0001mM-Gv for importer@patchew.org; Thu, 25 May 2017 17:09:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwZ-0005cv-Bc for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwY-0001JM-E8 for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:15 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37354) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwY-0001IW-8U for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:14 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwW-0008Qp-2Q; Thu, 25 May 2017 23:05:12 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwV-0001Il-4k; Thu, 25 May 2017 23:05:11 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:04:44 +0200 Message-Id: <20170525210508.4910-3-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 02/26] target/s390x: make IPTE SMP aware 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/mem_helper.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 4b96c279e3..88e2a0f60d 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -1109,8 +1109,6 @@ void HELPER(ipte)(CPUS390XState *env, uint64_t pte_ad= dr, uint64_t vaddr) uint64_t page =3D vaddr & TARGET_PAGE_MASK; uint64_t pte =3D 0; =20 - /* XXX broadcast to other CPUs */ - /* XXX Linux is nice enough to give us the exact pte address. According to spec we'd have to find it out ourselves */ /* XXX Linux is fine with overwriting the pte, the spec requires @@ -1119,13 +1117,13 @@ void HELPER(ipte)(CPUS390XState *env, uint64_t pte_= addr, uint64_t vaddr) =20 /* XXX we exploit the fact that Linux passes the exact virtual address here - it's not obliged to! */ - tlb_flush_page(cs, page); + tlb_flush_page_all_cpus_synced(cs, page); =20 /* XXX 31-bit hack */ if (page & 0x80000000) { - tlb_flush_page(cs, page & ~0x80000000); + tlb_flush_page_all_cpus_synced(cs, page & ~0x80000000); } else { - tlb_flush_page(cs, page | 0x80000000); + tlb_flush_page_all_cpus_synced(cs, page | 0x80000000); } } =20 --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495746435415353.6869046961059; Thu, 25 May 2017 14:07:15 -0700 (PDT) Received: from localhost ([::1]:33697 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzyT-0006pr-AY for importer@patchew.org; Thu, 25 May 2017 17:07:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55097) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwZ-0005cs-4U for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwY-0001J9-9v for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:15 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37372) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwY-0001Ic-41 for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:14 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwW-0008Qq-4a; Thu, 25 May 2017 23:05:12 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwV-0001Is-7v; Thu, 25 May 2017 23:05:11 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:04:45 +0200 Message-Id: <20170525210508.4910-4-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 03/26] target/s390x: implement TEST AND SET 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno --- target/s390x/insn-data.def | 3 +++ target/s390x/translate.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index f818437069..0f70acea5c 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -810,6 +810,9 @@ /* SUPERVISOR CALL */ C(0x0a00, SVC, I, Z, 0, 0, 0, 0, svc, 0) =20 +/* TEST AND SET */ + C(0x9300, TS, S, Z, 0, a2, 0, 0, ts, 0) + /* TEST DATA CLASS */ C(0xed10, TCEB, RXE, Z, e1, a2, 0, 0, tceb, 0) C(0xed11, TCDB, RXE, Z, f1_o, a2, 0, 0, tcdb, 0) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 850df26ce1..1e16f3d1f7 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -4126,6 +4126,16 @@ static ExitStatus op_trt(DisasContext *s, DisasOps *= o) return NO_EXIT; } =20 +static ExitStatus op_ts(DisasContext *s, DisasOps *o) +{ + TCGv_i32 t1 =3D tcg_const_i32(0xff); + tcg_gen_atomic_fetch_or_i32(t1, o->in2, t1, get_mem_index(s), MO_UB); + tcg_gen_extract_i32(cc_op, t1, 7, 1); + tcg_temp_free_i32(t1); + set_cc_static(s); + return NO_EXIT; +} + static ExitStatus op_unpk(DisasContext *s, DisasOps *o) { TCGv_i32 l =3D tcg_const_i32(get_field(s->fields, l1)); --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495746741015320.1087309079172; Thu, 25 May 2017 14:12:21 -0700 (PDT) Received: from localhost ([::1]:33715 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE03O-0003lO-7R for importer@patchew.org; Thu, 25 May 2017 17:12:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwZ-0005cw-Bz for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwY-0001JY-Fx for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:15 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37368) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwY-0001Ib-AJ for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:14 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwW-0008Qr-9T; Thu, 25 May 2017 23:05:12 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwV-0001Iz-BG; Thu, 25 May 2017 23:05:11 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:04:46 +0200 Message-Id: <20170525210508.4910-5-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 04/26] target/s390x: implement TEST ADDRESSING MODE 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno --- target/s390x/insn-data.def | 3 +++ target/s390x/translate.c | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 0f70acea5c..170b50ef2e 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -810,6 +810,9 @@ /* SUPERVISOR CALL */ C(0x0a00, SVC, I, Z, 0, 0, 0, 0, svc, 0) =20 +/* TEST ADDRESSING MODE */ + C(0x010b, TAM, E, Z, 0, 0, 0, 0, tam, 0) + /* TEST AND SET */ C(0x9300, TS, S, Z, 0, a2, 0, 0, ts, 0) =20 diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 1e16f3d1f7..d84138e38d 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -4060,6 +4060,17 @@ static ExitStatus op_svc(DisasContext *s, DisasOps *= o) return EXIT_NORETURN; } =20 +static ExitStatus op_tam(DisasContext *s, DisasOps *o) +{ + int cc =3D 0; + + cc |=3D (s->tb->flags & FLAG_MASK_64) ? 2 : 0; + cc |=3D (s->tb->flags & FLAG_MASK_32) ? 1 : 0; + tcg_gen_movi_i32(cc_op, cc); + set_cc_static(s); + return NO_EXIT; +} + static ExitStatus op_tceb(DisasContext *s, DisasOps *o) { gen_helper_tceb(cc_op, cpu_env, o->in1, o->in2); --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495746436272185.85448183072447; Thu, 25 May 2017 14:07:16 -0700 (PDT) Received: from localhost ([::1]:33698 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzyU-0006qb-TB for importer@patchew.org; Thu, 25 May 2017 17:07:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwZ-0005cx-DX for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwY-0001J4-9y for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:15 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37366) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwY-0001Ia-4F for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:14 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwW-0008Qs-Cw; Thu, 25 May 2017 23:05:12 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwV-0001J6-Eu; Thu, 25 May 2017 23:05:11 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:04:47 +0200 Message-Id: <20170525210508.4910-6-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 05/26] target/s390x: implement PACK 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 5 +++++ target/s390x/mem_helper.c | 37 +++++++++++++++++++++++++++++++++++++ target/s390x/translate.c | 8 ++++++++ 4 files changed, 51 insertions(+) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index cc451c70a6..fdd6e76410 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -75,6 +75,7 @@ DEF_HELPER_FLAGS_2(sqeb, TCG_CALL_NO_WG, i64, env, i64) DEF_HELPER_FLAGS_2(sqdb, TCG_CALL_NO_WG, i64, env, i64) DEF_HELPER_FLAGS_3(sqxb, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_1(cvd, TCG_CALL_NO_RWG_SE, i64, s32) +DEF_HELPER_FLAGS_4(pack, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_FLAGS_4(unpk, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_FLAGS_4(tr, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_4(tre, i64, env, i64, i64, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 170b50ef2e..f92bfde4f8 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -639,6 +639,11 @@ C(0x9600, OI, SI, Z, m1_8u, i2_8u, new, m1_8, or, nz64) C(0xeb56, OIY, SIY, LD, m1_8u, i2_8u, new, m1_8, or, nz64) =20 +/* PACK */ + /* Really format SS_b, but we pack both lengths into one argument + for the helper call, so we might as well leave one 8-bit field. */ + C(0xf200, PACK, SS_a, Z, la1, a2, 0, 0, pack, 0) + /* PREFETCH */ /* Implemented as nops of course. */ C(0xe336, PFD, RXY_b, GIE, 0, 0, 0, 0, 0, 0) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 88e2a0f60d..f650b08779 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -676,6 +676,43 @@ uint64_t HELPER(cksm)(CPUS390XState *env, uint64_t r1, return len; } =20 +void HELPER(pack)(CPUS390XState *env, uint32_t len, uint64_t dest, uint64_= t src) +{ + uintptr_t ra =3D GETPC(); + int len_dest =3D len >> 4; + int len_src =3D len & 0xf; + uint8_t b; + + dest +=3D len_dest; + src +=3D len_src; + + /* last byte is special, it only flips the nibbles */ + b =3D cpu_ldub_data_ra(env, src, ra); + cpu_stb_data_ra(env, dest, (b << 4) | (b >> 4), ra); + src--; + len_src--; + + /* now pack every value */ + while (len_dest >=3D 0) { + b =3D 0; + + if (len_src > 0) { + b =3D cpu_ldub_data_ra(env, src, ra) & 0x0f; + src--; + len_src--; + } + if (len_src > 0) { + b |=3D cpu_ldub_data_ra(env, src, ra) << 4; + src--; + len_src--; + } + + len_dest--; + dest--; + cpu_stb_data_ra(env, dest, b, ra); + } +} + void HELPER(unpk)(CPUS390XState *env, uint32_t len, uint64_t dest, uint64_t src) { diff --git a/target/s390x/translate.c b/target/s390x/translate.c index d84138e38d..624e8667d7 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3136,6 +3136,14 @@ static ExitStatus op_ori(DisasContext *s, DisasOps *= o) return NO_EXIT; } =20 +static ExitStatus op_pack(DisasContext *s, DisasOps *o) +{ + TCGv_i32 l =3D tcg_const_i32(get_field(s->fields, l1)); + gen_helper_pack(cpu_env, l, o->addr1, o->in2); + tcg_temp_free_i32(l); + return NO_EXIT; +} + static ExitStatus op_popcnt(DisasContext *s, DisasOps *o) { gen_helper_popcnt(o->out, o->in2); --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495746588960742.1457240194075; Thu, 25 May 2017 14:09:48 -0700 (PDT) Received: from localhost ([::1]:33705 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE00x-0001kv-JU for importer@patchew.org; Thu, 25 May 2017 17:09:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwa-0005d4-7T for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwY-0001Jo-LT for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:16 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37374) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwY-0001Ih-GD for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:14 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwW-0008Qt-He; Thu, 25 May 2017 23:05:12 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwV-0001JD-Ho; Thu, 25 May 2017 23:05:11 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:04:48 +0200 Message-Id: <20170525210508.4910-7-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 06/26] target/s390x: implement LOAD PAIR FROM QUADWORD 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno --- target/s390x/insn-data.def | 2 ++ target/s390x/translate.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index f92bfde4f8..53c86d5832 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -507,6 +507,8 @@ /* LOAD PAIR DISJOINT */ D(0xc804, LPD, SSF, ILA, 0, 0, new_P, r3_P32, lpd, 0, MO_TEUL) D(0xc805, LPDG, SSF, ILA, 0, 0, new_P, r3_P64, lpd, 0, MO_TEQ) +/* LOAD PAIR FROM QUADWORD */ + C(0xe38f, LPQ, RXY_a, Z, 0, a2, r1_P, 0, lpq, 0) /* LOAD POSITIVE */ C(0x1000, LPR, RR_a, Z, 0, r2_32s, new, r1_32, abs, abs32) C(0xb900, LPGR, RRE, Z, 0, r2, r1, 0, abs, abs64) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 624e8667d7..09052972f1 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -2827,6 +2827,22 @@ static ExitStatus op_lpd(DisasContext *s, DisasOps *= o) return NO_EXIT; } =20 +static ExitStatus op_lpq(DisasContext *s, DisasOps *o) +{ + /* In a parallel context, stop the world and single step. */ + if (parallel_cpus) { + potential_page_fault(s); + gen_exception(EXCP_ATOMIC); + return EXIT_NORETURN; + } + + /* In a serial context, perform the two loads ... */ + tcg_gen_qemu_ld64(o->out, o->in2, get_mem_index(s)); + tcg_gen_addi_i64(o->in2, o->in2, 8); + tcg_gen_qemu_ld64(o->out2, o->in2, get_mem_index(s)); + return NO_EXIT; +} + #ifndef CONFIG_USER_ONLY static ExitStatus op_lura(DisasContext *s, DisasOps *o) { --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495746740537972.0836144623727; Thu, 25 May 2017 14:12:20 -0700 (PDT) Received: from localhost ([::1]:33716 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE03P-0003mL-3W for importer@patchew.org; Thu, 25 May 2017 17:12:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwZ-0005d2-Mt for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwY-0001Jk-Le for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:15 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37380) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwY-0001Ii-FG for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:14 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwW-0008Qv-M1; Thu, 25 May 2017 23:05:12 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwV-0001JK-Kv; Thu, 25 May 2017 23:05:11 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:04:49 +0200 Message-Id: <20170525210508.4910-8-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 07/26] target/s390x: implement STORE PAIR TO QUADWORD 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno --- target/s390x/insn-data.def | 2 ++ target/s390x/translate.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 53c86d5832..751e3164dd 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -770,6 +770,8 @@ /* STORE ACCESS MULTIPLE */ C(0x9b00, STAM, RS_a, Z, 0, a2, 0, 0, stam, 0) C(0xeb9b, STAMY, RSY_a, LD, 0, a2, 0, 0, stam, 0) +/* STORE PAIR TO QUADWORD */ + C(0xe38e, STPQ, RXY_a, Z, 0, a2, 0, 0, stpq, 0) =20 /* SUBTRACT */ C(0x1b00, SR, RR_a, Z, r1, r2, new, r1_32, sub, subs32) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 09052972f1..231b51c313 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -4025,6 +4025,24 @@ static ExitStatus op_stmh(DisasContext *s, DisasOps = *o) return NO_EXIT; } =20 +static ExitStatus op_stpq(DisasContext *s, DisasOps *o) +{ + int r1 =3D get_field(s->fields, r1); + + /* In a parallel context, stop the world and single step. */ + if (parallel_cpus) { + potential_page_fault(s); + gen_exception(EXCP_ATOMIC); + return EXIT_NORETURN; + } + + /* In a serial context, perform the two stores ... */ + tcg_gen_qemu_st64(regs[r1], o->in2, get_mem_index(s)); + tcg_gen_addi_i64(o->in2, o->in2, 8); + tcg_gen_qemu_st64(regs[r1 + 1], o->in2, get_mem_index(s)); + return NO_EXIT; +} + static ExitStatus op_srst(DisasContext *s, DisasOps *o) { gen_helper_srst(o->in1, cpu_env, regs[0], o->in1, o->in2); --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495746588285768.7794790190175; Thu, 25 May 2017 14:09:48 -0700 (PDT) Received: from localhost ([::1]:33704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE00w-0001kY-Qo for importer@patchew.org; Thu, 25 May 2017 17:09:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwb-0005dL-65 for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwZ-0001Kx-Q6 for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:17 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37384) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwZ-0001JE-Cx for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:15 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwX-0008Qx-6m; Thu, 25 May 2017 23:05:13 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwV-0001JR-Oq; Thu, 25 May 2017 23:05:11 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:04:50 +0200 Message-Id: <20170525210508.4910-9-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 08/26] target/s390x: implement MOVE INVERSE 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 2 ++ target/s390x/mem_helper.c | 12 ++++++++++++ target/s390x/translate.c | 8 ++++++++ 4 files changed, 23 insertions(+) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index fdd6e76410..7d6f11abe8 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -3,6 +3,7 @@ DEF_HELPER_FLAGS_4(nc, TCG_CALL_NO_WG, i32, env, i32, i64, = i64) DEF_HELPER_FLAGS_4(oc, TCG_CALL_NO_WG, i32, env, i32, i64, i64) DEF_HELPER_FLAGS_4(xc, TCG_CALL_NO_WG, i32, env, i32, i64, i64) DEF_HELPER_FLAGS_4(mvc, TCG_CALL_NO_WG, void, env, i32, i64, i64) +DEF_HELPER_FLAGS_4(mvcin, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_FLAGS_4(clc, TCG_CALL_NO_WG, i32, env, i32, i64, i64) DEF_HELPER_3(mvcl, i32, env, i32, i32) DEF_HELPER_FLAGS_4(clm, TCG_CALL_NO_WG, i32, env, i32, i32, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 751e3164dd..52f943c71e 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -566,6 +566,8 @@ C(0xe548, MVGHI, SIL, GIE, la1, i2, 0, m1_64, mov2, 0) C(0x9200, MVI, SI, Z, la1, i2, 0, m1_8, mov2, 0) C(0xeb52, MVIY, SIY, LD, la1, i2, 0, m1_8, mov2, 0) +/* MOVE INVERSE */ + C(0xe800, MVCIN, SS_a, Z, la1, a2, 0, 0, mvcin, 0) /* MOVE LONG */ C(0x0e00, MVCL, RR_a, Z, 0, 0, 0, 0, mvcl, 0) /* MOVE LONG EXTENDED */ diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index f650b08779..7faaf588a5 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -232,6 +232,18 @@ void HELPER(mvc)(CPUS390XState *env, uint32_t l, uint6= 4_t dest, uint64_t src) do_helper_mvc(env, l, dest, src, GETPC()); } =20 +/* move inverse */ +void HELPER(mvcin)(CPUS390XState *env, uint32_t l, uint64_t dest, uint64_t= src) +{ + uintptr_t ra =3D GETPC(); + int i; + + for (i =3D 0; i <=3D l; i++) { + uint8_t v =3D cpu_ldub_data_ra(env, src - i, ra); + cpu_stb_data_ra(env, dest + i, v, ra); + } +} + /* compare unsigned byte arrays */ static uint32_t do_helper_clc(CPUS390XState *env, uint32_t l, uint64_t s1, uint64_t s2, uintptr_t ra) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 231b51c313..b939c5a39f 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -2925,6 +2925,14 @@ static ExitStatus op_mvc(DisasContext *s, DisasOps *= o) return NO_EXIT; } =20 +static ExitStatus op_mvcin(DisasContext *s, DisasOps *o) +{ + TCGv_i32 l =3D tcg_const_i32(get_field(s->fields, l1)); + gen_helper_mvcin(cpu_env, l, o->addr1, o->in2); + tcg_temp_free_i32(l); + return NO_EXIT; +} + static ExitStatus op_mvcl(DisasContext *s, DisasOps *o) { TCGv_i32 r1 =3D tcg_const_i32(get_field(s->fields, r1)); --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495746592439172.40723027932268; Thu, 25 May 2017 14:09:52 -0700 (PDT) Received: from localhost ([::1]:33707 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE010-0001oB-VA for importer@patchew.org; Thu, 25 May 2017 17:09:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwb-0005dR-Bm for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwZ-0001L6-RI for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:17 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37388) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwZ-0001JG-DX for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:15 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwX-0008Qy-Cw; Thu, 25 May 2017 23:05:13 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwV-0001JY-SL; Thu, 25 May 2017 23:05:11 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:04:51 +0200 Message-Id: <20170525210508.4910-10-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 09/26] target/s390x: implement MOVE NUMERICS 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 2 ++ target/s390x/mem_helper.c | 13 +++++++++++++ target/s390x/translate.c | 8 ++++++++ 4 files changed, 24 insertions(+) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 7d6f11abe8..0558d6dc21 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -13,6 +13,7 @@ DEF_HELPER_FLAGS_3(divs64, TCG_CALL_NO_WG, s64, env, s64,= s64) DEF_HELPER_FLAGS_4(divu64, TCG_CALL_NO_WG, i64, env, i64, i64, i64) DEF_HELPER_4(srst, i64, env, i64, i64, i64) DEF_HELPER_4(clst, i64, env, i64, i64, i64) +DEF_HELPER_FLAGS_4(mvn, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_FLAGS_4(mvpg, TCG_CALL_NO_WG, i32, env, i64, i64, i64) DEF_HELPER_4(mvst, i64, env, i64, i64, i64) DEF_HELPER_4(ex, void, env, i32, i64, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 52f943c71e..518b87b160 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -572,6 +572,8 @@ C(0x0e00, MVCL, RR_a, Z, 0, 0, 0, 0, mvcl, 0) /* MOVE LONG EXTENDED */ C(0xa800, MVCLE, RS_a, Z, 0, a2, 0, 0, mvcle, 0) +/* MOVE NUMERICS */ + C(0xd100, MVN, SS_a, Z, la1, a2, 0, 0, mvn, 0) /* MOVE PAGE */ C(0xb254, MVPG, RRE, Z, r1_o, r2_o, 0, 0, mvpg, 0) /* MOVE STRING */ diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 7faaf588a5..88be30555d 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -244,6 +244,19 @@ void HELPER(mvcin)(CPUS390XState *env, uint32_t l, uin= t64_t dest, uint64_t src) } } =20 +/* move numerics */ +void HELPER(mvn)(CPUS390XState *env, uint32_t l, uint64_t dest, uint64_t s= rc) +{ + uintptr_t ra =3D GETPC(); + int i; + + for (i =3D 0; i <=3D l; i++) { + uint8_t v =3D cpu_ldub_data_ra(env, dest + i, ra) & 0xf0; + v |=3D cpu_ldub_data_ra(env, src + i, ra) & 0x0f; + cpu_stb_data_ra(env, dest + i, v, ra); + } +} + /* compare unsigned byte arrays */ static uint32_t do_helper_clc(CPUS390XState *env, uint32_t l, uint64_t s1, uint64_t s2, uintptr_t ra) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index b939c5a39f..ec6b85c2d0 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -2975,6 +2975,14 @@ static ExitStatus op_mvcs(DisasContext *s, DisasOps = *o) } #endif =20 +static ExitStatus op_mvn(DisasContext *s, DisasOps *o) +{ + TCGv_i32 l =3D tcg_const_i32(get_field(s->fields, l1)); + gen_helper_mvn(cpu_env, l, o->addr1, o->in2); + tcg_temp_free_i32(l); + return NO_EXIT; +} + static ExitStatus op_mvpg(DisasContext *s, DisasOps *o) { gen_helper_mvpg(cc_op, cpu_env, regs[0], o->in1, o->in2); --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495746886826545.9599248004024; Thu, 25 May 2017 14:14:46 -0700 (PDT) Received: from localhost ([::1]:33725 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE05l-0007Ab-FG for importer@patchew.org; Thu, 25 May 2017 17:14:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwb-0005dK-63 for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwZ-0001Ky-Qr for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:17 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37390) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwZ-0001JJ-JR for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:15 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwX-0008R6-Bu; Thu, 25 May 2017 23:05:13 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwW-0001Jf-0G; Thu, 25 May 2017 23:05:12 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:04:52 +0200 Message-Id: <20170525210508.4910-11-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 10/26] target/s390x: implement MOVE WITH OFFSET 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 4 ++++ target/s390x/mem_helper.c | 31 +++++++++++++++++++++++++++++++ target/s390x/translate.c | 8 ++++++++ 4 files changed, 44 insertions(+) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 0558d6dc21..fe73d71b49 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -14,6 +14,7 @@ DEF_HELPER_FLAGS_4(divu64, TCG_CALL_NO_WG, i64, env, i64,= i64, i64) DEF_HELPER_4(srst, i64, env, i64, i64, i64) DEF_HELPER_4(clst, i64, env, i64, i64, i64) DEF_HELPER_FLAGS_4(mvn, TCG_CALL_NO_WG, void, env, i32, i64, i64) +DEF_HELPER_FLAGS_4(mvo, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_FLAGS_4(mvpg, TCG_CALL_NO_WG, i32, env, i64, i64, i64) DEF_HELPER_4(mvst, i64, env, i64, i64, i64) DEF_HELPER_4(ex, void, env, i32, i64, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 518b87b160..be8b7af211 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -578,6 +578,10 @@ C(0xb254, MVPG, RRE, Z, r1_o, r2_o, 0, 0, mvpg, 0) /* MOVE STRING */ C(0xb255, MVST, RRE, Z, r1_o, r2_o, 0, 0, mvst, 0) +/* MOVE WITH OFFSET */ + /* Really format SS_b, but we pack both lengths into one argument + for the helper call, so we might as well leave one 8-bit field. */ + C(0xf100, MVO, SS_a, Z, la1, a2, 0, 0, mvo, 0) =20 /* MULTIPLY */ C(0x1c00, MR, RR_a, Z, r1p1_32s, r2_32s, new, r1_D32, mul, 0) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 88be30555d..4f523a8a8c 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -257,6 +257,37 @@ void HELPER(mvn)(CPUS390XState *env, uint32_t l, uint6= 4_t dest, uint64_t src) } } =20 +/* move with offset */ +void HELPER(mvo)(CPUS390XState *env, uint32_t l, uint64_t dest, uint64_t s= rc) +{ + uintptr_t ra =3D GETPC(); + int len_dest =3D l >> 4; + int len_src =3D l & 0xf; + uint8_t byte_dest, byte_src; + int i; + + src +=3D len_src; + dest +=3D len_dest; + + /* Handle rightmost byte */ + byte_src =3D cpu_ldub_data_ra(env, src, ra); + byte_dest =3D cpu_ldub_data_ra(env, dest, ra); + byte_dest =3D (byte_dest & 0x0f) | (byte_src << 4); + cpu_stb_data_ra(env, dest, byte_dest, ra); + + /* Process remaining bytes from right to left */ + for (i =3D 1; i <=3D len_dest; i++) { + byte_dest =3D byte_src >> 4; + if (len_src - i >=3D 0) { + byte_src =3D cpu_ldub_data_ra(env, src - i, ra); + } else { + byte_src =3D 0; + } + byte_dest |=3D byte_src << 4; + cpu_stb_data_ra(env, dest - i, byte_dest, ra); + } +} + /* compare unsigned byte arrays */ static uint32_t do_helper_clc(CPUS390XState *env, uint32_t l, uint64_t s1, uint64_t s2, uintptr_t ra) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index ec6b85c2d0..6d2a1dfe1c 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -2983,6 +2983,14 @@ static ExitStatus op_mvn(DisasContext *s, DisasOps *= o) return NO_EXIT; } =20 +static ExitStatus op_mvo(DisasContext *s, DisasOps *o) +{ + TCGv_i32 l =3D tcg_const_i32(get_field(s->fields, l1)); + gen_helper_mvo(cpu_env, l, o->addr1, o->in2); + tcg_temp_free_i32(l); + return NO_EXIT; +} + static ExitStatus op_mvpg(DisasContext *s, DisasOps *o) { gen_helper_mvpg(cc_op, cpu_env, regs[0], o->in1, o->in2); --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495746741166773.1878477568325; Thu, 25 May 2017 14:12:21 -0700 (PDT) Received: from localhost ([::1]:33717 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE03P-0003ms-LS for importer@patchew.org; Thu, 25 May 2017 17:12:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwb-0005dQ-9z for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwZ-0001LJ-V5 for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:17 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37406) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwZ-0001Jt-Mm for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:15 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwX-0008RA-OK; Thu, 25 May 2017 23:05:13 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwW-0001Jm-3y; Thu, 25 May 2017 23:05:12 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:04:53 +0200 Message-Id: <20170525210508.4910-12-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 11/26] target/s390x: implement MOVE ZONES 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 2 ++ target/s390x/mem_helper.c | 13 +++++++++++++ target/s390x/translate.c | 8 ++++++++ 4 files changed, 24 insertions(+) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index fe73d71b49..e1ab8d5686 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -16,6 +16,7 @@ DEF_HELPER_4(clst, i64, env, i64, i64, i64) DEF_HELPER_FLAGS_4(mvn, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_FLAGS_4(mvo, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_FLAGS_4(mvpg, TCG_CALL_NO_WG, i32, env, i64, i64, i64) +DEF_HELPER_FLAGS_4(mvz, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_4(mvst, i64, env, i64, i64, i64) DEF_HELPER_4(ex, void, env, i32, i64, i64) DEF_HELPER_FLAGS_4(stam, TCG_CALL_NO_WG, void, env, i32, i64, i32) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index be8b7af211..c69e3f4216 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -582,6 +582,8 @@ /* Really format SS_b, but we pack both lengths into one argument for the helper call, so we might as well leave one 8-bit field. */ C(0xf100, MVO, SS_a, Z, la1, a2, 0, 0, mvo, 0) +/* MOVE ZONES */ + C(0xd300, MVZ, SS_a, Z, la1, a2, 0, 0, mvz, 0) =20 /* MULTIPLY */ C(0x1c00, MR, RR_a, Z, r1p1_32s, r2_32s, new, r1_D32, mul, 0) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 4f523a8a8c..bc9fd50b24 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -288,6 +288,19 @@ void HELPER(mvo)(CPUS390XState *env, uint32_t l, uint6= 4_t dest, uint64_t src) } } =20 +/* move zones */ +void HELPER(mvz)(CPUS390XState *env, uint32_t l, uint64_t dest, uint64_t s= rc) +{ + uintptr_t ra =3D GETPC(); + int i; + + for (i =3D 0; i <=3D l; i++) { + uint8_t b =3D cpu_ldub_data_ra(env, dest + i, ra) & 0x0f; + b |=3D cpu_ldub_data_ra(env, src + i, ra) & 0xf0; + cpu_stb_data_ra(env, dest + i, b, ra); + } +} + /* compare unsigned byte arrays */ static uint32_t do_helper_clc(CPUS390XState *env, uint32_t l, uint64_t s1, uint64_t s2, uintptr_t ra) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 6d2a1dfe1c..87408df07a 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3006,6 +3006,14 @@ static ExitStatus op_mvst(DisasContext *s, DisasOps = *o) return NO_EXIT; } =20 +static ExitStatus op_mvz(DisasContext *s, DisasOps *o) +{ + TCGv_i32 l =3D tcg_const_i32(get_field(s->fields, l1)); + gen_helper_mvz(cpu_env, l, o->addr1, o->in2); + tcg_temp_free_i32(l); + return NO_EXIT; +} + static ExitStatus op_mul(DisasContext *s, DisasOps *o) { tcg_gen_mul_i64(o->out, o->in1, o->in2); --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495747041159341.7172691988899; Thu, 25 May 2017 14:17:21 -0700 (PDT) Received: from localhost ([::1]:33737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE08F-0000qz-Iq for importer@patchew.org; Thu, 25 May 2017 17:17:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwd-0005fw-EV for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwa-0001Le-BP for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:19 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37418) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwa-0001KG-17 for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:16 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwY-0008RD-4I; Thu, 25 May 2017 23:05:14 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwW-0001Jt-6t; Thu, 25 May 2017 23:05:12 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:04:54 +0200 Message-Id: <20170525210508.4910-13-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 12/26] target/s390x: improve 24-bit and 31-bit addresses read 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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" Improve fix_address to also handle the 24-bit mode. Rename fix_address to wrap_address to better explain what is changed. For the same reason, rename get_address into get_address_rel and get_address_31fix into get_address_rel. Finally replace many calls to get_address_rel with x2 =3D 0 and b2 =3D 0 by call to wrap_address. Note that get_address_relget_address_rel is only used in the EXECUTE helper, so we can get rid of it as the same time as the helper. Signed-off-by: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/mem_helper.c | 90 +++++++++++++++++++++++++------------------= ---- 1 file changed, 47 insertions(+), 43 deletions(-) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index bc9fd50b24..2b0cde13b4 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -366,16 +366,22 @@ uint32_t HELPER(clm)(CPUS390XState *env, uint32_t r1,= uint32_t mask, return cc; } =20 -static inline uint64_t fix_address(CPUS390XState *env, uint64_t a) +static inline uint64_t wrap_address(CPUS390XState *env, uint64_t a) { - /* 31-Bit mode */ if (!(env->psw.mask & PSW_MASK_64)) { - a &=3D 0x7fffffff; + if (!(env->psw.mask & PSW_MASK_32)) { + /* 24-Bit mode */ + a &=3D 0x00ffffff; + } else { + /* 31-Bit mode */ + a &=3D 0x7fffffff; + } } return a; } =20 -static inline uint64_t get_address(CPUS390XState *env, int x2, int b2, int= d2) +static inline uint64_t get_address_rel(CPUS390XState *env, + int x2, int b2, int d2) { uint64_t r =3D d2; if (x2) { @@ -384,12 +390,12 @@ static inline uint64_t get_address(CPUS390XState *env= , int x2, int b2, int d2) if (b2) { r +=3D env->regs[b2]; } - return fix_address(env, r); + return wrap_address(env, r); } =20 -static inline uint64_t get_address_31fix(CPUS390XState *env, int reg) +static inline uint64_t get_address(CPUS390XState *env, int reg) { - return fix_address(env, env->regs[reg]); + return wrap_address(env, env->regs[reg]); } =20 /* search string (c is byte to search, r2 is string, r1 end of string) */ @@ -400,8 +406,8 @@ uint64_t HELPER(srst)(CPUS390XState *env, uint64_t r0, = uint64_t end, uint32_t len; uint8_t v, c =3D r0; =20 - str =3D fix_address(env, str); - end =3D fix_address(env, end); + str =3D wrap_address(env, str); + end =3D wrap_address(env, end); =20 /* Assume for now that R2 is unmodified. */ env->retxl =3D str; @@ -435,8 +441,8 @@ uint64_t HELPER(clst)(CPUS390XState *env, uint64_t c, u= int64_t s1, uint64_t s2) uint32_t len; =20 c =3D c & 0xff; - s1 =3D fix_address(env, s1); - s2 =3D fix_address(env, s2); + s1 =3D wrap_address(env, s1); + s2 =3D wrap_address(env, s2); =20 /* Lest we fail to service interrupts in a timely manner, limit the amount of work we're willing to do. For now, let's cap at 8k. */ @@ -482,8 +488,8 @@ uint64_t HELPER(mvst)(CPUS390XState *env, uint64_t c, u= int64_t d, uint64_t s) uint32_t len; =20 c =3D c & 0xff; - d =3D fix_address(env, d); - s =3D fix_address(env, s); + d =3D wrap_address(env, d); + s =3D wrap_address(env, s); =20 /* Lest we fail to service interrupts in a timely manner, limit the amount of work we're willing to do. For now, let's cap at 8k. */ @@ -572,9 +578,9 @@ uint32_t HELPER(mvcl)(CPUS390XState *env, uint32_t r1, = uint32_t r2) { uintptr_t ra =3D GETPC(); uint64_t destlen =3D env->regs[r1 + 1] & 0xffffff; - uint64_t dest =3D get_address_31fix(env, r1); + uint64_t dest =3D get_address(env, r1); uint64_t srclen =3D env->regs[r2 + 1] & 0xffffff; - uint64_t src =3D get_address_31fix(env, r2); + uint64_t src =3D get_address(env, r2); uint8_t pad =3D env->regs[r2 + 1] >> 24; uint8_t v; uint32_t cc; @@ -615,9 +621,9 @@ uint32_t HELPER(mvcle)(CPUS390XState *env, uint32_t r1,= uint64_t a2, { uintptr_t ra =3D GETPC(); uint64_t destlen =3D env->regs[r1 + 1]; - uint64_t dest =3D env->regs[r1]; + uint64_t dest =3D get_address(env, r1); uint64_t srclen =3D env->regs[r3 + 1]; - uint64_t src =3D env->regs[r3]; + uint64_t src =3D get_address(env, r3); uint8_t pad =3D a2 & 0xff; uint8_t v; uint32_t cc; @@ -625,8 +631,6 @@ uint32_t HELPER(mvcle)(CPUS390XState *env, uint32_t r1,= uint64_t a2, if (!(env->psw.mask & PSW_MASK_64)) { destlen =3D (uint32_t)destlen; srclen =3D (uint32_t)srclen; - dest &=3D 0x7fffffff; - src &=3D 0x7fffffff; } =20 if (destlen =3D=3D srclen) { @@ -666,9 +670,9 @@ uint32_t HELPER(clcle)(CPUS390XState *env, uint32_t r1,= uint64_t a2, { uintptr_t ra =3D GETPC(); uint64_t destlen =3D env->regs[r1 + 1]; - uint64_t dest =3D get_address_31fix(env, r1); + uint64_t dest =3D get_address(env, r1); uint64_t srclen =3D env->regs[r3 + 1]; - uint64_t src =3D get_address_31fix(env, r3); + uint64_t src =3D get_address(env, r3); uint8_t pad =3D a2 & 0xff; uint32_t cc =3D 0; =20 @@ -1050,7 +1054,7 @@ uint32_t HELPER(testblock)(CPUS390XState *env, uint64= _t real_addr) uint64_t abs_addr; int i; =20 - real_addr =3D fix_address(env, real_addr); + real_addr =3D wrap_address(env, real_addr); abs_addr =3D mmu_real2abs(env, real_addr) & TARGET_PAGE_MASK; if (!address_space_access_valid(&address_space_memory, abs_addr, TARGET_PAGE_SIZE, true)) { @@ -1084,7 +1088,7 @@ uint64_t HELPER(iske)(CPUS390XState *env, uint64_t r2) { static S390SKeysState *ss; static S390SKeysClass *skeyclass; - uint64_t addr =3D get_address(env, 0, 0, r2); + uint64_t addr =3D wrap_address(env, r2); uint8_t key; =20 if (addr > ram_size) { @@ -1107,7 +1111,7 @@ void HELPER(sske)(CPUS390XState *env, uint64_t r1, ui= nt64_t r2) { static S390SKeysState *ss; static S390SKeysClass *skeyclass; - uint64_t addr =3D get_address(env, 0, 0, r2); + uint64_t addr =3D wrap_address(env, r2); uint8_t key; =20 if (addr > ram_size) { @@ -1254,14 +1258,14 @@ uint64_t HELPER(lura)(CPUS390XState *env, uint64_t = addr) { CPUState *cs =3D CPU(s390_env_get_cpu(env)); =20 - return (uint32_t)ldl_phys(cs->as, get_address(env, 0, 0, addr)); + return (uint32_t)ldl_phys(cs->as, wrap_address(env, addr)); } =20 uint64_t HELPER(lurag)(CPUS390XState *env, uint64_t addr) { CPUState *cs =3D CPU(s390_env_get_cpu(env)); =20 - return ldq_phys(cs->as, get_address(env, 0, 0, addr)); + return ldq_phys(cs->as, wrap_address(env, addr)); } =20 /* store using real address */ @@ -1269,7 +1273,7 @@ void HELPER(stura)(CPUS390XState *env, uint64_t addr,= uint64_t v1) { CPUState *cs =3D CPU(s390_env_get_cpu(env)); =20 - stl_phys(cs->as, get_address(env, 0, 0, addr), (uint32_t)v1); + stl_phys(cs->as, wrap_address(env, addr), (uint32_t)v1); =20 if ((env->psw.mask & PSW_MASK_PER) && (env->cregs[9] & PER_CR9_EVENT_STORE) && @@ -1284,7 +1288,7 @@ void HELPER(sturg)(CPUS390XState *env, uint64_t addr,= uint64_t v1) { CPUState *cs =3D CPU(s390_env_get_cpu(env)); =20 - stq_phys(cs->as, get_address(env, 0, 0, addr), v1); + stq_phys(cs->as, wrap_address(env, addr), v1); =20 if ((env->psw.mask & PSW_MASK_PER) && (env->cregs[9] & PER_CR9_EVENT_STORE) && @@ -1369,32 +1373,32 @@ void HELPER(ex)(CPUS390XState *env, uint32_t ilen, = uint64_t r1, uint64_t addr) d2 =3D extract64(insn, 16, 12); switch (opc & 0xf) { case 0x2: - do_helper_mvc(env, l, get_address(env, 0, b1, d1), - get_address(env, 0, b2, d2), 0); + do_helper_mvc(env, l, get_address_rel(env, 0, b1, d1), + get_address_rel(env, 0, b2, d2), 0); return; case 0x4: - env->cc_op =3D do_helper_nc(env, l, get_address(env, 0, b1, d1= ), - get_address(env, 0, b2, d2), 0); + env->cc_op =3D do_helper_nc(env, l, get_address_rel(env, 0, b1= , d1), + get_address_rel(env, 0, b2, d2), 0); return; case 0x5: - env->cc_op =3D do_helper_clc(env, l, get_address(env, 0, b1, d= 1), - get_address(env, 0, b2, d2), 0); + env->cc_op =3D do_helper_clc(env, l, get_address_rel(env, 0, b= 1, d1), + get_address_rel(env, 0, b2, d2), 0); return; case 0x6: - env->cc_op =3D do_helper_oc(env, l, get_address(env, 0, b1, d1= ), - get_address(env, 0, b2, d2), 0); + env->cc_op =3D do_helper_oc(env, l, get_address_rel(env, 0, b1= , d1), + get_address_rel(env, 0, b2, d2), 0); return; case 0x7: - env->cc_op =3D do_helper_xc(env, l, get_address(env, 0, b1, d1= ), - get_address(env, 0, b2, d2), 0); + env->cc_op =3D do_helper_xc(env, l, get_address_rel(env, 0, b1= , d1), + get_address_rel(env, 0, b2, d2), 0); return; case 0xc: - do_helper_tr(env, l, get_address(env, 0, b1, d1), - get_address(env, 0, b2, d2), 0); + do_helper_tr(env, l, get_address_rel(env, 0, b1, d1), + get_address_rel(env, 0, b2, d2), 0); return; case 0xd: - env->cc_op =3D do_helper_trt(env, l, get_address(env, 0, b1, d= 1), - get_address(env, 0, b2, d2), 0); + env->cc_op =3D do_helper_trt(env, l, get_address_rel(env, 0, b= 1, d1), + get_address_rel(env, 0, b2, d2), 0); return; } } else if (opc =3D=3D 0x0a) { @@ -1410,7 +1414,7 @@ void HELPER(ex)(CPUS390XState *env, uint32_t ilen, ui= nt64_t r1, uint64_t addr) r3 =3D extract64(insn, 48, 4); b2 =3D extract64(insn, 44, 4); d2 =3D extract64(insn, 32, 12); - env->cc_op =3D helper_icm(env, r1, get_address(env, 0, b2, d2), r3= ); + env->cc_op =3D helper_icm(env, r1, get_address_rel(env, 0, b2, d2)= , r3); return; } =20 --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495746888238668.9085557497805; Thu, 25 May 2017 14:14:48 -0700 (PDT) Received: from localhost ([::1]:33726 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE05m-0007BV-OV for importer@patchew.org; Thu, 25 May 2017 17:14:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55200) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwb-0005dl-Vb for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwZ-0001LF-UX for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:17 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37408) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwZ-0001Jv-NE for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:15 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwX-0008RF-Rr; Thu, 25 May 2017 23:05:13 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwW-0001K0-A4; Thu, 25 May 2017 23:05:12 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:04:55 +0200 Message-Id: <20170525210508.4910-14-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 13/26] target/s390x: improve 24-bit and 31-bit addresses write 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/mem_helper.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 2b0cde13b4..bbb3eceb71 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -398,6 +398,29 @@ static inline uint64_t get_address(CPUS390XState *env,= int reg) return wrap_address(env, env->regs[reg]); } =20 +static inline void set_address(CPUS390XState *env, int reg, uint64_t addre= ss) +{ + if (env->psw.mask & PSW_MASK_64) { + /* 64-Bit mode */ + env->regs[reg] =3D address; + } else { + if (!(env->psw.mask & PSW_MASK_32)) { + /* 24-Bit mode. According to the PoO it is implementation + dependent if bits 32-39 remain unchanged or are set to + zeros. Choose the former so that the function can also be + used for TRT. */ + env->regs[reg] =3D deposit64(env->regs[reg], 0, 24, address); + } else { + /* 31-Bit mode. According to the PoO it is implementation + dependent if bit 32 remains unchanged or is set to zero. + Choose the latter so that the function can also be used for + TRT. */ + address &=3D 0x7fffffff; + env->regs[reg] =3D deposit64(env->regs[reg], 0, 32, address); + } + } +} + /* search string (c is byte to search, r2 is string, r1 end of string) */ uint64_t HELPER(srst)(CPUS390XState *env, uint64_t r0, uint64_t end, uint64_t str) @@ -609,8 +632,8 @@ uint32_t HELPER(mvcl)(CPUS390XState *env, uint32_t r1, = uint32_t r2) env->regs[r1 + 1] =3D destlen; /* can't use srclen here, we trunc'ed it */ env->regs[r2 + 1] -=3D src - env->regs[r2]; - env->regs[r1] =3D dest; - env->regs[r2] =3D src; + set_address(env, r1, dest); + set_address(env, r2, src); =20 return cc; } @@ -658,8 +681,8 @@ uint32_t HELPER(mvcle)(CPUS390XState *env, uint32_t r1,= uint64_t a2, /* can't use srclen here, we trunc'ed it */ /* FIXME: 31-bit mode! */ env->regs[r3 + 1] -=3D src - env->regs[r3]; - env->regs[r1] =3D dest; - env->regs[r3] =3D src; + set_address(env, r1, dest); + set_address(env, r3, src); =20 return cc; } @@ -696,8 +719,8 @@ uint32_t HELPER(clcle)(CPUS390XState *env, uint32_t r1,= uint64_t a2, env->regs[r1 + 1] =3D destlen; /* can't use srclen here, we trunc'ed it */ env->regs[r3 + 1] -=3D src - env->regs[r3]; - env->regs[r1] =3D dest; - env->regs[r3] =3D src; + set_address(env, r1, dest); + set_address(env, r3, src); =20 return cc; } @@ -901,7 +924,7 @@ static uint32_t do_helper_trt(CPUS390XState *env, uint3= 2_t len, uint64_t array, uint8_t sbyte =3D cpu_ldub_data_ra(env, trans + byte, ra); =20 if (sbyte !=3D 0) { - env->regs[1] =3D array + i; + set_address(env, 1, array + i); env->regs[2] =3D deposit64(env->regs[2], 0, 8, sbyte); return (i =3D=3D len) ? 2 : 1; } --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495746743514407.97609381134635; Thu, 25 May 2017 14:12:23 -0700 (PDT) Received: from localhost ([::1]:33718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE03S-0003oJ-3F for importer@patchew.org; Thu, 25 May 2017 17:12:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwc-0005eS-K1 for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwa-0001Lk-Dg for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:18 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37424) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwa-0001Kb-4F for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:16 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwY-0008RG-Ha; Thu, 25 May 2017 23:05:14 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwW-0001K7-Cn; Thu, 25 May 2017 23:05:12 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:04:56 +0200 Message-Id: <20170525210508.4910-15-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 14/26] target/s390x: improve 24-bit and 31-bit lengths read/write 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/mem_helper.c | 47 +++++++++++++++++++++++++++++++++----------= ---- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index bbb3eceb71..1dc71fe5f0 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -421,6 +421,31 @@ static inline void set_address(CPUS390XState *env, int= reg, uint64_t address) } } =20 +static inline uint64_t wrap_length(CPUS390XState *env, uint64_t length) +{ + if (!(env->psw.mask & PSW_MASK_64)) { + /* 24-Bit and 31-Bit mode */ + length &=3D 0x7fffffff; + } + return length; +} + +static inline uint64_t get_length(CPUS390XState *env, int reg) +{ + return wrap_length(env, env->regs[reg]); +} + +static inline void set_length(CPUS390XState *env, int reg, uint64_t length) +{ + if (env->psw.mask & PSW_MASK_64) { + /* 64-Bit mode */ + env->regs[reg] =3D length; + } else { + /* 24-Bit and 31-Bit mode */ + env->regs[reg] =3D deposit64(env->regs[reg], 0, 32, length); + } +} + /* search string (c is byte to search, r2 is string, r1 end of string) */ uint64_t HELPER(srst)(CPUS390XState *env, uint64_t r0, uint64_t end, uint64_t str) @@ -643,19 +668,14 @@ uint32_t HELPER(mvcle)(CPUS390XState *env, uint32_t r= 1, uint64_t a2, uint32_t r3) { uintptr_t ra =3D GETPC(); - uint64_t destlen =3D env->regs[r1 + 1]; + uint64_t destlen =3D get_length(env, r1 + 1); uint64_t dest =3D get_address(env, r1); - uint64_t srclen =3D env->regs[r3 + 1]; + uint64_t srclen =3D get_length(env, r3 + 1); uint64_t src =3D get_address(env, r3); uint8_t pad =3D a2 & 0xff; uint8_t v; uint32_t cc; =20 - if (!(env->psw.mask & PSW_MASK_64)) { - destlen =3D (uint32_t)destlen; - srclen =3D (uint32_t)srclen; - } - if (destlen =3D=3D srclen) { cc =3D 0; } else if (destlen < srclen) { @@ -677,10 +697,9 @@ uint32_t HELPER(mvcle)(CPUS390XState *env, uint32_t r1= , uint64_t a2, cpu_stb_data_ra(env, dest, pad, ra); } =20 - env->regs[r1 + 1] =3D destlen; + set_length(env, r1 + 1 , destlen); /* can't use srclen here, we trunc'ed it */ - /* FIXME: 31-bit mode! */ - env->regs[r3 + 1] -=3D src - env->regs[r3]; + set_length(env, r3 + 1, env->regs[r3 + 1] - src - env->regs[r3]); set_address(env, r1, dest); set_address(env, r3, src); =20 @@ -692,9 +711,9 @@ uint32_t HELPER(clcle)(CPUS390XState *env, uint32_t r1,= uint64_t a2, uint32_t r3) { uintptr_t ra =3D GETPC(); - uint64_t destlen =3D env->regs[r1 + 1]; + uint64_t destlen =3D get_length(env, r1 + 1); uint64_t dest =3D get_address(env, r1); - uint64_t srclen =3D env->regs[r3 + 1]; + uint64_t srclen =3D get_length(env, r3 + 1); uint64_t src =3D get_address(env, r3); uint8_t pad =3D a2 & 0xff; uint32_t cc =3D 0; @@ -716,9 +735,9 @@ uint32_t HELPER(clcle)(CPUS390XState *env, uint32_t r1,= uint64_t a2, } } =20 - env->regs[r1 + 1] =3D destlen; + set_length(env, r1 + 1, destlen); /* can't use srclen here, we trunc'ed it */ - env->regs[r3 + 1] -=3D src - env->regs[r3]; + set_length(env, r3 + 1, env->regs[r3 + 1] - src - env->regs[r3]); set_address(env, r1, dest); set_address(env, r3, src); =20 --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495747040620405.2001016526357; Thu, 25 May 2017 14:17:20 -0700 (PDT) Received: from localhost ([::1]:33738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE08F-0000r2-0P for importer@patchew.org; Thu, 25 May 2017 17:17:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwc-0005e8-AG for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwa-0001LT-9K for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:18 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37420) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwa-0001KH-0v for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:16 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwY-0008RJ-4r; Thu, 25 May 2017 23:05:14 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwW-0001KE-FZ; Thu, 25 May 2017 23:05:12 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:04:57 +0200 Message-Id: <20170525210508.4910-16-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 15/26] target/s390x: fix COMPARE LOGICAL LONG EXTENDED 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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" There are multiple issues with the COMPARE LOGICAL LONG EXTENDED instruction: - The test between the two operands is inverted, leading to an inversion of the cc values 1 and 2. - The address and length of an operand continue to be decreased after reaching the end of this operand. These values are then wrong write back to the registers. - We should limit the amount of bytes to process, so that interrupts can be served correctly. Signed-off-by: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/mem_helper.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 1dc71fe5f0..bd3bce3623 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -716,28 +716,48 @@ uint32_t HELPER(clcle)(CPUS390XState *env, uint32_t r= 1, uint64_t a2, uint64_t srclen =3D get_length(env, r3 + 1); uint64_t src =3D get_address(env, r3); uint8_t pad =3D a2 & 0xff; + uint64_t len =3D MAX(srclen, destlen); uint32_t cc =3D 0; =20 if (!(destlen || srclen)) { return cc; } =20 - if (srclen > destlen) { - srclen =3D destlen; + /* Lest we fail to service interrupts in a timely manner, limit the + amount of work we're willing to do. For now, let's cap at 8k. */ + if (len > 0x2000) { + len =3D 0x2000; + cc =3D 3; } =20 - for (; destlen || srclen; src++, dest++, destlen--, srclen--) { - uint8_t v1 =3D srclen ? cpu_ldub_data_ra(env, src, ra) : pad; - uint8_t v2 =3D destlen ? cpu_ldub_data_ra(env, dest, ra) : pad; + for (; len; len--) { + uint8_t v1 =3D pad; + uint8_t v2 =3D pad; + + if (srclen) { + v1 =3D cpu_ldub_data_ra(env, src, ra); + } + if (destlen) { + v2 =3D cpu_ldub_data_ra(env, dest, ra); + } + if (v1 !=3D v2) { - cc =3D (v1 < v2) ? 1 : 2; + cc =3D (v1 > v2) ? 1 : 2; break; } + + if (srclen) { + src++; + srclen--; + } + if (destlen) { + dest++; + destlen--; + } } =20 set_length(env, r1 + 1, destlen); - /* can't use srclen here, we trunc'ed it */ - set_length(env, r3 + 1, env->regs[r3 + 1] - src - env->regs[r3]); + set_length(env, r3 + 1, srclen); set_address(env, r1, dest); set_address(env, r3, src); =20 --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495747045243726.5365985354636; Thu, 25 May 2017 14:17:25 -0700 (PDT) Received: from localhost ([::1]:33740 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE08J-0000uR-Mq for importer@patchew.org; Thu, 25 May 2017 17:17:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55255) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwc-0005fB-Vd for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwa-0001M6-Je for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:18 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37440) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwa-0001Kk-Ae for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:16 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwY-0008RM-Mu; Thu, 25 May 2017 23:05:14 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwW-0001KL-JP; Thu, 25 May 2017 23:05:12 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:04:58 +0200 Message-Id: <20170525210508.4910-17-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 16/26] target/s390x: implement COMPARE LOGICAL LONG 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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" As CLCL and CLCLE mostly differ by their operands, use a common do_clcl helper. Another difference is that CLCL is not interruptible. Signed-off-by: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 2 ++ target/s390x/mem_helper.c | 86 ++++++++++++++++++++++++++++++++----------= ---- target/s390x/translate.c | 11 ++++++ 4 files changed, 75 insertions(+), 25 deletions(-) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index e1ab8d5686..32938d99de 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -6,6 +6,7 @@ DEF_HELPER_FLAGS_4(mvc, TCG_CALL_NO_WG, void, env, i32, i64= , i64) DEF_HELPER_FLAGS_4(mvcin, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_FLAGS_4(clc, TCG_CALL_NO_WG, i32, env, i32, i64, i64) DEF_HELPER_3(mvcl, i32, env, i32, i32) +DEF_HELPER_3(clcl, i32, env, i32, i32) DEF_HELPER_FLAGS_4(clm, TCG_CALL_NO_WG, i32, env, i32, i32, i64) DEF_HELPER_FLAGS_3(divs32, TCG_CALL_NO_WG, s64, env, s64, s64) DEF_HELPER_FLAGS_3(divu32, TCG_CALL_NO_WG, i64, env, i64, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index c69e3f4216..e241c1e486 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -210,6 +210,8 @@ C(0xc60e, CLGFRL, RIL_b, GIE, r1_o, mri2_32u, 0, 0, 0, cmpu64) C(0xc607, CLHRL, RIL_b, GIE, r1_o, mri2_16u, 0, 0, 0, cmpu32) C(0xc606, CLGHRL, RIL_b, GIE, r1_o, mri2_16u, 0, 0, 0, cmpu64) +/* COMPARE LOGICAL LONG */ + C(0x0f00, CLCL, RR_a, Z, 0, 0, 0, 0, clcl, 0) /* COMPARE LOGICAL LONG EXTENDED */ C(0xa900, CLCLE, RS_a, Z, 0, a2, 0, 0, clcle, 0) /* COMPARE LOGICAL CHARACTERS UNDER MASK */ diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index bd3bce3623..aa665fe0f7 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -706,27 +706,24 @@ uint32_t HELPER(mvcle)(CPUS390XState *env, uint32_t r= 1, uint64_t a2, return cc; } =20 -/* compare logical long extended memcompare insn with padding */ -uint32_t HELPER(clcle)(CPUS390XState *env, uint32_t r1, uint64_t a2, - uint32_t r3) -{ - uintptr_t ra =3D GETPC(); - uint64_t destlen =3D get_length(env, r1 + 1); - uint64_t dest =3D get_address(env, r1); - uint64_t srclen =3D get_length(env, r3 + 1); - uint64_t src =3D get_address(env, r3); - uint8_t pad =3D a2 & 0xff; - uint64_t len =3D MAX(srclen, destlen); +/* compare logical long helper */ +static inline uint32_t do_clcl(CPUS390XState *env, + uint64_t *dest, uint64_t *destlen, + uint64_t *src, uint64_t *srclen, + uint8_t pad, uint64_t limit, + uintptr_t ra) +{ + uint64_t len =3D MAX(*srclen, *destlen); uint32_t cc =3D 0; =20 - if (!(destlen || srclen)) { + if (!(*destlen || *srclen)) { return cc; } =20 /* Lest we fail to service interrupts in a timely manner, limit the - amount of work we're willing to do. For now, let's cap at 8k. */ - if (len > 0x2000) { - len =3D 0x2000; + amount of work we're willing to do. */ + if (len > limit) { + len =3D limit; cc =3D 3; } =20 @@ -734,11 +731,11 @@ uint32_t HELPER(clcle)(CPUS390XState *env, uint32_t r= 1, uint64_t a2, uint8_t v1 =3D pad; uint8_t v2 =3D pad; =20 - if (srclen) { - v1 =3D cpu_ldub_data_ra(env, src, ra); + if (*srclen) { + v1 =3D cpu_ldub_data_ra(env, *src, ra); } - if (destlen) { - v2 =3D cpu_ldub_data_ra(env, dest, ra); + if (*destlen) { + v2 =3D cpu_ldub_data_ra(env, *dest, ra); } =20 if (v1 !=3D v2) { @@ -746,16 +743,55 @@ uint32_t HELPER(clcle)(CPUS390XState *env, uint32_t r= 1, uint64_t a2, break; } =20 - if (srclen) { - src++; - srclen--; + if (*srclen) { + *src +=3D 1; + *srclen -=3D 1; } - if (destlen) { - dest++; - destlen--; + if (*destlen) { + *dest +=3D 1; + *destlen -=3D 1; } } =20 + return cc; +} + + +/* compare logical long */ +uint32_t HELPER(clcl)(CPUS390XState *env, uint32_t r1, uint32_t r2) +{ + uintptr_t ra =3D GETPC(); + uint64_t destlen =3D extract64(env->regs[r1 + 1], 0, 24); + uint64_t dest =3D get_address(env, r1); + uint64_t srclen =3D extract64(env->regs[r2 + 1], 0, 24); + uint64_t src =3D get_address(env, r2); + uint8_t pad =3D env->regs[r2 + 1] >> 24; + uint32_t cc; + + cc =3D do_clcl(env, &dest, &destlen, &src, &srclen, pad, -1, ra); + + env->regs[r1 + 1] =3D deposit64(env->regs[r1 + 1], 0, 24, destlen); + env->regs[r2 + 1] =3D deposit64(env->regs[r2 + 1], 0, 24, srclen); + set_address(env, r1, dest); + set_address(env, r2, src); + + return cc; +} + +/* compare logical long extended memcompare insn with padding */ +uint32_t HELPER(clcle)(CPUS390XState *env, uint32_t r1, uint64_t a2, + uint32_t r3) +{ + uintptr_t ra =3D GETPC(); + uint64_t destlen =3D get_length(env, r1 + 1); + uint64_t dest =3D get_address(env, r1); + uint64_t srclen =3D get_length(env, r3 + 1); + uint64_t src =3D get_address(env, r3); + uint8_t pad =3D a2; + uint32_t cc; + + cc =3D do_clcl(env, &dest, &destlen, &src, &srclen, pad, 0x2000, ra); + set_length(env, r1 + 1, destlen); set_length(env, r3 + 1, srclen); set_address(env, r1, dest); diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 87408df07a..6f8d75bc2e 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -1911,6 +1911,17 @@ static ExitStatus op_clc(DisasContext *s, DisasOps *= o) return NO_EXIT; } =20 +static ExitStatus op_clcl(DisasContext *s, DisasOps *o) +{ + TCGv_i32 r1 =3D tcg_const_i32(get_field(s->fields, r1)); + TCGv_i32 r2 =3D tcg_const_i32(get_field(s->fields, r2)); + gen_helper_clcl(cc_op, cpu_env, r1, r2); + tcg_temp_free_i32(r1); + tcg_temp_free_i32(r2); + set_cc_static(s); + return NO_EXIT; +} + static ExitStatus op_clcle(DisasContext *s, DisasOps *o) { TCGv_i32 r1 =3D tcg_const_i32(get_field(s->fields, r1)); --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495747195685688.046924593635; Thu, 25 May 2017 14:19:55 -0700 (PDT) Received: from localhost ([::1]:33745 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE0Ak-0004GS-Az for importer@patchew.org; Thu, 25 May 2017 17:19:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwc-0005ef-MZ for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwa-0001Lq-Er for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:18 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37428) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwa-0001Kg-6D for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:16 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwY-0008RT-Hc; Thu, 25 May 2017 23:05:14 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwW-0001KS-M8; Thu, 25 May 2017 23:05:12 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:04:59 +0200 Message-Id: <20170525210508.4910-18-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 17/26] target/s390x: improve MOVE LONG and MOVE LONG EXTENDED 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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" As MVCL and MVCLE only differ by their operands, use a common do_mvcl helper. Optimize it calling fast_memmove and fast_memset. Correctly write back addresses. Signed-off-by: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/mem_helper.c | 90 +++++++++++++++++++++----------------------= ---- 1 file changed, 40 insertions(+), 50 deletions(-) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index aa665fe0f7..6add413531 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -621,49 +621,60 @@ void HELPER(stam)(CPUS390XState *env, uint32_t r1, ui= nt64_t a2, uint32_t r3) } } =20 -/* move long */ -uint32_t HELPER(mvcl)(CPUS390XState *env, uint32_t r1, uint32_t r2) +/* move long helper */ +static inline uint32_t do_mvcl(CPUS390XState *env, + uint64_t *dest, uint64_t *destlen, + uint64_t *src, uint64_t *srclen, + uint8_t pad, uintptr_t ra) { - uintptr_t ra =3D GETPC(); - uint64_t destlen =3D env->regs[r1 + 1] & 0xffffff; - uint64_t dest =3D get_address(env, r1); - uint64_t srclen =3D env->regs[r2 + 1] & 0xffffff; - uint64_t src =3D get_address(env, r2); - uint8_t pad =3D env->regs[r2 + 1] >> 24; - uint8_t v; + uint64_t len =3D MIN(*srclen, *destlen); uint32_t cc; =20 - if (destlen =3D=3D srclen) { + if (*destlen =3D=3D *srclen) { cc =3D 0; - } else if (destlen < srclen) { + } else if (*destlen < *srclen) { cc =3D 1; } else { cc =3D 2; } =20 - if (srclen > destlen) { - srclen =3D destlen; - } + /* Copy the src array */ + fast_memmove(env, *dest, *src, len, ra); + *src +=3D len; + *srclen -=3D len; + *dest +=3D len; + *destlen -=3D len; =20 - for (; destlen && srclen; src++, dest++, destlen--, srclen--) { - v =3D cpu_ldub_data_ra(env, src, ra); - cpu_stb_data_ra(env, dest, v, ra); - } + /* Pad the remaining area */ + fast_memset(env, *dest, pad, *destlen, ra); + *dest +=3D *destlen; + *destlen =3D 0; =20 - for (; destlen; dest++, destlen--) { - cpu_stb_data_ra(env, dest, pad, ra); - } + return cc; +} =20 - env->regs[r1 + 1] =3D destlen; - /* can't use srclen here, we trunc'ed it */ - env->regs[r2 + 1] -=3D src - env->regs[r2]; +/* move long */ +uint32_t HELPER(mvcl)(CPUS390XState *env, uint32_t r1, uint32_t r2) +{ + uintptr_t ra =3D GETPC(); + uint64_t destlen =3D env->regs[r1 + 1] & 0xffffff; + uint64_t dest =3D get_address(env, r1); + uint64_t srclen =3D env->regs[r2 + 1] & 0xffffff; + uint64_t src =3D get_address(env, r2); + uint8_t pad =3D env->regs[r2 + 1] >> 24; + uint32_t cc; + + cc =3D do_mvcl(env, &dest, &destlen, &src, &srclen, pad, ra); + + env->regs[r1 + 1] =3D deposit64(env->regs[r1 + 1], 0, 24, destlen); + env->regs[r2 + 1] =3D deposit64(env->regs[r2 + 1], 0, 24, srclen); set_address(env, r1, dest); set_address(env, r2, src); =20 return cc; } =20 -/* move long extended another memcopy insn with more bells and whistles */ +/* move long extended */ uint32_t HELPER(mvcle)(CPUS390XState *env, uint32_t r1, uint64_t a2, uint32_t r3) { @@ -672,34 +683,13 @@ uint32_t HELPER(mvcle)(CPUS390XState *env, uint32_t r= 1, uint64_t a2, uint64_t dest =3D get_address(env, r1); uint64_t srclen =3D get_length(env, r3 + 1); uint64_t src =3D get_address(env, r3); - uint8_t pad =3D a2 & 0xff; - uint8_t v; + uint8_t pad =3D a2; uint32_t cc; =20 - if (destlen =3D=3D srclen) { - cc =3D 0; - } else if (destlen < srclen) { - cc =3D 1; - } else { - cc =3D 2; - } - - if (srclen > destlen) { - srclen =3D destlen; - } - - for (; destlen && srclen; src++, dest++, destlen--, srclen--) { - v =3D cpu_ldub_data_ra(env, src, ra); - cpu_stb_data_ra(env, dest, v, ra); - } - - for (; destlen; dest++, destlen--) { - cpu_stb_data_ra(env, dest, pad, ra); - } + cc =3D do_mvcl(env, &dest, &destlen, &src, &srclen, pad, ra); =20 - set_length(env, r1 + 1 , destlen); - /* can't use srclen here, we trunc'ed it */ - set_length(env, r3 + 1, env->regs[r3 + 1] - src - env->regs[r3]); + set_length(env, r1 + 1, destlen); + set_length(env, r3 + 1, srclen); set_address(env, r1, dest); set_address(env, r3, src); =20 --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495747332301960.7191338846263; Thu, 25 May 2017 14:22:12 -0700 (PDT) Received: from localhost ([::1]:33762 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE0Cv-00069z-Te for importer@patchew.org; Thu, 25 May 2017 17:22:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwe-0005gz-9P for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwa-0001MR-O3 for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:20 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37442) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwa-0001Kn-DW for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:16 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwZ-0008Rq-3m; Thu, 25 May 2017 23:05:15 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwW-0001KZ-QN; Thu, 25 May 2017 23:05:12 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:05:00 +0200 Message-Id: <20170525210508.4910-19-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 18/26] target/s390x: implement COMPARE LOGICAL LONG UNICODE 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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" For that we need to make program_interrupt available to qemu-user. Fortunately there is almost nothing to change as both kvm_enabled and CONFIG_KVM evaluate to false in that case. Signed-off-by: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 2 ++ target/s390x/mem_helper.c | 76 ++++++++++++++++++++++++++++++++++++++----= ---- target/s390x/misc_helper.c | 4 +-- target/s390x/translate.c | 12 ++++++++ 5 files changed, 80 insertions(+), 15 deletions(-) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 32938d99de..1b82d1a368 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -24,6 +24,7 @@ DEF_HELPER_FLAGS_4(stam, TCG_CALL_NO_WG, void, env, i32, = i64, i32) DEF_HELPER_FLAGS_4(lam, TCG_CALL_NO_WG, void, env, i32, i64, i32) DEF_HELPER_4(mvcle, i32, env, i32, i64, i32) DEF_HELPER_4(clcle, i32, env, i32, i64, i32) +DEF_HELPER_4(clclu, i32, env, i32, i64, i32) DEF_HELPER_3(cegb, i64, env, s64, i32) DEF_HELPER_3(cdgb, i64, env, s64, i32) DEF_HELPER_3(cxgb, i64, env, s64, i32) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index e241c1e486..f9e69f9b09 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -214,6 +214,8 @@ C(0x0f00, CLCL, RR_a, Z, 0, 0, 0, 0, clcl, 0) /* COMPARE LOGICAL LONG EXTENDED */ C(0xa900, CLCLE, RS_a, Z, 0, a2, 0, 0, clcle, 0) +/* COMPARE LOGICAL LONG UNICODE */ + C(0xeb8f, CLCLU, RSY_a, E2, 0, a2, 0, 0, clclu, 0) /* COMPARE LOGICAL CHARACTERS UNDER MASK */ C(0xbd00, CLM, RS_b, Z, r1_o, a2, 0, 0, clm, 0) C(0xeb21, CLMY, RSY_b, LD, r1_o, a2, 0, 0, clm, 0) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 6add413531..7ce7daaf11 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -67,6 +67,32 @@ static inline uint32_t adj_len_to_page(uint32_t len, uin= t64_t addr) return len; } =20 +/* Trigger a SPECIFICATION exception if an address or a length is not + naturally aligned. */ +static inline void check_alignment(CPUS390XState *env, uint64_t v, + int wordsize, uintptr_t ra) +{ + if (v % wordsize) { + CPUState *cs =3D CPU(s390_env_get_cpu(env)); + cpu_restore_state(cs, ra); + program_interrupt(env, PGM_SPECIFICATION, 6); + } +} + +/* Load a value from memory according to its size. */ +static inline uint64_t cpu_ldusize_data_ra(CPUS390XState *env, uint64_t ad= dr, + int wordsize, uintptr_t ra) +{ + switch (wordsize) { + case 1: + return cpu_ldub_data_ra(env, addr, ra); + case 2: + return cpu_lduw_data_ra(env, addr, ra); + default: + abort(); + } +} + static void fast_memset(CPUS390XState *env, uint64_t dest, uint8_t byte, uint32_t l, uintptr_t ra) { @@ -700,12 +726,14 @@ uint32_t HELPER(mvcle)(CPUS390XState *env, uint32_t r= 1, uint64_t a2, static inline uint32_t do_clcl(CPUS390XState *env, uint64_t *dest, uint64_t *destlen, uint64_t *src, uint64_t *srclen, - uint8_t pad, uint64_t limit, - uintptr_t ra) + uint16_t pad, uint64_t limit, + int wordsize, uintptr_t ra) { uint64_t len =3D MAX(*srclen, *destlen); uint32_t cc =3D 0; =20 + check_alignment(env, *srclen | *destlen, wordsize, ra); + if (!(*destlen || *srclen)) { return cc; } @@ -717,15 +745,15 @@ static inline uint32_t do_clcl(CPUS390XState *env, cc =3D 3; } =20 - for (; len; len--) { - uint8_t v1 =3D pad; - uint8_t v2 =3D pad; + for (; len; len -=3D wordsize) { + uint16_t v1 =3D pad; + uint16_t v2 =3D pad; =20 if (*srclen) { - v1 =3D cpu_ldub_data_ra(env, *src, ra); + v1 =3D cpu_ldusize_data_ra(env, *src, wordsize, ra); } if (*destlen) { - v2 =3D cpu_ldub_data_ra(env, *dest, ra); + v2 =3D cpu_ldusize_data_ra(env, *dest, wordsize, ra); } =20 if (v1 !=3D v2) { @@ -734,12 +762,12 @@ static inline uint32_t do_clcl(CPUS390XState *env, } =20 if (*srclen) { - *src +=3D 1; - *srclen -=3D 1; + *src +=3D wordsize; + *srclen -=3D wordsize; } if (*destlen) { - *dest +=3D 1; - *destlen -=3D 1; + *dest +=3D wordsize; + *destlen -=3D wordsize; } } =20 @@ -758,7 +786,7 @@ uint32_t HELPER(clcl)(CPUS390XState *env, uint32_t r1, = uint32_t r2) uint8_t pad =3D env->regs[r2 + 1] >> 24; uint32_t cc; =20 - cc =3D do_clcl(env, &dest, &destlen, &src, &srclen, pad, -1, ra); + cc =3D do_clcl(env, &dest, &destlen, &src, &srclen, pad, -1, 1, ra); =20 env->regs[r1 + 1] =3D deposit64(env->regs[r1 + 1], 0, 24, destlen); env->regs[r2 + 1] =3D deposit64(env->regs[r2 + 1], 0, 24, srclen); @@ -780,7 +808,29 @@ uint32_t HELPER(clcle)(CPUS390XState *env, uint32_t r1= , uint64_t a2, uint8_t pad =3D a2; uint32_t cc; =20 - cc =3D do_clcl(env, &dest, &destlen, &src, &srclen, pad, 0x2000, ra); + cc =3D do_clcl(env, &dest, &destlen, &src, &srclen, pad, 0x2000, 1, ra= ); + + set_length(env, r1 + 1, destlen); + set_length(env, r3 + 1, srclen); + set_address(env, r1, dest); + set_address(env, r3, src); + + return cc; +} + +/* compare logical long unicode memcompare insn with padding */ +uint32_t HELPER(clclu)(CPUS390XState *env, uint32_t r1, uint64_t a2, + uint32_t r3) +{ + uintptr_t ra =3D GETPC(); + uint64_t destlen =3D get_length(env, r1 + 1); + uint64_t dest =3D get_address(env, r1); + uint64_t srclen =3D get_length(env, r3 + 1); + uint64_t src =3D get_address(env, r3); + uint16_t pad =3D a2; + uint32_t cc =3D 0; + + cc =3D do_clcl(env, &dest, &destlen, &src, &srclen, pad, 0x1000, 2, ra= ); =20 set_length(env, r1 + 1, destlen); set_length(env, r3 + 1, srclen); diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 23ec52cf35..f083c8d3cf 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -80,8 +80,6 @@ void HELPER(exception)(CPUS390XState *env, uint32_t excp) cpu_loop_exit(cs); } =20 -#ifndef CONFIG_USER_ONLY - void program_interrupt(CPUS390XState *env, uint32_t code, int ilen) { S390CPU *cpu =3D s390_env_get_cpu(env); @@ -108,6 +106,8 @@ void program_interrupt(CPUS390XState *env, uint32_t cod= e, int ilen) } } =20 +#ifndef CONFIG_USER_ONLY + /* SCLP service call */ uint32_t HELPER(servc)(CPUS390XState *env, uint64_t r1, uint64_t r2) { diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 6f8d75bc2e..2ea96c0a8f 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -1196,6 +1196,7 @@ typedef enum DisasFacility { FAC_ILA, /* interlocked access facility 1 */ FAC_LPP, /* load-program-parameter */ FAC_DAT_ENH, /* DAT-enhancement */ + FAC_E2, /* extended-translation facility 2 */ } DisasFacility; =20 struct DisasInsn { @@ -1933,6 +1934,17 @@ static ExitStatus op_clcle(DisasContext *s, DisasOps= *o) return NO_EXIT; } =20 +static ExitStatus op_clclu(DisasContext *s, DisasOps *o) +{ + TCGv_i32 r1 =3D tcg_const_i32(get_field(s->fields, r1)); + TCGv_i32 r3 =3D tcg_const_i32(get_field(s->fields, r3)); + gen_helper_clclu(cc_op, cpu_env, r1, o->in2, r3); + tcg_temp_free_i32(r1); + tcg_temp_free_i32(r3); + set_cc_static(s); + return NO_EXIT; +} + static ExitStatus op_clm(DisasContext *s, DisasOps *o) { TCGv_i32 m3 =3D tcg_const_i32(get_field(s->fields, m3)); --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495747200038104.65523264943454; Thu, 25 May 2017 14:20:00 -0700 (PDT) Received: from localhost ([::1]:33748 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE0Ao-0004Jy-JU for importer@patchew.org; Thu, 25 May 2017 17:19:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwd-0005g6-Hq for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwa-0001Lv-GV for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:19 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37436) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwa-0001Ki-9H for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:16 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwY-0008S3-Pi; Thu, 25 May 2017 23:05:14 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwW-0001Kg-Tj; Thu, 25 May 2017 23:05:12 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:05:01 +0200 Message-Id: <20170525210508.4910-20-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 19/26] target/s390x: implement MOVE LONG UNICODE 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 2 ++ target/s390x/mem_helper.c | 47 ++++++++++++++++++++++++++++++++++++++++--= ---- target/s390x/translate.c | 11 +++++++++++ 4 files changed, 55 insertions(+), 6 deletions(-) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 1b82d1a368..40b7544c4d 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -23,6 +23,7 @@ DEF_HELPER_4(ex, void, env, i32, i64, i64) DEF_HELPER_FLAGS_4(stam, TCG_CALL_NO_WG, void, env, i32, i64, i32) DEF_HELPER_FLAGS_4(lam, TCG_CALL_NO_WG, void, env, i32, i64, i32) DEF_HELPER_4(mvcle, i32, env, i32, i64, i32) +DEF_HELPER_4(mvclu, i32, env, i32, i64, i32) DEF_HELPER_4(clcle, i32, env, i32, i64, i32) DEF_HELPER_4(clclu, i32, env, i32, i64, i32) DEF_HELPER_3(cegb, i64, env, s64, i32) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index f9e69f9b09..ceaa245530 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -576,6 +576,8 @@ C(0x0e00, MVCL, RR_a, Z, 0, 0, 0, 0, mvcl, 0) /* MOVE LONG EXTENDED */ C(0xa800, MVCLE, RS_a, Z, 0, a2, 0, 0, mvcle, 0) +/* MOVE LONG UNICODE */ + C(0xeb8e, MVCLU, RSY_a, E2, 0, a2, 0, 0, mvclu, 0) /* MOVE NUMERICS */ C(0xd100, MVN, SS_a, Z, la1, a2, 0, 0, mvn, 0) /* MOVE PAGE */ diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 7ce7daaf11..134dde03c2 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -651,7 +651,7 @@ void HELPER(stam)(CPUS390XState *env, uint32_t r1, uint= 64_t a2, uint32_t r3) static inline uint32_t do_mvcl(CPUS390XState *env, uint64_t *dest, uint64_t *destlen, uint64_t *src, uint64_t *srclen, - uint8_t pad, uintptr_t ra) + uint16_t pad, int wordsize, uintptr_t ra) { uint64_t len =3D MIN(*srclen, *destlen); uint32_t cc; @@ -672,9 +672,22 @@ static inline uint32_t do_mvcl(CPUS390XState *env, *destlen -=3D len; =20 /* Pad the remaining area */ - fast_memset(env, *dest, pad, *destlen, ra); - *dest +=3D *destlen; - *destlen =3D 0; + if (wordsize =3D=3D 1) { + fast_memset(env, *dest, pad, *destlen, ra); + *dest +=3D *destlen; + *destlen =3D 0; + } else { + /* If remaining length is odd, pad with odd byte first. */ + if (*destlen & 1) { + cpu_stb_data_ra(env, *dest, pad & 0xff, ra); + *dest +=3D 1; + *destlen -=3D 1; + } + /* The remaining length is even, pad using words. */ + for (; *destlen; *dest +=3D 2, *destlen -=3D 2) { + cpu_stw_data_ra(env, *dest, pad, ra); + } + } =20 return cc; } @@ -690,7 +703,7 @@ uint32_t HELPER(mvcl)(CPUS390XState *env, uint32_t r1, = uint32_t r2) uint8_t pad =3D env->regs[r2 + 1] >> 24; uint32_t cc; =20 - cc =3D do_mvcl(env, &dest, &destlen, &src, &srclen, pad, ra); + cc =3D do_mvcl(env, &dest, &destlen, &src, &srclen, pad, 1, ra); =20 env->regs[r1 + 1] =3D deposit64(env->regs[r1 + 1], 0, 24, destlen); env->regs[r2 + 1] =3D deposit64(env->regs[r2 + 1], 0, 24, srclen); @@ -712,7 +725,29 @@ uint32_t HELPER(mvcle)(CPUS390XState *env, uint32_t r1= , uint64_t a2, uint8_t pad =3D a2; uint32_t cc; =20 - cc =3D do_mvcl(env, &dest, &destlen, &src, &srclen, pad, ra); + cc =3D do_mvcl(env, &dest, &destlen, &src, &srclen, pad, 1, ra); + + set_length(env, r1 + 1, destlen); + set_length(env, r3 + 1, srclen); + set_address(env, r1, dest); + set_address(env, r3, src); + + return cc; +} + +/* move long unicode */ +uint32_t HELPER(mvclu)(CPUS390XState *env, uint32_t r1, uint64_t a2, + uint32_t r3) +{ + uintptr_t ra =3D GETPC(); + uint64_t destlen =3D get_length(env, r1 + 1); + uint64_t dest =3D get_address(env, r1); + uint64_t srclen =3D get_length(env, r3 + 1); + uint64_t src =3D get_address(env, r3); + uint16_t pad =3D a2; + uint32_t cc; + + cc =3D do_mvcl(env, &dest, &destlen, &src, &srclen, pad, 2, ra); =20 set_length(env, r1 + 1, destlen); set_length(env, r3 + 1, srclen); diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 2ea96c0a8f..4ecda97997 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -2978,6 +2978,17 @@ static ExitStatus op_mvcle(DisasContext *s, DisasOps= *o) return NO_EXIT; } =20 +static ExitStatus op_mvclu(DisasContext *s, DisasOps *o) +{ + TCGv_i32 r1 =3D tcg_const_i32(get_field(s->fields, r1)); + TCGv_i32 r3 =3D tcg_const_i32(get_field(s->fields, r3)); + gen_helper_mvclu(cc_op, cpu_env, r1, o->in2, r3); + tcg_temp_free_i32(r1); + tcg_temp_free_i32(r3); + set_cc_static(s); + return NO_EXIT; +} + #ifndef CONFIG_USER_ONLY static ExitStatus op_mvcp(DisasContext *s, DisasOps *o) { --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495747042851783.7107329342749; Thu, 25 May 2017 14:17:22 -0700 (PDT) Received: from localhost ([::1]:33739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE08G-0000re-9a for importer@patchew.org; Thu, 25 May 2017 17:17:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwd-0005fx-EZ for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwb-0001NI-Ng for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:19 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37466) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwb-0001M2-FI for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:17 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwZ-0008SF-NA; Thu, 25 May 2017 23:05:15 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwX-0001Kn-15; Thu, 25 May 2017 23:05:13 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:05:02 +0200 Message-Id: <20170525210508.4910-21-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 20/26] target/s390x: implement PACK ASCII 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 2 ++ target/s390x/mem_helper.c | 35 +++++++++++++++++++++++++++++++++++ target/s390x/translate.c | 16 ++++++++++++++++ 4 files changed, 54 insertions(+) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 40b7544c4d..253e1e679c 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -83,6 +83,7 @@ DEF_HELPER_FLAGS_2(sqdb, TCG_CALL_NO_WG, i64, env, i64) DEF_HELPER_FLAGS_3(sqxb, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_1(cvd, TCG_CALL_NO_RWG_SE, i64, s32) DEF_HELPER_FLAGS_4(pack, TCG_CALL_NO_WG, void, env, i32, i64, i64) +DEF_HELPER_FLAGS_4(pka, TCG_CALL_NO_WG, void, env, i64, i64, i32) DEF_HELPER_FLAGS_4(unpk, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_FLAGS_4(tr, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_4(tre, i64, env, i64, i64, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index ceaa245530..b6d2215d85 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -661,6 +661,8 @@ /* Really format SS_b, but we pack both lengths into one argument for the helper call, so we might as well leave one 8-bit field. */ C(0xf200, PACK, SS_a, Z, la1, a2, 0, 0, pack, 0) +/* PACK ASCII */ + C(0xe900, PKA, SS_f, E2, la1, a2, 0, 0, pka, 0) =20 /* PREFETCH */ /* Implemented as nops of course. */ diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 134dde03c2..6d64497edc 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -959,6 +959,41 @@ void HELPER(pack)(CPUS390XState *env, uint32_t len, ui= nt64_t dest, uint64_t src) } } =20 +void HELPER(pka)(CPUS390XState *env, uint64_t dest, uint64_t src, + uint32_t srclen) +{ + uintptr_t ra =3D GETPC(); + int i; + /* The destination operand is always 16 bytes long. */ + const int destlen =3D 16; + + /* The operands are processed from right to left. */ + src +=3D srclen - 1; + dest +=3D destlen - 1; + + for (i =3D 0; i < destlen; i++) { + uint8_t b =3D 0; + + /* Start with a positive sign */ + if (i =3D=3D 0) { + b =3D 0xc; + } else if (srclen > 1) { + b =3D cpu_ldub_data_ra(env, src, ra) & 0x0f; + src--; + srclen--; + } + + if (srclen > 1) { + b |=3D cpu_ldub_data_ra(env, src, ra) << 4; + src--; + srclen--; + } + + cpu_stb_data_ra(env, dest, b, ra); + dest--; + } +} + void HELPER(unpk)(CPUS390XState *env, uint32_t len, uint64_t dest, uint64_t src) { diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 4ecda97997..c74a80bf60 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3226,6 +3226,22 @@ static ExitStatus op_pack(DisasContext *s, DisasOps = *o) return NO_EXIT; } =20 +static ExitStatus op_pka(DisasContext *s, DisasOps *o) +{ + int l2 =3D get_field(s->fields, l2) + 1; + TCGv_i32 l; + + /* The length must not exceed 32 bytes. */ + if (l2 > 32) { + gen_program_exception(s, PGM_SPECIFICATION); + return EXIT_NORETURN; + } + l =3D tcg_const_i32(l2); + gen_helper_pka(cpu_env, o->addr1, o->in2, l); + tcg_temp_free_i32(l); + return NO_EXIT; +} + static ExitStatus op_popcnt(DisasContext *s, DisasOps *o) { gen_helper_popcnt(o->out, o->in2); --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495747197101750.2793786866847; Thu, 25 May 2017 14:19:57 -0700 (PDT) Received: from localhost ([::1]:33746 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE0Al-0004HH-QI for importer@patchew.org; Thu, 25 May 2017 17:19:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwd-0005g3-GA for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwb-0001NQ-PG for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:19 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37470) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwb-0001MP-EJ for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:17 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwZ-0008SK-LE; Thu, 25 May 2017 23:05:15 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwX-0001Ku-51; Thu, 25 May 2017 23:05:13 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:05:03 +0200 Message-Id: <20170525210508.4910-22-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 21/26] target/s390x: implement PACK UNICODE 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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" Use a common helper with PACK ASCII as the differences are limited to the stride of the source operand. Signed-off-by: Aurelien Jarno --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 2 ++ target/s390x/mem_helper.c | 30 +++++++++++++++++++++--------- target/s390x/translate.c | 16 ++++++++++++++++ 4 files changed, 40 insertions(+), 9 deletions(-) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 253e1e679c..1011df122d 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -84,6 +84,7 @@ DEF_HELPER_FLAGS_3(sqxb, TCG_CALL_NO_WG, i64, env, i64, i= 64) DEF_HELPER_FLAGS_1(cvd, TCG_CALL_NO_RWG_SE, i64, s32) DEF_HELPER_FLAGS_4(pack, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_FLAGS_4(pka, TCG_CALL_NO_WG, void, env, i64, i64, i32) +DEF_HELPER_FLAGS_4(pku, TCG_CALL_NO_WG, void, env, i64, i64, i32) DEF_HELPER_FLAGS_4(unpk, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_FLAGS_4(tr, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_4(tre, i64, env, i64, i64, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index b6d2215d85..3335270182 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -663,6 +663,8 @@ C(0xf200, PACK, SS_a, Z, la1, a2, 0, 0, pack, 0) /* PACK ASCII */ C(0xe900, PKA, SS_f, E2, la1, a2, 0, 0, pka, 0) +/* PACK UNICODE */ + C(0xe100, PKU, SS_f, E2, la1, a2, 0, 0, pku, 0) =20 /* PREFETCH */ /* Implemented as nops of course. */ diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 6d64497edc..ab34a309ce 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -959,10 +959,9 @@ void HELPER(pack)(CPUS390XState *env, uint32_t len, ui= nt64_t dest, uint64_t src) } } =20 -void HELPER(pka)(CPUS390XState *env, uint64_t dest, uint64_t src, - uint32_t srclen) +static inline void do_pkau(CPUS390XState *env, uint64_t dest, uint64_t src, + uint32_t srclen, int ssize, uintptr_t ra) { - uintptr_t ra =3D GETPC(); int i; /* The destination operand is always 16 bytes long. */ const int destlen =3D 16; @@ -977,16 +976,16 @@ void HELPER(pka)(CPUS390XState *env, uint64_t dest, u= int64_t src, /* Start with a positive sign */ if (i =3D=3D 0) { b =3D 0xc; - } else if (srclen > 1) { + } else if (srclen > ssize) { b =3D cpu_ldub_data_ra(env, src, ra) & 0x0f; - src--; - srclen--; + src -=3D ssize; + srclen -=3D ssize; } =20 - if (srclen > 1) { + if (srclen > ssize) { b |=3D cpu_ldub_data_ra(env, src, ra) << 4; - src--; - srclen--; + src -=3D ssize; + srclen -=3D ssize; } =20 cpu_stb_data_ra(env, dest, b, ra); @@ -994,6 +993,19 @@ void HELPER(pka)(CPUS390XState *env, uint64_t dest, ui= nt64_t src, } } =20 + +void HELPER(pka)(CPUS390XState *env, uint64_t dest, uint64_t src, + uint32_t srclen) +{ + do_pkau(env, dest, src, srclen, 1, GETPC()); +} + +void HELPER(pku)(CPUS390XState *env, uint64_t dest, uint64_t src, + uint32_t srclen) +{ + do_pkau(env, dest, src, srclen, 2, GETPC()); +} + void HELPER(unpk)(CPUS390XState *env, uint32_t len, uint64_t dest, uint64_t src) { diff --git a/target/s390x/translate.c b/target/s390x/translate.c index c74a80bf60..a2a27c86ea 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3242,6 +3242,22 @@ static ExitStatus op_pka(DisasContext *s, DisasOps *= o) return NO_EXIT; } =20 +static ExitStatus op_pku(DisasContext *s, DisasOps *o) +{ + int l2 =3D get_field(s->fields, l2) + 1; + TCGv_i32 l; + + /* The length must be even and should not exceed 64 bytes. */ + if ((l2 & 1) || (l2 > 64)) { + gen_program_exception(s, PGM_SPECIFICATION); + return EXIT_NORETURN; + } + l =3D tcg_const_i32(l2); + gen_helper_pku(cpu_env, o->addr1, o->in2, l); + tcg_temp_free_i32(l); + return NO_EXIT; +} + static ExitStatus op_popcnt(DisasContext *s, DisasOps *o) { gen_helper_popcnt(o->out, o->in2); --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495746886096717.7461978448515; Thu, 25 May 2017 14:14:46 -0700 (PDT) Received: from localhost ([::1]:33724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE05k-0007A8-Os for importer@patchew.org; Thu, 25 May 2017 17:14:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwd-0005gO-Ps for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwb-0001NV-Pn for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:19 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37482) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwb-0001Mf-GV for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:17 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwZ-0008SM-N7; Thu, 25 May 2017 23:05:16 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwX-0001L1-8a; Thu, 25 May 2017 23:05:13 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:05:04 +0200 Message-Id: <20170525210508.4910-23-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 22/26] target/s390x: implement UNPACK ASCII 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 2 ++ target/s390x/mem_helper.c | 51 ++++++++++++++++++++++++++++++++++++++++++= ++++ target/s390x/translate.c | 17 ++++++++++++++++ 4 files changed, 71 insertions(+) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 1011df122d..ffc0588e83 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -86,6 +86,7 @@ DEF_HELPER_FLAGS_4(pack, TCG_CALL_NO_WG, void, env, i32, = i64, i64) DEF_HELPER_FLAGS_4(pka, TCG_CALL_NO_WG, void, env, i64, i64, i32) DEF_HELPER_FLAGS_4(pku, TCG_CALL_NO_WG, void, env, i64, i64, i32) DEF_HELPER_FLAGS_4(unpk, TCG_CALL_NO_WG, void, env, i32, i64, i64) +DEF_HELPER_FLAGS_4(unpka, TCG_CALL_NO_WG, i32, env, i64, i32, i64) DEF_HELPER_FLAGS_4(tr, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_4(tre, i64, env, i64, i64, i64) DEF_HELPER_4(trt, i32, env, i32, i64, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 3335270182..b0c0ea6687 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -869,6 +869,8 @@ /* Really format SS_b, but we pack both lengths into one argument for the helper call, so we might as well leave one 8-bit field. */ C(0xf300, UNPK, SS_a, Z, la1, a2, 0, 0, unpk, 0) +/* UNPACK ASCII */ + C(0xea00, UNPKA, SS_a, E2, la1, a2, 0, 0, unpka, 0) =20 #ifndef CONFIG_USER_ONLY /* COMPARE AND SWAP AND PURGE */ diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index ab34a309ce..aaabc63000 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -1053,6 +1053,57 @@ void HELPER(unpk)(CPUS390XState *env, uint32_t len, = uint64_t dest, } } =20 +uint32_t HELPER(unpka)(CPUS390XState *env, uint64_t dest, uint32_t destlen, + uint64_t src) +{ + uintptr_t ra =3D GETPC(); + int i; + uint32_t cc; + uint8_t b; + /* The source operand is always 16 bytes long. */ + const int srclen =3D 16; + + /* The operands are processed from right to left. */ + src +=3D srclen - 1; + dest +=3D destlen - 1; + + /* Check for the sign. */ + b =3D cpu_ldub_data_ra(env, src, ra); + src--; + switch (b & 0xf) { + case 0xa: + case 0xc: + case 0xe ... 0xf: + cc =3D 0; /* plus */ + break; + case 0xb: + case 0xd: + cc =3D 1; /* minus */ + break; + default: + case 0x0 ... 0x9: + cc =3D 3; /* invalid */ + break; + } + + /* Now pad every nibble with 0x30, advancing one nibble at a time. */ + for (i =3D 0; i < destlen; i++) { + if (i =3D=3D 31) { + /* If length is 32 bytes, the leftmost byte is 0. */ + b =3D 0; + } else if (i % 2) { + b =3D cpu_ldub_data_ra(env, src, ra); + src--; + } else { + b >>=3D 4; + } + cpu_stb_data_ra(env, dest, 0x30 + (b & 0xf), ra); + dest--; + } + + return cc; +} + static void do_helper_tr(CPUS390XState *env, uint32_t len, uint64_t array, uint64_t trans, uintptr_t ra) { diff --git a/target/s390x/translate.c b/target/s390x/translate.c index a2a27c86ea..590ff96301 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -4295,6 +4295,23 @@ static ExitStatus op_unpk(DisasContext *s, DisasOps = *o) return NO_EXIT; } =20 +static ExitStatus op_unpka(DisasContext *s, DisasOps *o) +{ + int l1 =3D get_field(s->fields, l1) + 1; + TCGv_i32 l; + + /* The length must not exceed 32 bytes. */ + if (l1 > 32) { + gen_program_exception(s, PGM_SPECIFICATION); + return EXIT_NORETURN; + } + l =3D tcg_const_i32(l1); + gen_helper_unpka(cc_op, cpu_env, o->addr1, l, o->in2); + tcg_temp_free_i32(l); + set_cc_static(s); + return NO_EXIT; +} + static ExitStatus op_xc(DisasContext *s, DisasOps *o) { int d1 =3D get_field(s->fields, d1); --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 14957473285321023.2352304080254; Thu, 25 May 2017 14:22:08 -0700 (PDT) Received: from localhost ([::1]:33761 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE0Ct-000688-5v for importer@patchew.org; Thu, 25 May 2017 17:22:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwe-0005h4-Ah for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwc-0001Nq-0m for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:20 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37494) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwb-0001Ms-PG for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:17 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwZ-0008SO-QO; Thu, 25 May 2017 23:05:16 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwX-0001L8-CD; Thu, 25 May 2017 23:05:13 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:05:05 +0200 Message-Id: <20170525210508.4910-24-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 23/26] target/s390x: implement UNPACK UNICODE 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 2 ++ target/s390x/mem_helper.c | 50 ++++++++++++++++++++++++++++++++++++------= ---- target/s390x/translate.c | 18 +++++++++++++++++ 4 files changed, 61 insertions(+), 10 deletions(-) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index ffc0588e83..8d94018a3f 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -87,6 +87,7 @@ DEF_HELPER_FLAGS_4(pka, TCG_CALL_NO_WG, void, env, i64, i= 64, i32) DEF_HELPER_FLAGS_4(pku, TCG_CALL_NO_WG, void, env, i64, i64, i32) DEF_HELPER_FLAGS_4(unpk, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_FLAGS_4(unpka, TCG_CALL_NO_WG, i32, env, i64, i32, i64) +DEF_HELPER_FLAGS_4(unpku, TCG_CALL_NO_WG, i32, env, i64, i32, i64) DEF_HELPER_FLAGS_4(tr, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_4(tre, i64, env, i64, i64, i64) DEF_HELPER_4(trt, i32, env, i32, i64, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index b0c0ea6687..56928c24a5 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -871,6 +871,8 @@ C(0xf300, UNPK, SS_a, Z, la1, a2, 0, 0, unpk, 0) /* UNPACK ASCII */ C(0xea00, UNPKA, SS_a, E2, la1, a2, 0, 0, unpka, 0) +/* UNPACK UNICODE */ + C(0xe200, UNPKU, SS_a, E2, la1, a2, 0, 0, unpku, 0) =20 #ifndef CONFIG_USER_ONLY /* COMPARE AND SWAP AND PURGE */ diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index aaabc63000..3366c2e799 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -93,6 +93,23 @@ static inline uint64_t cpu_ldusize_data_ra(CPUS390XState= *env, uint64_t addr, } } =20 +/* Store a to memory according to its size. */ +static inline void cpu_stsize_data_ra(CPUS390XState *env, uint64_t addr, + uint64_t value, int wordsize, + uintptr_t ra) +{ + switch (wordsize) { + case 1: + cpu_stb_data_ra(env, addr, value, ra); + break; + case 2: + cpu_stw_data_ra(env, addr, value, ra); + break; + default: + abort(); + } +} + static void fast_memset(CPUS390XState *env, uint64_t dest, uint8_t byte, uint32_t l, uintptr_t ra) { @@ -1053,10 +1070,10 @@ void HELPER(unpk)(CPUS390XState *env, uint32_t len,= uint64_t dest, } } =20 -uint32_t HELPER(unpka)(CPUS390XState *env, uint64_t dest, uint32_t destlen, - uint64_t src) +static inline uint32_t do_unpkau(CPUS390XState *env, uint64_t dest, + uint32_t destlen, int dsize, uint64_t src, + uintptr_t ra) { - uintptr_t ra =3D GETPC(); int i; uint32_t cc; uint8_t b; @@ -1065,7 +1082,7 @@ uint32_t HELPER(unpka)(CPUS390XState *env, uint64_t d= est, uint32_t destlen, =20 /* The operands are processed from right to left. */ src +=3D srclen - 1; - dest +=3D destlen - 1; + dest +=3D destlen - dsize; =20 /* Check for the sign. */ b =3D cpu_ldub_data_ra(env, src, ra); @@ -1087,23 +1104,36 @@ uint32_t HELPER(unpka)(CPUS390XState *env, uint64_t= dest, uint32_t destlen, } =20 /* Now pad every nibble with 0x30, advancing one nibble at a time. */ - for (i =3D 0; i < destlen; i++) { - if (i =3D=3D 31) { - /* If length is 32 bytes, the leftmost byte is 0. */ + for (i =3D 0; i < destlen; i +=3D dsize) { + if (i =3D=3D (31 * dsize)) { + /* If length is 32/64 bytes, the leftmost byte is 0. */ b =3D 0; - } else if (i % 2) { + } else if (i % (2 * dsize)) { b =3D cpu_ldub_data_ra(env, src, ra); src--; } else { b >>=3D 4; } - cpu_stb_data_ra(env, dest, 0x30 + (b & 0xf), ra); - dest--; + cpu_stsize_data_ra(env, dest, 0x30 + (b & 0xf), dsize, ra); + dest -=3D dsize; } =20 return cc; } =20 + +uint32_t HELPER(unpka)(CPUS390XState *env, uint64_t dest, uint32_t destlen, + uint64_t src) +{ + return do_unpkau(env, dest, destlen, 1, src, GETPC()); +} + +uint32_t HELPER(unpku)(CPUS390XState *env, uint64_t dest, uint32_t destlen, + uint64_t src) +{ + return do_unpkau(env, dest, destlen, 2, src, GETPC()); +} + static void do_helper_tr(CPUS390XState *env, uint32_t len, uint64_t array, uint64_t trans, uintptr_t ra) { diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 590ff96301..d9a6a92984 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -4312,6 +4312,24 @@ static ExitStatus op_unpka(DisasContext *s, DisasOps= *o) return NO_EXIT; } =20 +static ExitStatus op_unpku(DisasContext *s, DisasOps *o) +{ + int l1 =3D get_field(s->fields, l1) + 1; + TCGv_i32 l; + + /* The length must be even and should not exceed 64 bytes. */ + if ((l1 & 1) || (l1 > 64)) { + gen_program_exception(s, PGM_SPECIFICATION); + return EXIT_NORETURN; + } + l =3D tcg_const_i32(l1); + gen_helper_unpku(cc_op, cpu_env, o->addr1, l, o->in2); + tcg_temp_free_i32(l); + set_cc_static(s); + return NO_EXIT; +} + + static ExitStatus op_xc(DisasContext *s, DisasOps *o) { int d1 =3D get_field(s->fields, d1); --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495747435844314.59500878115887; Thu, 25 May 2017 14:23:55 -0700 (PDT) Received: from localhost ([::1]:33773 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE0Eb-0000RJ-IJ for importer@patchew.org; Thu, 25 May 2017 17:23:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwe-0005he-OT for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwb-0001NO-OO for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:20 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37476) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwb-0001Mc-Gc for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:17 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwZ-0008SR-QX; Thu, 25 May 2017 23:05:16 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwX-0001LF-Fb; Thu, 25 May 2017 23:05:13 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:05:06 +0200 Message-Id: <20170525210508.4910-25-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 24/26] target/s390x: implement TEST DECIMAL 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 3 +++ target/s390x/mem_helper.c | 23 +++++++++++++++++++++++ target/s390x/translate.c | 9 +++++++++ 4 files changed, 36 insertions(+) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 8d94018a3f..7bfb0223ce 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -88,6 +88,7 @@ DEF_HELPER_FLAGS_4(pku, TCG_CALL_NO_WG, void, env, i64, i= 64, i32) DEF_HELPER_FLAGS_4(unpk, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_FLAGS_4(unpka, TCG_CALL_NO_WG, i32, env, i64, i32, i64) DEF_HELPER_FLAGS_4(unpku, TCG_CALL_NO_WG, i32, env, i64, i32, i64) +DEF_HELPER_FLAGS_3(tp, TCG_CALL_NO_WG, i32, env, i64, i32) DEF_HELPER_FLAGS_4(tr, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_4(tre, i64, env, i64, i64, i64) DEF_HELPER_4(trt, i32, env, i32, i64, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 56928c24a5..c0fe04e45c 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -850,6 +850,9 @@ C(0xed11, TCDB, RXE, Z, f1_o, a2, 0, 0, tcdb, 0) C(0xed12, TCXB, RXE, Z, x1_o, a2, 0, 0, tcxb, 0) =20 +/* TEST DECIMAL */ + C(0xebc0, TP, RSL, E2, la1, 0, 0, 0, tp, 0) + /* TEST UNDER MASK */ C(0x9100, TM, SI, Z, m1_8u, i2_8u, 0, 0, 0, tm32) C(0xeb51, TMY, SIY, LD, m1_8u, i2_8u, 0, 0, 0, tm32) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 3366c2e799..b6e083c7e1 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -1134,6 +1134,29 @@ uint32_t HELPER(unpku)(CPUS390XState *env, uint64_t = dest, uint32_t destlen, return do_unpkau(env, dest, destlen, 2, src, GETPC()); } =20 +uint32_t HELPER(tp)(CPUS390XState *env, uint64_t dest, uint32_t destlen) +{ + uintptr_t ra =3D GETPC(); + uint32_t cc =3D 0; + int i; + + for (i =3D 0; i < destlen; i++) { + uint8_t b =3D cpu_ldub_data_ra(env, dest + i, ra); + /* digit */ + cc |=3D (b & 0xf0) > 0x90 ? 2 : 0; + + if (i =3D=3D (destlen - 1)) { + /* sign */ + cc |=3D (b & 0xf) < 0xa ? 1 : 0; + } else { + /* digit */ + cc |=3D (b & 0xf) > 0x9 ? 2 : 0; + } + } + + return cc; +} + static void do_helper_tr(CPUS390XState *env, uint32_t len, uint64_t array, uint64_t trans, uintptr_t ra) { diff --git a/target/s390x/translate.c b/target/s390x/translate.c index d9a6a92984..b51342583e 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -4251,6 +4251,15 @@ static ExitStatus op_tprot(DisasContext *s, DisasOps= *o) =20 #endif =20 +static ExitStatus op_tp(DisasContext *s, DisasOps *o) +{ + TCGv_i32 l1 =3D tcg_const_i32(get_field(s->fields, l1) + 1); + gen_helper_tp(cc_op, cpu_env, o->addr1, l1); + tcg_temp_free_i32(l1); + set_cc_static(s); + return NO_EXIT; +} + static ExitStatus op_tr(DisasContext *s, DisasOps *o) { TCGv_i32 l =3D tcg_const_i32(get_field(s->fields, l1)); --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495747327996507.7711406372687; Thu, 25 May 2017 14:22:07 -0700 (PDT) Received: from localhost ([::1]:33760 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE0Cs-00067P-L8 for importer@patchew.org; Thu, 25 May 2017 17:22:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwe-0005gi-18 for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwb-0001Ni-Pp for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:19 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37490) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwb-0001Mo-J6 for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:17 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwZ-0008SS-SS; Thu, 25 May 2017 23:05:16 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwX-0001LM-J3; Thu, 25 May 2017 23:05:13 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:05:07 +0200 Message-Id: <20170525210508.4910-26-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 25/26] target/s390x: implement TRANSLATE ONE/TWO TO ONE/TWO 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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: Aurelien Jarno --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 9 +++++++++ target/s390x/mem_helper.c | 46 ++++++++++++++++++++++++++++++++++++++++++= ++++ target/s390x/translate.c | 13 +++++++++++++ 4 files changed, 69 insertions(+) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 7bfb0223ce..e469011196 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -92,6 +92,7 @@ DEF_HELPER_FLAGS_3(tp, TCG_CALL_NO_WG, i32, env, i64, i32) DEF_HELPER_FLAGS_4(tr, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_4(tre, i64, env, i64, i64, i64) DEF_HELPER_4(trt, i32, env, i32, i64, i64) +DEF_HELPER_4(trXX, i32, env, i32, i32, i32) DEF_HELPER_4(cksm, i64, env, i64, i64, i64) DEF_HELPER_FLAGS_5(calc_cc, TCG_CALL_NO_RWG_SE, i32, env, i32, i64, i64, i= 64) DEF_HELPER_FLAGS_2(sfpc, TCG_CALL_NO_RWG, void, env, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index c0fe04e45c..68364dfec3 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -868,6 +868,15 @@ /* TRANSLATE EXTENDED */ C(0xb2a5, TRE, RRE, Z, 0, r2, r1_P, 0, tre, 0) =20 +/* TRANSLATE ONE TO ONE */ + C(0xb993, TROO, RRF_c, E2, 0, 0, 0, 0, trXX, 0) +/* TRANSLATE ONE TO TWO */ + C(0xb992, TROT, RRF_c, E2, 0, 0, 0, 0, trXX, 0) +/* TRANSLATE TWO TO ONE */ + C(0xb991, TRTO, RRF_c, E2, 0, 0, 0, 0, trXX, 0) +/* TRANSLATE TWO TO TWO */ + C(0xb990, TRTT, RRF_c, E2, 0, 0, 0, 0, trXX, 0) + /* UNPACK */ /* Really format SS_b, but we pack both lengths into one argument for the helper call, so we might as well leave one 8-bit field. */ diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index b6e083c7e1..47e772bb12 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -1240,6 +1240,52 @@ uint32_t HELPER(trt)(CPUS390XState *env, uint32_t le= n, uint64_t array, return do_helper_trt(env, len, array, trans, GETPC()); } =20 +/* Translate one/two to one/two */ +uint32_t HELPER(trXX)(CPUS390XState *env, uint32_t r1, uint32_t r2, + uint32_t sizes) +{ + uintptr_t ra =3D GETPC(); + int dsize =3D (sizes & 1) ? 1 : 2; + int ssize =3D (sizes & 2) ? 1 : 2; + uint16_t tst =3D env->regs[0] & ((1 << (8 * dsize)) - 1); + uint64_t tbl =3D get_address(env, 1) & ~7; + uint64_t dst =3D get_address(env, r1); + uint64_t len =3D get_length(env, r1 + 1); + uint64_t src =3D get_address(env, r2); + uint32_t cc =3D 3; + int i; + + check_alignment(env, len, ssize, ra); + + /* Lest we fail to service interrupts in a timely manner, */ + /* limit the amount of work we're willing to do. */ + for (i =3D 0; i < 0x2000; i++) { + uint16_t sval =3D cpu_ldusize_data_ra(env, src, ssize, ra); + uint64_t tble =3D tbl + (sval * dsize); + uint16_t dval =3D cpu_ldusize_data_ra(env, tble, dsize, ra); + if (dval =3D=3D tst) { + cc =3D 1; + break; + } + cpu_stsize_data_ra(env, dst, dval, dsize, ra); + + len -=3D ssize; + src +=3D ssize; + dst +=3D dsize; + + if (len =3D=3D 0) { + cc =3D 0; + break; + } + } + + set_address(env, r1, dst); + set_length(env, r1 + 1, len); + set_address(env, r2, src); + + return cc; +} + void HELPER(cdsg)(CPUS390XState *env, uint64_t addr, uint32_t r1, uint32_t r3) { diff --git a/target/s390x/translate.c b/target/s390x/translate.c index b51342583e..38c4bf1812 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -4286,6 +4286,19 @@ static ExitStatus op_trt(DisasContext *s, DisasOps *= o) return NO_EXIT; } =20 +static ExitStatus op_trXX(DisasContext *s, DisasOps *o) +{ + TCGv_i32 r1 =3D tcg_const_i32(get_field(s->fields, r1)); + TCGv_i32 r2 =3D tcg_const_i32(get_field(s->fields, r2)); + TCGv_i32 sizes =3D tcg_const_i32(s->insn->opc & 3); + gen_helper_trXX(cc_op, cpu_env, r1, r2, sizes); + tcg_temp_free_i32(r1); + tcg_temp_free_i32(r2); + tcg_temp_free_i32(sizes); + set_cc_static(s); + return NO_EXIT; +} + static ExitStatus op_ts(DisasContext *s, DisasOps *o) { TCGv_i32 t1 =3D tcg_const_i32(0xff); --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495746891584131.3146946431724; Thu, 25 May 2017 14:14:51 -0700 (PDT) Received: from localhost ([::1]:33727 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE05p-0007Ds-9b for importer@patchew.org; Thu, 25 May 2017 17:14:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDzwc-0005ev-Td for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDzwb-0001Nb-PZ for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:18 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:37488) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDzwb-0001Mk-Ho for qemu-devel@nongnu.org; Thu, 25 May 2017 17:05:17 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dDzwZ-0008SU-SI; Thu, 25 May 2017 23:05:16 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dDzwX-0001LT-M9; Thu, 25 May 2017 23:05:13 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 23:05:08 +0200 Message-Id: <20170525210508.4910-27-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 26/26] target/s390x: update maximum TCG model to z800 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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" Now that the extended-translation facility 2 has been fully implemented, it's possible to emulated a most a z800 CPU with TCG. Signed-off-by: Aurelien Jarno --- target/s390x/cpu_models.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 8d27363b07..9c4227d2dd 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -670,8 +670,8 @@ static S390CPUModel *get_max_cpu_model(Error **errp) if (kvm_enabled()) { kvm_s390_get_host_cpu_model(&max_model, errp); } else { - /* TCG emulates a z900 */ - max_model.def =3D &s390_cpu_defs[0]; + /* TCG emulates at most a z800 */ + max_model.def =3D &s390_cpu_defs[3]; bitmap_copy(max_model.features, max_model.def->default_feat, S390_FEAT_MAX); } --=20 2.11.0 From nobody Sat Apr 27 15:51:23 2024 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.zoho.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 1495758792514801.805809903552; Thu, 25 May 2017 17:33:12 -0700 (PDT) Received: from localhost ([::1]:34260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE3Bm-0004So-Ir for importer@patchew.org; Thu, 25 May 2017 20:33:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dE3Av-0003Hc-Pp for qemu-devel@nongnu.org; Thu, 25 May 2017 20:32:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dE3Au-0007cg-TF for qemu-devel@nongnu.org; Thu, 25 May 2017 20:32:17 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:38692) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dE3Au-0007ca-N2 for qemu-devel@nongnu.org; Thu, 25 May 2017 20:32:16 -0400 Received: from [2001:bc8:30d7:121:cc44:2c6c:4d9c:42c0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dE3Ar-0007vt-2Z; Fri, 26 May 2017 02:32:13 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dE3Aq-0000oy-BF; Fri, 26 May 2017 02:32:12 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Fri, 26 May 2017 02:32:07 +0200 Message-Id: <20170526003207.3101-1-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525210508.4910-1-aurelien@aurel32.net> References: <20170525210508.4910-1-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH 27/26] target/s390x: fix adj_len_to_page 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: Alexander Graf , Aurelien Jarno , Richard Henderson 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" adj_len_to_page doesn't return the correct result when the address is already page aligned and the length is bigger than a page. Fix that. Signed-off-by: Aurelien Jarno Reviewed-by: Richard Henderson --- target/s390x/mem_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) The patch 17 (improve MOVE LONG and MOVE LONG EXTENDED) triggered a bug in adj_len_to_page. This is the fix, I just didn't want to respin the series just for that. diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 6add413531..7841808fa2 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -61,7 +61,7 @@ static inline uint32_t adj_len_to_page(uint32_t len, uint= 64_t addr) { #ifndef CONFIG_USER_ONLY if ((addr & ~TARGET_PAGE_MASK) + len - 1 >=3D TARGET_PAGE_SIZE) { - return -addr & ~TARGET_PAGE_MASK; + return (~addr & ~TARGET_PAGE_MASK) + 1; } #endif return len; --=20 2.11.0