mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Borislav Petkov <bp@suse.de>, linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 1/1] scripts/decodecode: Decode 32-bit code correctly on x86_64
Date: Fri,  5 Mar 2021 20:39:48 +0200	[thread overview]
Message-ID: <20210305183948.37738-1-andriy.shevchenko@linux.intel.com> (raw)

On x86_64 host the objdump uses current architecture which is 64-bit
and hence decodecode shows wrong instructions.

Fix it by supplying '-M i386' in case of ARCH i?86 or x86.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 scripts/decodecode | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/scripts/decodecode b/scripts/decodecode
index 31d884e35f2f..020a84982249 100755
--- a/scripts/decodecode
+++ b/scripts/decodecode
@@ -75,21 +75,25 @@ disas() {
 
 	${CROSS_COMPILE}as $AFLAGS -o $t.o $t.s > /dev/null 2>&1
 
-	if [ "$ARCH" = "arm" ]; then
+	case "$ARCH" in
+	arm)
 		if [ $width -eq 2 ]; then
 			OBJDUMPFLAGS="-M force-thumb"
 		fi
 
 		${CROSS_COMPILE}strip $t.o
-	fi
-
-	if [ "$ARCH" = "arm64" ]; then
+		;;
+	arm64)
 		if [ $width -eq 4 ]; then
 			type=inst
 		fi
 
 		${CROSS_COMPILE}strip $t.o
-	fi
+		;;
+	i?86|x86)
+			OBJDUMPFLAGS="-M i386"
+		;;
+	esac
 
 	if [ $pc_sub -ne 0 ]; then
 		if [ $PC ]; then
-- 
2.30.1


             reply	other threads:[~2021-03-05 18:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 18:39 Andy Shevchenko [this message]
2021-03-05 22:19 ` Borislav Petkov
2021-03-08  9:59   ` Andy Shevchenko
2021-03-08 10:17     ` Borislav Petkov
2021-03-08 10:22       ` Andy Shevchenko
2021-03-08 11:12         ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210305183948.37738-1-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome