mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 1/1] scripts/decodecode: Decode 32-bit code correctly on x86_64
@ 2021-03-05 18:39 Andy Shevchenko
  2021-03-05 22:19 ` Borislav Petkov
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2021-03-05 18:39 UTC (permalink / raw)
  To: Borislav Petkov, linux-kernel; +Cc: Andrew Morton, Andy Shevchenko

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-08 11:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05 18:39 [PATCH v1 1/1] scripts/decodecode: Decode 32-bit code correctly on x86_64 Andy Shevchenko
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

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