From patchwork Thu Sep 28 10:55:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 114410 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp587082qgf; Thu, 28 Sep 2017 03:55:39 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCncLmGXyS9uwP7/TtHqh/iDAvEZZVbWZbqJg7BqBVM+Z80l164lElcbW6XphRL6w+gWn9A X-Received: by 10.98.182.16 with SMTP id j16mr3961046pff.271.1506596139463; Thu, 28 Sep 2017 03:55:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506596139; cv=none; d=google.com; s=arc-20160816; b=nVaFi2jUSjPlhpJHOCy3y4ktmxaolu6MAjLA36CkwocJJre3VF9ft8rfd3U9LtJcGt bxFsMX2RzGUAo5Fd9vYUouDpUBHn6nNsym3q3k1XPf+AaS9Yr1E8CM3jVFcieeglhfOE PjOHZPsYa4WLIu/e1pwnV8p6bU2Wo6ePCmKvL00loy7Bilhb8oyQpA2ofj2ZjbIkbaRx POG1GQshHZel4D2Iit2x9FC2izlMCimYh7N1pdx7no2B3RY/yGiGxc0X3moaLdYEF+Oe peVXuL+kZFYoOABSlJ7EgPsAvSQMhy/p8axjlCpW13Mj4R+VCspLkqYyT5qvjnVSHNu1 Q0NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=K8OI1AA3Ivuzp6xJzdDb6N5Ep66lSkcRhjKJl4+NA/E=; b=FvC/BqMwevbCDb+neFGiATi/W7+pr25hAC8cj8dHTkTNN9OESZ/l2b1RNPEY2m5RXJ g5uN8eJf9h/wgtBW0wrUJGRmzFcPM/nZrfO2NLEt+CkYp4szwVeXBLwRa8m40Y7/35Rl y+X0faK09QXXeQchE/6JWbFUXn9/Fmyp0VW6X+KX1D5xT09ETN9HChhkxFdWjBtFbTVB abCaxvr9wwMqX6H4TUYrkG3LQRNoDd1x1oAZB/Z9b5/prS1LHIKVAsR7R4vaPWwGW2qj XI5AUxOIWxV9qE8+cXiWoFNbtPl9re20vldRxaO2iKX6zZzS1VGzkmF06XAbos5IoXN4 48xg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2si1150333plt.554.2017.09.28.03.55.39; Thu, 28 Sep 2017 03:55:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752930AbdI1Kzh (ORCPT + 26 others); Thu, 28 Sep 2017 06:55:37 -0400 Received: from foss.arm.com ([217.140.101.70]:55160 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752891AbdI1Kzd (ORCPT ); Thu, 28 Sep 2017 06:55:33 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9EFEA1529; Thu, 28 Sep 2017 03:55:33 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6F73A3F53D; Thu, 28 Sep 2017 03:55:33 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 0F03D1AE2FC7; Thu, 28 Sep 2017 11:55:48 +0100 (BST) From: Will Deacon To: mmarek@suse.cz Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, Will Deacon Subject: [PATCH] scripts/decodecode: Fix decoding for AArch64 (arm64) instructions Date: Thu, 28 Sep 2017 11:55:47 +0100 Message-Id: <1506596147-23630-1-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are a couple of problems with the decodecode script and arm64: 1. AArch64 objdump refuses to disassemble .4byte directives as instructions, insisting that they are data values and displaying them as: a94153f3 .word 0xa94153f3 <-- trapping instruction This is resolved by using the .inst directive instead. 2. Disassembly of branch instructions attempts to provide the target as an offset from a symbol, e.g.: 0: 34000082 cbz w2, 10 <.text+0x10> however this falls foul of the grep -v, which matches lines containing ".text" and ends up removing all branch instructions from the dump. This patch resolves both issues by using the .inst directive for 4-byte quantities on arm64 and stripping the resulting binaries (as is done on arm already) to remove the mapping symbols. Signed-off-by: Will Deacon --- scripts/decodecode | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.1.4 Reviewed-by: Dave Martin diff --git a/scripts/decodecode b/scripts/decodecode index d8824f37acce..67214ec5b2cb 100755 --- a/scripts/decodecode +++ b/scripts/decodecode @@ -58,6 +58,14 @@ disas() { ${CROSS_COMPILE}strip $1.o fi + if [ "$ARCH" = "arm64" ]; then + if [ $width -eq 4 ]; then + type=inst + fi + + ${CROSS_COMPILE}strip $1.o + fi + ${CROSS_COMPILE}objdump $OBJDUMPFLAGS -S $1.o | \ grep -v "/tmp\|Disassembly\|\.text\|^$" > $1.dis 2>&1 }