public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <koct9i@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "x86@kernel.org" <x86@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	user-mode-linux-devel@lists.sourceforge.net,
	linux-kbuild@vger.kernel.org
Subject: [PATCH] scripts/checkstack.pl: automatically handle 32-bit and 64-bit mode for ARCH=x86
Date: Tue, 08 Jul 2014 14:35:57 +0400	[thread overview]
Message-ID: <20140708103557.4408.87822.stgit@zurg> (raw)
In-Reply-To: <CALYGNiOkiBWfT1+SeAkx1qEZKFm2y9G1gXhVEyNC0OrewB2ktA@mail.gmail.com>

This patch adds support for ARCH=x86 into checkstack.

commit ffee0de ("x86: Default to ARCH=x86 to avoid overriding CONFIG_64BIT")
had merged ARCH=i386 and ARCH=x86_64 into one ARCH=x86. checkstack.pl searches
patterns of machine instructions which are usually used for allocating stack
frames. checkstalk.pl needs either i386 or x86_64, x86 isn't enough:

$ make checkstack
objdump -d vmlinux $(find . -name '*.ko') | \
perl linux/scripts/checkstack.pl x86
wrong or unknown architecture "x86"

Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
---
 scripts/checkstack.pl |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
index c05d586..899b423 100755
--- a/scripts/checkstack.pl
+++ b/scripts/checkstack.pl
@@ -52,14 +52,12 @@ my (@stack, $re, $dre, $x, $xs, $funcre);
 		#8000008a:       20 1d           sub sp,4
 		#80000ca8:       fa cd 05 b0     sub sp,sp,1456
 		$re = qr/^.*sub.*sp.*,([0-9]{1,8})/o;
-	} elsif ($arch =~ /^i[3456]86$/) {
+	} elsif ($arch =~ /^x86(_64)?$/ || $arch =~ /^i[3456]86$/) {
 		#c0105234:       81 ec ac 05 00 00       sub    $0x5ac,%esp
-		$re = qr/^.*[as][du][db]    \$(0x$x{1,8}),\%esp$/o;
-		$dre = qr/^.*[as][du][db]    (%.*),\%esp$/o;
-	} elsif ($arch eq 'x86_64') {
-		#    2f60:	48 81 ec e8 05 00 00 	sub    $0x5e8,%rsp
-		$re = qr/^.*[as][du][db]    \$(0x$x{1,8}),\%rsp$/o;
-		$dre = qr/^.*[as][du][db]    (\%.*),\%rsp$/o;
+		# or
+		#    2f60:    48 81 ec e8 05 00 00       sub    $0x5e8,%rsp
+		$re = qr/^.*[as][du][db]    \$(0x$x{1,8}),\%(e|r)sp$/o;
+		$dre = qr/^.*[as][du][db]    (%.*),\%(e|r)sp$/o;
 	} elsif ($arch eq 'ia64') {
 		#e0000000044011fc:       01 0f fc 8c     adds r12=-384,r12
 		$re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o;


      reply	other threads:[~2014-07-08 10:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-05 11:22 [PATCH] checkstack: use $UTS_MACHINE as target architecture Konstantin Khlebnikov
2014-07-07 22:05 ` Andrew Morton
2014-07-08  5:48   ` Konstantin Khlebnikov
2014-07-08  8:01     ` [uml-devel] " Richard Weinberger
2014-07-08  8:16       ` Konstantin Khlebnikov
2014-07-08  8:20         ` Richard Weinberger
2014-07-08  8:30           ` Konstantin Khlebnikov
2014-07-08  8:33             ` Richard Weinberger
2014-07-08  8:47               ` Konstantin Khlebnikov
2014-07-08  8:50                 ` Richard Weinberger
2014-07-08  9:03                   ` Konstantin Khlebnikov
2014-07-08  9:06                     ` Richard Weinberger
2014-07-08  9:09                       ` Geert Uytterhoeven
2014-07-08  9:14                         ` Richard Weinberger
2014-07-08  9:22                           ` Geert Uytterhoeven
2014-07-08  9:23                             ` Richard Weinberger
2014-07-08 10:31     ` Konstantin Khlebnikov
2014-07-08 10:35       ` Konstantin Khlebnikov [this message]

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=20140708103557.4408.87822.stgit@zurg \
    --to=koct9i@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    --cc=x86@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