From nobody Tue Feb 10 01:46:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.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=1578086787; cv=none; d=zohomail.com; s=zohoarc; b=D9WkRSKf3Lgg7IEQaHxgrpB6exqdse06NljMrv/ZsuVtsppwqLXEGY+gA0EtYnCMrcrFAdo+Qtokaug1Kxk7rtLGOkP6J5W1VRE9WdNnXCUdu6D1lITagw7HWFOtPEzsJXOepLye3wmJgZXMRd36NhwEUo0Uq+sfjoSqLBCQ14E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578086787; h=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=33+25pCQpg6Hcw5lhcs23DCIrdwQ3CmnW+6SiuGtsrE=; b=ONc0pLLaxRQfSlkrE+5GEgt8s3IOAQ87IS5BfkWcSJcXbLPCX19SP4grmj1w2sx/p+19eZ/Okz6oXyVo2G4TES5CfhNSdG6++kGn62YpBpseNuIbJ93LiJ5GvRowxHCJe8W4BoeYWzQsB5H0JiC7TM4t10GS7PnWG+OnCYUoOqI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.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 1578086787578573.2165498893895; Fri, 3 Jan 2020 13:26:27 -0800 (PST) Received: from localhost ([::1]:56932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inUSg-0006ql-57 for importer@patchew.org; Fri, 03 Jan 2020 16:26:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45430) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inURT-0005Wj-Os for qemu-devel@nongnu.org; Fri, 03 Jan 2020 16:25:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inURS-0004Aq-MU for qemu-devel@nongnu.org; Fri, 03 Jan 2020 16:25:11 -0500 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:37727) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inURS-00046R-GT for qemu-devel@nongnu.org; Fri, 03 Jan 2020 16:25:10 -0500 Received: by mail-pj1-x1043.google.com with SMTP id m13so5177976pjb.2 for ; Fri, 03 Jan 2020 13:25:10 -0800 (PST) Received: from localhost.localdomain (59-100-211-22.bri.static-ipl.aapt.com.au. [59.100.211.22]) by smtp.gmail.com with ESMTPSA id c15sm16668907pja.30.2020.01.03.13.25.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 13:25:08 -0800 (PST) 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=33+25pCQpg6Hcw5lhcs23DCIrdwQ3CmnW+6SiuGtsrE=; b=ybzpN1QYXJMeROyv/UGiQnjnk4FIQN8xg4ffeqoW7V3XbLRhuhqc70Y8tXSs86uCmZ JGQBZrgvTcusQhDqnpDM5IIFUMnngg1mxcO7jiu7AndMF58opEyQl6iLB9F7+XLTO6SD AhfSUzvbjIeTO2N3QQW1M133tlTNU6+QE+i+3iH6Ky7V8fDSIqnvBm8sZCGrob6Gwt6L WgYgq00s5qndYlfPpXpa6se1cz9dzbsGK4sIroPJC59OAqMDZ24ysTwEHkN8Aqn/nZag Ce7mk+uzASmeRh8BNqhlifjolMdqyRYZp9LCGeaMx3RxO1nVoUGWq4MR1RIvnqlKx3r+ tu+w== 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=33+25pCQpg6Hcw5lhcs23DCIrdwQ3CmnW+6SiuGtsrE=; b=n8B+aj6JmYzVGQHJq2h/vhVt6tVNds/QdU6/fQt5P9Rm3WPaSYibdxTxGz7fhTOmHp N9RhWtdXAjNjk8SQkBNofw3CrHs0h2PjKe4nDYkrmFRaqRTNg4SJd9RIIsKFF9mk5j2F SKPdMlNCSiRAn8cZWxZqPi3WezfbOt+Thbbiwvv0mdBRMqB9ahwA6dx69sEQ4Splqitq QXqdBWYhvvRnY1aeznqlBr4RQ47SLRMnD7haAKN+c42fNynK83afYhdaHnBlmVG0RapK qRfFN6WP7vACtHvg2WzpYFO/DrWvugP/t3oJZpi1pcWHP+nv8hrwpjE90/K09abs8L7R byuA== X-Gm-Message-State: APjAAAXnx0tUj8PRHswYCiZTbAsqA51uvyw53hZCZIun5ZL2B2h+nvj9 gs+2veOX5rK9W6cE/Ze3Tn18L14DYUc58A== X-Google-Smtp-Source: APXvYqxG4SpIPUFlQrVusJZ7d6yctWHwsAP+yk0cOQjK7TX4ushFijMCkRGU5of0bHYKNsNXviiq0w== X-Received: by 2002:a17:902:b097:: with SMTP id p23mr94184094plr.45.1578086708991; Fri, 03 Jan 2020 13:25:08 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 1/3] capstone: Update to next Date: Sat, 4 Jan 2020 07:24:58 +1000 Message-Id: <20200103212500.14384-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200103212500.14384-1-richard.henderson@linaro.org> References: <20200103212500.14384-1-richard.henderson@linaro.org> MIME-Version: 1.0 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::1043 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-Type: text/plain; charset="utf-8" Update to aaffb38c44fa. Choose this over the "current" 4.0.1 tag because next now includes the s390x z13 vector opcodes, and also the insn tables are now read-only. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- Makefile | 1 + capstone | 2 +- configure | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6b5ad1121b..12e129ac9d 100644 --- a/Makefile +++ b/Makefile @@ -499,6 +499,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..aaffb38c44 160000 --- a/capstone +++ b/capstone @@ -1 +1 @@ -Subproject commit 22ead3e0bfdb87516656453336160e0a37b066bf +Subproject commit aaffb38c44fa58f510ba9b6264f7079bfbba4c8e diff --git a/configure b/configure index 940bf9e87a..de96bfe017 100755 --- a/configure +++ b/configure @@ -5062,7 +5062,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.20.1 From nobody Tue Feb 10 01:46:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.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=1578086868; cv=none; d=zohomail.com; s=zohoarc; b=UgpDfZp5puqnr93BE7eT3sitglQrW+18RxZFHNSpWkHDHzQLu0vzQDoOM+0ykxzOjkXXVEiaFOgeBP6E73us0Ay5z79wEP0rmsu6sAq0V7Xok9bcTy9ADrg3pGT2gYiOztlOT83XYSsYAmm9PGAnvg79T3FHQL0jnXp1Vd8rbnI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578086868; h=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=v5KPKRZAR7txzi3dtQ0M2sC1CnUsf9tIOlY4B9oV1g8=; b=miDBOgr1PaAyA4cjARJeKkWmoxoAv9a7MgSIgkZqj05z0fGA+9H7anQQ0XYsC7c0yJbRuHgV4C27gp9TTZgghsKwKq2WXRYr4kSU5bXNubvhZs/IjMwNtJBqp+5nLDDcBwhQ+IxinPbFo53+fy1Q7FNuIG/n9ggfgzeCIk42kuQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.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 1578086868285593.768140799562; Fri, 3 Jan 2020 13:27:48 -0800 (PST) Received: from localhost ([::1]:56960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inUTz-0000Z7-79 for importer@patchew.org; Fri, 03 Jan 2020 16:27:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45551) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inURV-0005Yz-PK for qemu-devel@nongnu.org; Fri, 03 Jan 2020 16:25:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inURU-0004L8-Oi for qemu-devel@nongnu.org; Fri, 03 Jan 2020 16:25:13 -0500 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:37550) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inURU-0004HY-Hw for qemu-devel@nongnu.org; Fri, 03 Jan 2020 16:25:12 -0500 Received: by mail-pl1-x644.google.com with SMTP id c23so19466600plz.4 for ; Fri, 03 Jan 2020 13:25:12 -0800 (PST) Received: from localhost.localdomain (59-100-211-22.bri.static-ipl.aapt.com.au. [59.100.211.22]) by smtp.gmail.com with ESMTPSA id c15sm16668907pja.30.2020.01.03.13.25.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 13:25:10 -0800 (PST) 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=v5KPKRZAR7txzi3dtQ0M2sC1CnUsf9tIOlY4B9oV1g8=; b=d4cxdSXakwl8gu5aoAbEDrQslebPkBRfyvScF7etxqt5M/IC5EUgjF2F7lpgOJc0fe rali1GqndHWZoAEcQnd7gXAzFsT3ccp8baeGn14IdcYZIw4QM27roUZCwl4NL1xeZ8Y5 aVqybggqawR9dc5F9OFGm+jnaTXFjNjGNXDF2ZzJOQxxCoCN/mbk4APSllW1H2TmxM1s L1yWMGlTk3esva8lWwn/68eyqMS2KTfU3vFLKeF+Ws7x3qb3JM3TXabEFLJZFDhHCeAj kCybrmQmHwDF8kv2ExAC10SHiQOucfGp0U1aG/Ur2hvX9y8vFYi7oIs2s2SmGss8lzh3 ivWg== 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=v5KPKRZAR7txzi3dtQ0M2sC1CnUsf9tIOlY4B9oV1g8=; b=R+EI80qtdnEakDLxfqipiX1bGXVFW+AKtYpIZ5Hdpw0T5IcAx+0+H1MTDHrd5D43KV BAN5LqjZZU+37wq0b7ZshEWjtRhm1KQpBPLacNLyIceODjN0llVnobh8PJ5jq2FcP5nI MbUVEokokich+qr/ARPkgSZbe0fYy7sWevgFos2+I/UB9plSd11S84CkLtTD6OSL1bVn hUu3XelK6u2l8Gorg2zcgQhcaMs5ffwy5JbJfHPxDah7HsaxvndRZ3lNtw8ydBWBLHXp Cc8DBbGcLfzvle1+rHhQAaA9IkJNC6xFOPR30DRgnsNPmXiujHjtdhV6yJdKpVExPVZ6 b7sw== X-Gm-Message-State: APjAAAUx21NDNTf063E8euvmkM1QWanVcOBOVKN2/OtWeXyVkB56RY5a axR8hVIDj0yaatZG5UhDqWupNWLpu159sg== X-Google-Smtp-Source: APXvYqwjsTJ8GVGsHrIfxCsM+4DW1Bt7FbPyfTmdo2GcTV042L/Dnj+xRgQQIKs7rxAHPFrUmeg4Og== X-Received: by 2002:a17:902:934a:: with SMTP id g10mr69132583plp.99.1578086711266; Fri, 03 Jan 2020 13:25:11 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 2/3] capstone: Enable disassembly for s390x Date: Sat, 4 Jan 2020 07:24:59 +1000 Message-Id: <20200103212500.14384-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200103212500.14384-1-richard.henderson@linaro.org> References: <20200103212500.14384-1-richard.henderson@linaro.org> MIME-Version: 1.0 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::644 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-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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- Makefile | 1 + disas.c | 3 +++ target/s390x/cpu.c | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/Makefile b/Makefile index 12e129ac9d..df1c692ccd 100644 --- a/Makefile +++ b/Makefile @@ -504,6 +504,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 3937da6157..845c40fca8 100644 --- a/disas.c +++ b/disas.c @@ -660,6 +660,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 625daeedd1..1734ad9c3a 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; @@ -162,6 +163,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.20.1 From nobody Tue Feb 10 01:46:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.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=1578086793; cv=none; d=zohomail.com; s=zohoarc; b=R9cL9K7zrh9nsrO3Rbe3+vdJX2sWR2cYfABwndSmvpsUJwRi3G+pVE9DiQTHtl4xN9oZv3PBFGRG05opQIy5ibDhsqz4XdKm4oiO74XLA3+YDfP0bmeRxgiVwYr8FpReK1ejLmNdqPdcYaFTpF2tN/FeFLBUuUZ4FZ0WAcGiogM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578086793; h=Content-Transfer-Encoding:Cc: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=ezOCrOe9hJhnEdtaNkFzyuT77XDmRMIs13qAk5OKeOQ=; b=E6plctbcCkHdpxNXl+iF0Mx6FcN1MBWDzH7Wjed88aBD8pAQwQMuDzzPrWbBpUxm/67uAUN4e81QyTR0ZPwqQc47goD/xYDF9Rw/ZxpLKR2nrCOb6IHXlV+VuZ17f3pgllIHLwgilu7ZithBITSkR8i2ANbQmwdCeAeu/NzvZOA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.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 1578086793670870.1884518350013; Fri, 3 Jan 2020 13:26:33 -0800 (PST) Received: from localhost ([::1]:56936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inUSm-000705-Aw for importer@patchew.org; Fri, 03 Jan 2020 16:26:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45732) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inURY-0005dZ-Ne for qemu-devel@nongnu.org; Fri, 03 Jan 2020 16:25:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inURX-0004Vi-Im for qemu-devel@nongnu.org; Fri, 03 Jan 2020 16:25:16 -0500 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]:50527) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inURX-0004Sm-Ce for qemu-devel@nongnu.org; Fri, 03 Jan 2020 16:25:15 -0500 Received: by mail-pj1-x1044.google.com with SMTP id r67so5038701pjb.0 for ; Fri, 03 Jan 2020 13:25:15 -0800 (PST) Received: from localhost.localdomain (59-100-211-22.bri.static-ipl.aapt.com.au. [59.100.211.22]) by smtp.gmail.com with ESMTPSA id c15sm16668907pja.30.2020.01.03.13.25.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 13:25:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ezOCrOe9hJhnEdtaNkFzyuT77XDmRMIs13qAk5OKeOQ=; b=l2V1EPSqXv8APxdZ3nsWqQml9JGluP+SiH2zOM6zEiWfAlQ2O6/UQ6jvFiN8nayImp LfjbnX3sCxCQGsoKugCwrQsOeJ05av76/Nr8Wu7CBo6AWLjCCwTbthKumTQyDaAUBQZc AZ5qwktC4KVdWKTfuhdQnAI4zv3GoCROh1QORYhqn/SjefoKVzq83krQgGY9DVlNBnVx 48yR3Io2W72cOI9/JuVJYfzYNDl/L71MXAt5L2I/aoG5Nj5ubxPjn38yNucoj3iUQjDi NKzuUUch/ZMaJu0SMMZAe8B5hSVkVkxWPXWFa8IZUysUAlYDSvaEDA5Aqlcesegs87Lz rz+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ezOCrOe9hJhnEdtaNkFzyuT77XDmRMIs13qAk5OKeOQ=; b=kom4pjGznRB7OqbLu79CqV9SN4ilW6ncpTSSakHecRlyOnTPStR3Xit/2Gjb4EjriC gCP1ednGvXgRJ0PrfhbFHXlC/nMbiSVNMu8J/pzF6M3NvN/WUWqVLDK13fpUpLMrr4gH ySAzrDFkiOIj2cJMKDKHaygaikpWvB3/v2annfCKYPspPTWvNO5aXdyhHg8WN0KQmVuN gW0mTTQzZ+alkOP/bY0bsODKBnPKHlO1xYs3C1rcUi2kS5jxpm5csAxQZtodZqWt0ylU eiBDVlruym2Ep7TBSZQb8ufWd3noe3imqqsDDq2o5Lu7awDEYCRCns+Bf3OZF8oZ8dYf PyiA== X-Gm-Message-State: APjAAAW9EZHjdpQ2C2ZfNs9BPvP4nsHaY/pKtw1yycSScP3ebe4RqTQl GAE68upv+j/HRMUBVB7jpbqY/dtJdIW0yA== X-Google-Smtp-Source: APXvYqxl0zi2oyNOAOnqzMwOF+5nqfWRrcGO+05ER8+ZcCqtUqbpw9BOM1+4YRUA2J/fsz6dvK+F3g== X-Received: by 2002:a17:902:9a8d:: with SMTP id w13mr72737703plp.40.1578086714024; Fri, 03 Jan 2020 13:25:14 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 3/3] capstone: Add skipdata hook for s390x Date: Sat, 4 Jan 2020 07:25:00 +1000 Message-Id: <20200103212500.14384-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200103212500.14384-1-richard.henderson@linaro.org> References: <20200103212500.14384-1-richard.henderson@linaro.org> MIME-Version: 1.0 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::1044 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: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Capstone assumes any s390x 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. Reviewed-by: Thomas Huth Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- disas.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/disas.c b/disas.c index 845c40fca8..1095bad049 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.20.1