From patchwork Thu Sep 14 18:35:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 112608 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp1094744qgf; Thu, 14 Sep 2017 11:37:44 -0700 (PDT) X-Received: by 10.233.237.202 with SMTP id c193mr4137082qkg.290.1505414264745; Thu, 14 Sep 2017 11:37:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505414264; cv=none; d=google.com; s=arc-20160816; b=hlMao4WRjbEaKLz+dfMYY5na318x1I3AhY6qQf/+AuXR33ly/5G0LTUTB0FOtGF17W oUA/yd+bmNRVvu4pu4P/3LoHp94p51yXjxOYpuyejyOLbxYiVZTA4pizMN3eKyo1nApI MuDUmfuRuqb1enx7dPIuDe3dUmgms2oiPt5sskxcMZFo5ti+v0xOS23lnYVJBiYa+vHi K4rBroSD5NZNZEGhdHlzDNz8lvZ6EHOU2Ki/D5RQSN5sD6pRR7dBclI4mgqOgzWrqVmC 5Hr00bPaWvJaXklcdgqI/7amZzW+I9T+V3b6gwpw+OoiFcKXj4+ewAXZWJiuJxr4OxED BeLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=6v4rfjWjELpk+oioouTpts0SxHUwX/5S2bxxQ+qI74U=; b=NMLJv+6Cz5QlwWvJw1acipHYU4u2v/lkrv/4KmAz/D+WivCoQ5GBD//vjAn+Cn5PN6 ZzqgQkXgPXe6lsPjEDYc3tIzvugaUAvYQkIsH3PtJaeG+KVYkiFqrsF5rspfciXnGIRd ikRojUtrC1esOOZhLBM7CCcbVksfHMWDn2h8XoNW+dBNg4yECo/sCCMw0bPOMQKFVt7v 22SyLOLjBbncuMSHc2UDs5LhJquYK1Lb5F9W6Z4glH5Q9747Be4CdxRS2blLLfc5Pt7M ruNCsaHLZENSr/K7FoBDNV0OEF6TPVyUDqJgkCV5h4BA7Ha7+z2W6A+eikBzaPnOvNC+ mdBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HicPZne5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id b45si8845684qtk.535.2017.09.14.11.37.44 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 14 Sep 2017 11:37:44 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HicPZne5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49452 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsZ1C-0001sn-Hv for patch@linaro.org; Thu, 14 Sep 2017 14:37:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsYz0-0000Oj-1t for qemu-devel@nongnu.org; Thu, 14 Sep 2017 14:35:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dsYyv-0000Mo-Jk for qemu-devel@nongnu.org; Thu, 14 Sep 2017 14:35:26 -0400 Received: from mail-pg0-x233.google.com ([2607:f8b0:400e:c05::233]:54885) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dsYyv-0000Ln-C0 for qemu-devel@nongnu.org; Thu, 14 Sep 2017 14:35:21 -0400 Received: by mail-pg0-x233.google.com with SMTP id c137so111643pga.11 for ; Thu, 14 Sep 2017 11:35:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=6v4rfjWjELpk+oioouTpts0SxHUwX/5S2bxxQ+qI74U=; b=HicPZne5nJ2chcF71GQaYxVIX2diu6/8Wo6AnQ9AS1g6UtJjl9mCPqUvu0SwWlOH7q fxctqmf0xP/XiklRQv8vlHai5+VeROSwx3ZOnCR5xQK+1YNDRnzcmW8B37fj41GMLv5X f8xGOYEMxCCSf1MJS3GaNh3r5rHFZNQNmDTfk= 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; bh=6v4rfjWjELpk+oioouTpts0SxHUwX/5S2bxxQ+qI74U=; b=bkyRqS8zGeayA6Rpekt+J+SBPf6HCxHHXcqnlDv4+eDo3zy2YejCS0M70iktLHkaN0 OUQ6TteIiJqtSBtpz5kkck5shhsl5RBMICZ99TEB1MG7OhR03O8e1DtTXs65QkR3PHgs 9iNTrVBScuF6CSQbhXUqFCqNYVgXYY+QiSSK/HJADwcOmY4dCAlXMOJu3WpQ/3tNBjJz BPXmOrVg4HHMQAKtuJZxYPNxYvgS6X2wNRs4zGD7Z7UB3cq7SnXS964rHgr6vLNp4Pzm gyrJAcuO+x06b0QJ5fbBHT9f4UYXA4LWKBam9gFa8rD43eZQageJDoGJP5g7xudgzIb5 Ns7w== X-Gm-Message-State: AHPjjUju5utIWmnvygDSchJt0yTWKdrpA/dKwaby3ig+I8ZpLFvoT4xq fSCZfhRO3dJ92Zk54wa+Xg== X-Google-Smtp-Source: ADKCNb5dz21Uu/x4O/nRfVneq3DxfrYFeMhgD2lxOuqNYui03Kswln1HdWj1z+fwDkNZXr3nnFZgWA== X-Received: by 10.98.112.138 with SMTP id l132mr22518744pfc.71.1505414118460; Thu, 14 Sep 2017 11:35:18 -0700 (PDT) Received: from bigtime.twiddle.net (97-126-103-167.tukw.qwest.net. [97.126.103.167]) by smtp.gmail.com with ESMTPSA id l85sm32473848pfb.176.2017.09.14.11.35.16 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Sep 2017 11:35:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 14 Sep 2017 11:35:06 -0700 Message-Id: <20170914183516.19537-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::233 Subject: [Qemu-devel] [PATCH 00/10] Support the Capstone disassembler 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" As occasionally discussed on this list, due to licensing conflicts, we are restricted to a version of libopcodes that pre-dates its upstream re-licensing to gplv3. That makes our copy rather old and dated. I've already seen this as problematic for s390x guest. I'm sure the same problem exists for Power8+, though I haven't looked. As we go forward with vector operations we'll see this for x86 host. An alternative is to use a BSD-licensed disassembler: https://www.capstone-engine.org/ This is an actively maintained project derived from llvm. Moreover, it is already in the major Linux distributions, which makes it easy to phase in its use. I've arranged the code such that we attempt to use capstone first, and if that initialization fails, fall back to the existing code from binutils. r~ Richard Henderson (10): target/i386: Convert to disas_set_info hook target/ppc: Convert to disas_set_info hook disas: Remove unused flags arguments disas: Support the Capstone disassembler library target/i386: Support Capstone in disas_set_info target/arm: Support Capstone in disas_set_info target/ppc: Support Capstone in disas_set_info target/s390x: Support Capstone in disas_set_info target/sparc: Support Capstone in disas_set_info target/mips: Support Capstone in disas_set_info include/disas/bfd.h | 4 ++ include/disas/capstone.h | 38 ++++++++++ include/disas/disas.h | 4 +- include/exec/log.h | 4 +- target/mips/cpu.h | 2 + disas.c | 161 +++++++++++++++++++++++------------------- monitor.c | 29 +------- target/alpha/translate.c | 2 +- target/arm/cpu.c | 21 +++++- target/arm/translate-a64.c | 3 +- target/arm/translate.c | 3 +- target/cris/translate.c | 3 +- target/hppa/translate.c | 2 +- target/i386/cpu.c | 19 +++++ target/i386/translate.c | 8 +-- target/lm32/translate.c | 2 +- target/m68k/translate.c | 2 +- target/microblaze/translate.c | 2 +- target/mips/cpu.c | 8 --- target/mips/translate.c | 2 +- target/mips/translate_init.c | 36 ++++++++++ target/nios2/translate.c | 2 +- target/openrisc/translate.c | 2 +- target/ppc/translate.c | 5 +- target/ppc/translate_init.c | 27 +++++++ target/s390x/cpu.c | 2 + target/s390x/translate.c | 2 +- target/sh4/translate.c | 2 +- target/sparc/cpu.c | 3 + target/sparc/translate.c | 2 +- target/tricore/translate.c | 2 +- target/unicore32/translate.c | 2 +- target/xtensa/translate.c | 2 +- configure | 17 +++++ 34 files changed, 279 insertions(+), 146 deletions(-) create mode 100644 include/disas/capstone.h -- 2.13.5 Tested-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé