From nobody Fri May 3 11:43:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1571162129; cv=none; d=zoho.com; s=zohoarc; b=bWE3F46nZ+4g5XaslRaQ77TQxIfns2z7ldJHdB9XxNjWQF/pW8j5QA+1ICkGslJFWtJvwSM2CGsTVI8svORpQxBYErICJ/BhQIdNlDTinGu+SkpZCwrOAgT1kqSgCpx4CZ6qzWjhBip9ZXuoJLmhySR+jYSolmFhlwgN0J5Yxns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571162129; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1C7c6L0AKcXy94kRypeBSB6XHbsCm+dRfwVNJ4dwo8Q=; b=DBNUvX1ryOERYdrsnOUiZyU7JX9Xid4OVkSqSAWN40jXdjqbtXBbMZ9defyQ2NapCSnbZmDUJfeLcQ3e0259v/Nngo7OFMPivSe7cdkOfTA9txtXFquM92l//XHMCqk2VZDsXpek8pbU5dP1k7LAXLizeRJ3a3DlFt0VXdm/o3U= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571162128963578.9518085009068; Tue, 15 Oct 2019 10:55:28 -0700 (PDT) Received: from localhost ([::1]:55182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKR2b-00083e-Ij for importer@patchew.org; Tue, 15 Oct 2019 13:55:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54596) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKQyy-0004wl-JM for qemu-devel@nongnu.org; Tue, 15 Oct 2019 13:51:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iKQyw-0003PV-Gj for qemu-devel@nongnu.org; Tue, 15 Oct 2019 13:51:40 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:35828) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iKQyw-0003PH-AH for qemu-devel@nongnu.org; Tue, 15 Oct 2019 13:51:38 -0400 Received: by mail-pg1-x544.google.com with SMTP id p30so12592805pgl.2 for ; Tue, 15 Oct 2019 10:51:38 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id t68sm20867845pgt.61.2019.10.15.10.51.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 10:51:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=1C7c6L0AKcXy94kRypeBSB6XHbsCm+dRfwVNJ4dwo8Q=; b=Gj+Y+3dAOGc9dHpOy9mhXsLqGcNMj5MIDrIoxzeR1GgxkfrjmeMlA0X897dskiv2ee xrLxCmYtK2YwsYESQjAre+jDnLqp8k9nJ9N0t1qLZ7ak6StWqaXcGlyfGZoeNRtt7U2m 7gJqa9ScHJxsD4KNYTobWED2saHsYVwogmfgEDKZiean4+RfEK1h6Y8ulDC2o9SZfskQ FJJRHMP2lNlcH+jT1vkdCpTSE++ZQU+BCvGztqyJAR5NrtPZUunXgFEv2oTXQZDj3JP0 GlSLSFNk1pSq1vVQ/C6enhK8e2o1HzjbL0wu4KCgzAHttRhONvy1de0NhlI0JyzBrx19 pqVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1C7c6L0AKcXy94kRypeBSB6XHbsCm+dRfwVNJ4dwo8Q=; b=DFUgDkqZBcW1wPjadyMvc70ai6yHDTRMDUGIZClSmIU3yTHacTzyxefxBKtgCsJhSi fcRmfT3/04SRUXBP8Lb+fUsMXN8naVF89lNizYaNBGscINx5QCj52GbYKKfQpGtjJPXk WVJVvLI/GBgKeaOepOXhesKRCQ6fLKmCgai1xWS7d1ZPOZqgoniD0WQnA4+/E3ptMABu 3NAgatttBDEB6Q//Nv5shvRRecl7Z4caasOuunMhxAs5mEWzYhgoTkCZfhMLrlBGoZ+F CJYz+3qDPmvgdrdW11ntuvfRpS5jy1e3IzJ8TArH0Pl6+PWQ1LDiecXfguSiHqxghGuy cD/Q== X-Gm-Message-State: APjAAAWRiVixb/fRhjoawhQzrDoXUPJR2Xmirao1PIR2qFo16tvEeBGJ 1dRP1TQvxmbVIUZ7gwABhcWEpYxjChA= X-Google-Smtp-Source: APXvYqyB5BcjRmEAYh3iTjSbd2gDoDSUPazl7j1nWIqB6FKk719+Nm2N3+cm6jegnpbHhfkJJ9VEww== X-Received: by 2002:a17:90a:1b45:: with SMTP id q63mr43578475pjq.106.1571161896902; Tue, 15 Oct 2019 10:51:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 1/3] capstone: Update to master Date: Tue, 15 Oct 2019 10:51:31 -0700 Message-Id: <20191015175133.16598-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191015175133.16598-1-richard.henderson@linaro.org> References: <20191015175133.16598-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Update to 418d36d695e0. Choose this over the 4.0.1 tag because master now includes the s390x z13 vector opcodes. Acked-by: David Hildenbrand Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- Makefile | 1 + capstone | 2 +- configure | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 30f0abfb42..8ce48e0342 100644 --- a/Makefile +++ b/Makefile @@ -498,6 +498,7 @@ dtc/%: .git-submodule-status # Remove all the extra -Warning flags that QEMU uses that Capstone doesn't; # no need to annoy QEMU developers with such things. CAP_CFLAGS =3D $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS)) +CAP_CFLAGS +=3D -I$(SRC_PATH)/capstone/include CAP_CFLAGS +=3D -DCAPSTONE_USE_SYS_DYN_MEM CAP_CFLAGS +=3D -DCAPSTONE_HAS_ARM CAP_CFLAGS +=3D -DCAPSTONE_HAS_ARM64 diff --git a/capstone b/capstone index 22ead3e0bf..418d36d695 160000 --- a/capstone +++ b/capstone @@ -1 +1 @@ -Subproject commit 22ead3e0bfdb87516656453336160e0a37b066bf +Subproject commit 418d36d695e075955674ace5a1191b495da50f84 diff --git a/configure b/configure index 08ca4bcb46..f4f1860065 100755 --- a/configure +++ b/configure @@ -5008,7 +5008,7 @@ case "$capstone" in git_submodules=3D"${git_submodules} capstone" fi mkdir -p capstone - QEMU_CFLAGS=3D"$QEMU_CFLAGS -I\$(SRC_PATH)/capstone/include" + QEMU_CFLAGS=3D"$QEMU_CFLAGS -I\$(SRC_PATH)/capstone/include/capstone" if test "$mingw32" =3D "yes"; then LIBCAPSTONE=3Dcapstone.lib else --=20 2.17.1 From nobody Fri May 3 11:43:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1571162787; cv=none; d=zoho.com; s=zohoarc; b=N5ByIPDP0i5sIss9+tnRtdhlHKGo+QkUABX8JStxs1I/5uJwHOhi3iQBXBd4IhridAnzP4X3cJQjG1aGBmJzsqOy2nzYDxFl2SGdsTonVAJXnWbw8pqZcj+feV9kFEJOJtST9GHT2Ej/BYdkKaeVzgIWLkHKLxBJ1B1So1EiL8U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571162787; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=JPcXbUefVYp1/DZorpkAXAFcmm1X6SF54kxYkRBFIog=; b=gUmAPk0ivxXYKPOC4L/hbvoWgwRgkiTVsh74Zw3M8ZYRERkT7NUpN51g8/un7uheL3LU6N791DeWyt8aDrGUw88ymyvgZyghWjNtFwBHnxNIcHBndr9wl9+wtae/fBoz+RoU3DpNIC9CW57GqdAbwAN6Yl086SvvS+MiZb+kaG8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571162787319917.4980884883271; Tue, 15 Oct 2019 11:06:27 -0700 (PDT) Received: from localhost ([::1]:55496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKRD2-0007p4-VT for importer@patchew.org; Tue, 15 Oct 2019 14:06:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54601) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKQyy-0004x0-Ss for qemu-devel@nongnu.org; Tue, 15 Oct 2019 13:51:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iKQyx-0003Qs-Ow for qemu-devel@nongnu.org; Tue, 15 Oct 2019 13:51:40 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:41721) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iKQyx-0003Pl-JL for qemu-devel@nongnu.org; Tue, 15 Oct 2019 13:51:39 -0400 Received: by mail-pl1-x641.google.com with SMTP id t10so9936531plr.8 for ; Tue, 15 Oct 2019 10:51:39 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id t68sm20867845pgt.61.2019.10.15.10.51.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 10:51:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=JPcXbUefVYp1/DZorpkAXAFcmm1X6SF54kxYkRBFIog=; b=jE0orpGFix6/Su5bS8NmnWMrRSuZHytmrxj+wzSa7qmgsoAmjutVGhK/6TUvJcAPu6 GVGF30gwVg/sk3zPasO9WkUNlE/H0hvgsO/2OfCiVmXtfloUX+6Npr75yxO19YY6vgIV ZHo++387ZEeNPW2SEJ6AKFfA7d+EDDsCjTNeFdyQMaZS7E0M++8+Mm9KFTYFDnZIhEs4 R2Hyx2cXdRiLqv6lPtei3/Xczq/NZIMYxM6N81UGuUKIL/i0DZGxjk9xQNv+L8GUeIWF yINR8dakDUa4I4ZKuwkDcg7V/2HAPTOzFU2aUHd1UNBqmt49koxLeMjs2qomDge3FxP+ Zuig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=JPcXbUefVYp1/DZorpkAXAFcmm1X6SF54kxYkRBFIog=; b=cWjBs+EFhSB/IrYTG7O8tR7HhHZg7k4xqnCnr0JAHC5xK72sOGo5RWnRglxs++RXsv Y3M6cXfWSP2qb5uJfXQ7OZCbKdqa1JIeg0/Kq3OjrEbDr1FNCG5BjhCrzDugtOSBb35Y dE1c9icHpML8KBNUZ5seaDaPWrxc7Ba2PRpomQiBypUoS3ArefxOSDd23Z9LLy6iqv5f 8uYY71hN8USscYxWNgU/CRzHpckq1dT2kge77MesEVfWXJtRHEcervlkKw0izgGiDA5V wFzPfYXUK+vSHpMJJVfJzcQ82UYxDZY3CFaAEm0o0sV68qMeSH439f0wcZRpixgm1vUz FoVA== X-Gm-Message-State: APjAAAV5eN01hvC8CIlAJ0CQknQv1ARlRdigVxhMhN1/kSVobHRVxKdS mqH0OreHI6bXTFfZIk60GoPt2jzo4I4= X-Google-Smtp-Source: APXvYqyICd6CxgMYVAJwLi5ymD5diOSeJKovIa+1hGqfWXSS2vZ/MHLuX5aJcuqxDcac0nQG06rHlA== X-Received: by 2002:a17:902:7e4e:: with SMTP id a14mr37242068pln.68.1571161898200; Tue, 15 Oct 2019 10:51:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 2/3] capstone: Enable disassembly for s390x Date: Tue, 15 Oct 2019 10:51:32 -0700 Message-Id: <20191015175133.16598-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191015175133.16598-1-richard.henderson@linaro.org> References: <20191015175133.16598-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Enable s390x, aka SYSZ, in the git submodule build. Set the capstone parameters for both s390x host and guest. Signed-off-by: Richard Henderson --- Makefile | 1 + disas.c | 3 +++ target/s390x/cpu.c | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/Makefile b/Makefile index 8ce48e0342..97e34be162 100644 --- a/Makefile +++ b/Makefile @@ -503,6 +503,7 @@ CAP_CFLAGS +=3D -DCAPSTONE_USE_SYS_DYN_MEM CAP_CFLAGS +=3D -DCAPSTONE_HAS_ARM CAP_CFLAGS +=3D -DCAPSTONE_HAS_ARM64 CAP_CFLAGS +=3D -DCAPSTONE_HAS_POWERPC +CAP_CFLAGS +=3D -DCAPSTONE_HAS_SYSZ CAP_CFLAGS +=3D -DCAPSTONE_HAS_X86 =20 .PHONY: capstone/all diff --git a/disas.c b/disas.c index 3e2bfa572b..51c71534a3 100644 --- a/disas.c +++ b/disas.c @@ -550,6 +550,9 @@ void disas(FILE *out, void *code, unsigned long size) print_insn =3D print_insn_m68k; #elif defined(__s390__) print_insn =3D print_insn_s390; + s.info.cap_arch =3D CS_ARCH_SYSZ; + s.info.cap_insn_unit =3D 2; + s.info.cap_insn_split =3D 6; #elif defined(__hppa__) print_insn =3D print_insn_hppa; #endif diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 3abe7e80fd..44f40f1f8c 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -43,6 +43,7 @@ #include "sysemu/tcg.h" #endif #include "fpu/softfloat-helpers.h" +#include "disas/capstone.h" =20 #define CR0_RESET 0xE0UL #define CR14_RESET 0xC2000000UL; @@ -180,6 +181,9 @@ static void s390_cpu_disas_set_info(CPUState *cpu, disa= ssemble_info *info) { info->mach =3D bfd_mach_s390_64; info->print_insn =3D print_insn_s390; + info->cap_arch =3D CS_ARCH_SYSZ; + info->cap_insn_unit =3D 2; + info->cap_insn_split =3D 6; } =20 static void s390_cpu_realizefn(DeviceState *dev, Error **errp) --=20 2.17.1 From nobody Fri May 3 11:43:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1571162053; cv=none; d=zoho.com; s=zohoarc; b=L+6Cn98BPXR2pTKJhL3XmpK30vQINQ/Z/quNnoJaX5gyhs8izMqfC3NYW66MgnnBLATHxMLWjOid0R/IA2IKKnfDcRH8F5B6x8Fau1a2tofWn6GpMZ96dGss8UzYFOYRMEGNmIptRRnPqUGyhlZYkwxlodvCKfgzD0QHdK8h15Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571162053; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=8nOrlYeU5zcIwPQAiPQrEysfQ5wBLY582fozX0r/c2U=; b=gY7h14MvfyF2h3DJj8q145bBWsP/0qHZMMPPFwvukycS5qVNgc5/7A8IVQtsn3/ICrmiiHBxfbkN/sIsMCENv/EpTq3gqegy1ZU5o4JthbnERifZ+rkuWOtj0M8pAniFXI6mRcfBCEkrWpveHLzx9Y9JQYhA3DBjIm9+rEJddx4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571162053573827.5678138877356; Tue, 15 Oct 2019 10:54:13 -0700 (PDT) Received: from localhost ([::1]:55172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKR1Q-0007KR-Is for importer@patchew.org; Tue, 15 Oct 2019 13:54:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54617) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKQz0-0004yP-46 for qemu-devel@nongnu.org; Tue, 15 Oct 2019 13:51:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iKQyz-0003S9-05 for qemu-devel@nongnu.org; Tue, 15 Oct 2019 13:51:42 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:34386) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iKQyy-0003Re-R0 for qemu-devel@nongnu.org; Tue, 15 Oct 2019 13:51:40 -0400 Received: by mail-pf1-x442.google.com with SMTP id b128so12971570pfa.1 for ; Tue, 15 Oct 2019 10:51:40 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id t68sm20867845pgt.61.2019.10.15.10.51.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 10:51:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=8nOrlYeU5zcIwPQAiPQrEysfQ5wBLY582fozX0r/c2U=; b=DagjfiVGE76/S65G6eK8NIEjaJ0kab+fsDI39tEYEjw+UOlTN3hrj885V1WFlfP38O IT520qzq/QtWQgIljzWKhHGbPtD0HI6B0VllBSuKzh0Xh1CoOe8n7U/uvz0VDmuAiWRp AslcbdRu8aw+Sk3gwjaqNq/dcMkizrU62IB51iBGvlvSclIaHAMcAYUUFk7+IHVpb7ak gfTXVcdNZbq33oN3KOs3W9nwe4BpVEVyz7rUm6aeFJUH0EyJotWes2LJzukliyPqtUUV OcuUFdEXPhP0PGsAbSeZFABJOfL6EQd85QiXzLmWX2kaH299tT4F4ojB9N/fZclGAw10 039A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=8nOrlYeU5zcIwPQAiPQrEysfQ5wBLY582fozX0r/c2U=; b=dLYudaMzOrCvJPwwRQgUDefMIRwOCOP84j1IoO86HgHo2EODol4VLPLxOt5MTFgZxu qNgIxoxC1CqSuQ8GlIz56Zz7DBRz0Bcmm4sw7bjQOUs4s7htOYLSLE9TF4l/eVUiB7rO SBeiuMyar7txMsLnVmSxjYNPfM/ewfn7acnPtQwWwZXyKm1NTt3w5s40zmbSdUsRK3Mk c02qBAfcabXtvYI3WiQ+2w5GzvcXfWqDgkmJsaoOgyTsH0NzcmnAl9wWKH9oOfGuyd/X F45E8PBbdbIIlHofEUQ43fdFCV2xCidnEW6A5a+qOAq/txCEMd76nfpY0uKNcDGHTDp2 YWEQ== X-Gm-Message-State: APjAAAVSSEbZ5PNV5zt+XYgYTdra5tOxwzpphNV2KoH66b82zeHO39lG 9viBJDZbbHZ6gGHngT0aPUyeAo5NRRo= X-Google-Smtp-Source: APXvYqysThFjDkfzq0Rqk3aJITJ8a6I83UvXa2dDb4gH3ZXKZp8PayvPz1KdObrk2VM2VejoS5zHVw== X-Received: by 2002:a17:90a:8085:: with SMTP id c5mr14018255pjn.60.1571161899372; Tue, 15 Oct 2019 10:51:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 3/3] capstone: Add s390x skipdata callback Date: Tue, 15 Oct 2019 10:51:33 -0700 Message-Id: <20191015175133.16598-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191015175133.16598-1-richard.henderson@linaro.org> References: <20191015175133.16598-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Capstone assumes any unknown instruction is 2 bytes. Instead, use the ilen field in the first two bits of the instruction to stay in sync with the insn stream. Signed-off-by: Richard Henderson Reviewed-by: Thomas Huth --- disas.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/disas.c b/disas.c index 51c71534a3..2a000cbeb0 100644 --- a/disas.c +++ b/disas.c @@ -178,6 +178,39 @@ static int print_insn_od_target(bfd_vma pc, disassembl= e_info *info) to share this across calls and across host vs target disassembly. */ static __thread cs_insn *cap_insn; =20 +/* + * The capstone library always skips 2 bytes for S390X. + * This is less than ideal, since we can tell from the first two bits + * the size of the insn and thus stay in sync with the insn stream. + */ +static size_t CAPSTONE_API +cap_skipdata_s390x_cb(const uint8_t *code, size_t code_size, + size_t offset, void *user_data) +{ + size_t ilen; + + /* See get_ilen() in target/s390x/internal.h. */ + switch (code[offset] >> 6) { + case 0: + ilen =3D 2; + break; + case 1: + case 2: + ilen =3D 4; + break; + default: + ilen =3D 6; + break; + } + + return ilen; +} + +static const cs_opt_skipdata cap_skipdata_s390x =3D { + .mnemonic =3D ".byte", + .callback =3D cap_skipdata_s390x_cb +}; + /* Initialize the Capstone library. */ /* ??? It would be nice to cache this. We would need one handle for the host and one for the target. For most targets we can reset specific @@ -208,6 +241,10 @@ static cs_err cap_disas_start(disassemble_info *info, = csh *handle) =20 /* "Disassemble" unknown insns as ".byte W,X,Y,Z". */ cs_option(*handle, CS_OPT_SKIPDATA, CS_OPT_ON); + if (info->cap_arch =3D=3D CS_ARCH_SYSZ) { + cs_option(*handle, CS_OPT_SKIPDATA_SETUP, + (uintptr_t)&cap_skipdata_s390x); + } =20 /* Allocate temp space for cs_disasm_iter. */ if (cap_insn =3D=3D NULL) { --=20 2.17.1