From nobody Mon May 6 02:12:05 2024 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=1578457665; cv=none; d=zohomail.com; s=zohoarc; b=BHkTYgZrkfIA+tov8G6jJOzWefE9UanOLw82HicKW9abZSgJb2B1rsJb+oZM2NLkv8hxfBYNiug3rI77DhYoPim0PT0JpXAgpIRTWSvP7zYc+y7V9dnXjpfO9/8lbQA0+zBQrZRWYcxS0U2CcwLVh1dGFRjD492s1fxx+/Nc1Gs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578457665; h=Content-Type: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=N8PydtXAISvbmvQbD5ixkVscLPB/zD5qTgZwQJqAzPI=; b=Fz7t1DC1qgleBNG5Qt81feeVsdppNn8vXXVegbms53g3S4q2ZpksxvK2skg3I+VjmikQ2YWlhm6rTPN7SRenEZyOHMoB2uZFkCv9NYtTsDZMh4DNZB0E2uiidFpAL8UCTDJBUAyCnw4UqDnnDzncbMd8kUkrZtx4XZqf4JammP4= 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 1578457665006867.9221983725236; Tue, 7 Jan 2020 20:27:45 -0800 (PST) Received: from localhost ([::1]:36206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ip2wZ-0002kR-EN for importer@patchew.org; Tue, 07 Jan 2020 23:27:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46561) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ip2sm-0007fn-Uo for qemu-devel@nongnu.org; Tue, 07 Jan 2020 23:23:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ip2sl-0003Un-QM for qemu-devel@nongnu.org; Tue, 07 Jan 2020 23:23:48 -0500 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:46681) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ip2sl-0003UJ-Kq for qemu-devel@nongnu.org; Tue, 07 Jan 2020 23:23:47 -0500 Received: by mail-pl1-x62a.google.com with SMTP id y8so564762pll.13 for ; Tue, 07 Jan 2020 20:23:47 -0800 (PST) Received: from localhost.localdomain (alanje.lnk.telstra.net. [120.151.179.201]) by smtp.gmail.com with ESMTPSA id f9sm1192702pfd.141.2020.01.07.20.23.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2020 20:23:45 -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=N8PydtXAISvbmvQbD5ixkVscLPB/zD5qTgZwQJqAzPI=; b=cQlBXj+UVwXAWWRjIc1objf8vvB5Pwq/mNAm6Ovi/JCDDNuHZk79bx6D75IAaqRsE0 POSruroCT3cpGSIKFKXIvNGUy1pec26kyiEgTy6c2ev9juOUOgr0VRKiLf7CgPrh5I0J J0lEyAFromtlzIKXxS44aYA45kLJWzueMOckz+Eh7dWHlUud+jjNOp2PgUydYLua42xr rjOi7rShwJwVCmF28cD8Lq22DirikFN7Do54C2RNEk0Pc1xEU2RFAAmZyW0Tg+mWc9Pa eyof/yi4VuHqTMlecCTwMMMT8zex+TUZMwYUUC6xmslfDBtSqTaKNdTuEGMNFOAROz/j /isQ== 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=N8PydtXAISvbmvQbD5ixkVscLPB/zD5qTgZwQJqAzPI=; b=Bi0kU4/W0BUIXk2E3bIr8iFd1g9Xm1Q34BAveBab9y+L85P6S/owOlSMcZ1m6dA0In iE9U7E7ktCadeeQFsECKnFuOvUKLeXrR1r/xiyOAsKOM5zFKBt2NCCt5OuHdVzrkD+NO i8/CT/tf7B48cy6ovfUBSXS6JUVjdu57d+UlIXcan6QyoxUAoW0Jd66Kn9+0/uh0BWKM mRFXcxK0i9SlKyZzMB5OiSDBH11zYYsxs6x2/lHU3eBXujHJ4/h4vfte+4DzcUD+J2+P CfUjI8pIj7VDn8AaxZzfnTb3JQ6wRwz6xKmfM8z8uvmKL4fQhh0UK4oJdKhWQ6xLPw4/ QLsA== X-Gm-Message-State: APjAAAUbNglj21bO+hXhapITj6s8ZW94mloNUZ2Sk3yz56Qj5bBswX6c XWupeaBrQDXN58cLdTetbTIZnd3tMt6q9g== X-Google-Smtp-Source: APXvYqyzHhALxGpiqOANT+TKatwFWWaCjwq+ZbYuTVmL/MbjfIHRQ+qNJb3PtUY0SYMGDi7V+jsLPw== X-Received: by 2002:a17:902:758f:: with SMTP id j15mr3296406pll.201.1578457426330; Tue, 07 Jan 2020 20:23:46 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 1/3] capstone: Update to next Date: Wed, 8 Jan 2020 15:23:36 +1100 Message-Id: <20200108042338.9082-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200108042338.9082-1-richard.henderson@linaro.org> References: <20200108042338.9082-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::62a 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: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) 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. Fixes: https://bugs.launchpad.net/qemu/+bug/1826175 Tested-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 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 0ce2c0354a..b3c99728d2 100755 --- a/configure +++ b/configure @@ -5068,7 +5068,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 Mon May 6 02:12:05 2024 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=1578457497; cv=none; d=zohomail.com; s=zohoarc; b=KU11AT0i1sm49gU+uLeqc0fFN7g+/IyjChr6nbIreaV+As1S8CysN3Z0Eifz3CgwjdwO9075uCzlRUzgh3TRjAiavS1+F993QUkJ0qwBUpcsVpReBwhq0EtwtkGw2mJk4IGM82E/Mo00oYFkS8uTBIvoc3AJu7rfJFMUjS+h47U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578457497; h=Content-Type: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=KVGu8j9Uoy9WavakRemYI+JFu7Y8Rpjk9OFUdSfPagE=; b=j+ds9z66S13Uz1zHVL8u+bqAUeaf+uyqTQZNFWa+BqZkI+CCVOO3aJF5lsSTJJuWvS0eICXBPqiPz2LRBkDDrBgcANEPFyJsgKbH3UbV9W3/lNBfAMrc3uMll6TRNVHr0WNO9MLJACkYi5em0ULvnhQwQ/urDvqNtLU6bPNZxxM= 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 1578457497671754.9518342895382; Tue, 7 Jan 2020 20:24:57 -0800 (PST) Received: from localhost ([::1]:36158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ip2ts-0000Af-Db for importer@patchew.org; Tue, 07 Jan 2020 23:24:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46613) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ip2sp-0007ix-Hl for qemu-devel@nongnu.org; Tue, 07 Jan 2020 23:23:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ip2so-0003YR-Ho for qemu-devel@nongnu.org; Tue, 07 Jan 2020 23:23:51 -0500 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:44690) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ip2so-0003XU-CM for qemu-devel@nongnu.org; Tue, 07 Jan 2020 23:23:50 -0500 Received: by mail-pl1-x629.google.com with SMTP id az3so568676plb.11 for ; Tue, 07 Jan 2020 20:23:50 -0800 (PST) Received: from localhost.localdomain (alanje.lnk.telstra.net. [120.151.179.201]) by smtp.gmail.com with ESMTPSA id f9sm1192702pfd.141.2020.01.07.20.23.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2020 20:23:48 -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=KVGu8j9Uoy9WavakRemYI+JFu7Y8Rpjk9OFUdSfPagE=; b=Fs9kTHVApCEbaPI4WZcOyz2O377drFdV55STwIItPBZKsoEWxATCbxpYneS5KQwKdU dmSir6kglM/k1FG8cDwdq3t7OOl9ARuUHTA8wWIqIDWwFQId+mzvmhV8muZ7nxZkT15M cvE3H8QwW6CjtRL548xM2xK8Cg+KQ5O3PXNnB5am7zM4dgqs4xDa8z5F0umAUSuUjNR5 nc/ZDlGFMOmNU20n1KAbOAAGIK/1uNDDa6Lj5tYhQpgBeVZMgkynwCH5xdvJTAhubH5x x6PUm2GnwWM0b77/n2wd4WYdkH9mV98tcWKnWyurZwkb2j6fZXnr2/REpF+/XQ3WTywh 7krg== 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=KVGu8j9Uoy9WavakRemYI+JFu7Y8Rpjk9OFUdSfPagE=; b=lkD1vVq6f2r7tTt7Nj3H7Ude+vZYF3GC4YaoeTLB7EqNmy5KZ4yyV1SoTurS95CGEV zeZC5ywwPtcgCcK8z4A9zvOgkATpN7cJBIxUddw0Cb5CrEDZBjMVZqdlBWNFpgNXcEcf 6QHeWdQHtQOPFvg2igSOG5U0cOgPetcmXMpvYBT6mzSeyDLL5bo5YvoPfFDYNO1NY2f+ Ga/2dRS4fQkNpswRp/w8V10XyoTIBT3lfewvCQtwAhax0vkj4k9ir9KWG+2FucuMChVN fELnETYpEKst396s9G3S8WRQYzApLIXPJvc//v4s7VYLS2bPNqSxiEdXPYhSwMFCvESM 6Q4g== X-Gm-Message-State: APjAAAW3wF8jkbsz6bI71SE09z+t080t6RyNy1w1Pd4DyQJcPF3wXqMZ 2Hxnx8sjFkzdL/WfFttU+6HHyccrbjDZYQ== X-Google-Smtp-Source: APXvYqxeyCqf4ywogqEaMUpqy8qpQNB3SfOP4Fs4v/3evi0OUQXaUaE2NuKr+Wkt0ymqG8fjLitUiQ== X-Received: by 2002:a17:902:6909:: with SMTP id j9mr3315318plk.269.1578457429021; Tue, 07 Jan 2020 20:23:49 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 2/3] capstone: Enable disassembly for s390x Date: Wed, 8 Jan 2020 15:23:37 +1100 Message-Id: <20200108042338.9082-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200108042338.9082-1-richard.henderson@linaro.org> References: <20200108042338.9082-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::629 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: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Enable s390x, aka SYSZ, in the git submodule build. Set the capstone parameters for both s390x host and guest. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 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 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 Mon May 6 02:12:05 2024 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=fail; 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=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1578457675; cv=none; d=zohomail.com; s=zohoarc; b=E/C7UpCv9W/K3Xyq4s1zHP9n9wWzHLoxM/pCcyHjuyAmEpz34gnIp4ybjOpBiZ2OkplfwF3L+0eS1EphScBftY4ZBhk7fkaEThvYLfS/cCVRQyo2rZ/0uSQG12DrHhfyhqbzcubcVJrI1Egrp0apgG2p2SiCRZ0FRRNMHrWQisA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578457675; h=Content-Type: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=gn2qUm60pHFb0jINIBzLmU8PxWdzwQ1RyRD8IbxWKSM=; b=lrYyMbceqa/qsi8ZwGSDg41mceqzGlZFPuGC0HUTXykvdRd7KMbZy3l7ID0AIiejUSwptWsat5x3VcHkoPexJ4kOUCL6rdt1uD/lopl0BHHcFzqZ+CTt+LxP6PiKnUVmZautzb0+A4OWaZkV/Klv7r7DTMdmHHYmriV2yOCfkQE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1578457675069739.3872737148148; Tue, 7 Jan 2020 20:27:55 -0800 (PST) Received: from localhost ([::1]:36212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ip2wj-00032A-TA for importer@patchew.org; Tue, 07 Jan 2020 23:27:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46651) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ip2ss-0007nI-M7 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 23:23:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ip2sr-0003bZ-Jn for qemu-devel@nongnu.org; Tue, 07 Jan 2020 23:23:54 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:34959) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ip2sr-0003aW-Dd for qemu-devel@nongnu.org; Tue, 07 Jan 2020 23:23:53 -0500 Received: by mail-pl1-x632.google.com with SMTP id g6so585029plt.2 for ; Tue, 07 Jan 2020 20:23:53 -0800 (PST) Received: from localhost.localdomain (alanje.lnk.telstra.net. [120.151.179.201]) by smtp.gmail.com with ESMTPSA id f9sm1192702pfd.141.2020.01.07.20.23.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2020 20:23:51 -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=gn2qUm60pHFb0jINIBzLmU8PxWdzwQ1RyRD8IbxWKSM=; b=go5yC9nSc2YPTfUtpb7zjpFW6r+UHpsC+DzJ5B3bw1XW7yC2b0Y38mB4K2z82yizMK 7cytF57P9sRW8CUABi5v08Vnfm8nJZIPz+Q5/QZpxpZiyPR8P+On2SqSVcwtaFrLZ5mU okz71GrXpUKfnjVSAZxi0kmTE1E4UuJRcu/axF/EvF3z7ak6Vm/yeMtY/92g5dRlHD2r 0YiqAbZpnUhl5QFWj8P6jNqfExzTZxsKrs8OszO5r2ky9urmd5qX1N8YvidnJgRT7DPQ ZjgTp3TWhEzBM1u7u3ff14mrDU18ZK/QN04ffENWgSLhjeSUaZB64rZOm3f63IWEp+ZZ SZyQ== 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=gn2qUm60pHFb0jINIBzLmU8PxWdzwQ1RyRD8IbxWKSM=; b=Xyqtdv0C2wmpv9JeELIdmAmdZghje0H5uwG1snS5iaV9YP1iKhVOSwTyPQwvHuhF1m 9Oc7QTQQSRTi3K+qrB42TD1pNMtdfRvHDw87mQxyD48tAdq2nl+64lnsNIaiawi3F+1G a+TlxaVDTn/+4Sexeo1i3BeIwOhjlmHsr9ZY/YMbT0Xjy9/orIIYfezv6koVZUDd85+k jMakkOApGtsWp0S5iK6nM1ZiqvTLd6+QedZtJp/X2MbX4NSj+zy/P68kSkMMjucYhg+f 4eqGdpapE6gt6RyQ6yDUz1YBNxb1CEtyB7iknSGwo+YuL9OVmWF0R/8rB2aCmz8DfDIx 3/SQ== X-Gm-Message-State: APjAAAUbFCLHHtbjuGsopO7dciR6ttXL6ZQ5UxWTsT8bIW1yYd/+6Rbq dKj/379PoqjPridVc/20TFDqfs9G9KKf0g== X-Google-Smtp-Source: APXvYqwH8FYieKNbIS8BmVeRbiHpN5JCf8+KjP/fsfGgRzYBCkeUbSGggwj6yPVLHGuWGllvjuX2Hg== X-Received: by 2002:a17:902:265:: with SMTP id 92mr3144519plc.188.1578457432063; Tue, 07 Jan 2020 20:23:52 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 3/3] capstone: Add skipdata hook for s390x Date: Wed, 8 Jan 2020 15:23:38 +1100 Message-Id: <20200108042338.9082-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200108042338.9082-1-richard.henderson@linaro.org> References: <20200108042338.9082-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::632 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: peter.maydell@linaro.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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. Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Signed-off-by: Richard Henderson --- 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