Re: [U-Boot] checkstack.pl

2015-03-07 Thread Tom Rini
On Wed, Jan 28, 2015 at 01:15:11PM -0600, Kim Phillips wrote:

 From 42512a3fe6f2434cfc9381328d2a4755ebe6d051 Mon Sep 17 00:00:00 2001
 From: Kim Phillips kim.phill...@freescale.com
 Date: Wed, 28 Jan 2015 13:15:01 -0600
 Subject: [PATCH] scripts/checkstack.pl: update to get AArch64 port from Linux
 
 Bring checkstack.pl up to date from its upstream Linux development.
 Effectively, the following linux commits:
 
 208ad00 checkstack.pl: port to AArch64
 fda9f99 scripts/checkstack.pl: automatically handle 32-bit and 64-bit mode 
 for ARCH=x86
 7eb6e34 kbuild: trivial - remove trailing empty lines
 690998b scripts/checkstack.pl: Add metag support
 
 Reported-by: York Sun york...@freescale.com
 Cc: Masahiro Yamada yamad...@jp.panasonic.com
 Signed-off-by: Kim Phillips kim.phill...@freescale.com

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] checkstack.pl

2015-01-28 Thread Kim Phillips
From 42512a3fe6f2434cfc9381328d2a4755ebe6d051 Mon Sep 17 00:00:00 2001
From: Kim Phillips kim.phill...@freescale.com
Date: Wed, 28 Jan 2015 13:15:01 -0600
Subject: [PATCH] scripts/checkstack.pl: update to get AArch64 port from Linux

Bring checkstack.pl up to date from its upstream Linux development.
Effectively, the following linux commits:

208ad00 checkstack.pl: port to AArch64
fda9f99 scripts/checkstack.pl: automatically handle 32-bit and 64-bit mode for 
ARCH=x86
7eb6e34 kbuild: trivial - remove trailing empty lines
690998b scripts/checkstack.pl: Add metag support

Reported-by: York Sun york...@freescale.com
Cc: Masahiro Yamada yamad...@jp.panasonic.com
Signed-off-by: Kim Phillips kim.phill...@freescale.com
---
 scripts/checkstack.pl | 27 ---
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
index c1cdc0a..dd83978 100755
--- a/scripts/checkstack.pl
+++ b/scripts/checkstack.pl
@@ -13,7 +13,7 @@
 #  Random bits by Matt Mackall m...@selenic.com
 #  M68k port by Geert Uytterhoeven and Andreas Schwab
 #  AVR32 port by Haavard Skinnemoen (Atmel)
-#  PARISC port by Kyle McMartin k...@parisc-linux.org
+#  AArch64, PARISC ports by Kyle McMartin
 #  sparc port by Martin Habets errandir_n...@mph.eclipse.co.uk
 #
 #  Usage:
@@ -34,7 +34,7 @@ use strict;
 # $1 (first bracket) matches the dynamic amount of the stack growth
 #
 # use anything else and feel the pain ;)
-my (@stack, $re, $dre, $x, $xs);
+my (@stack, $re, $dre, $x, $xs, $funcre);
 {
my $arch = shift;
if ($arch eq ) {
@@ -44,21 +44,23 @@ my (@stack, $re, $dre, $x, $xs);
 
$x  = [0-9a-f];   # hex character
$xs = [0-9a-f ];  # hex character or space
-   if ($arch eq 'arm') {
+   $funcre = qr/^$x* (.*):$/;
+   if ($arch eq 'aarch64') {
+   #ffc0006325cc:   a9bb7bfdstp x29, x30, 
[sp,#-80]!
+   $re = qr/^.*stp.*sp,\#-([0-9]{1,8})\]\!/o;
+   } elsif ($arch eq 'arm') {
#c0008ffc:  e24dd064sub sp, sp, #100; 0x64
$re = qr/.*sub.*sp, sp, #(([0-9]{2}|[3-9])[0-9]{2})/o;
} elsif ($arch eq 'avr32') {
#808a:   20 1d   sub sp,4
#8ca8:   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 00sub$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') {
#e44011fc:   01 0f fc 8c adds r12=-384,r12
$re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o;
@@ -66,6 +68,10 @@ my (@stack, $re, $dre, $x, $xs);
#2b6c:   4e56 fb70   linkw %fp,#-1168
#  1df770:   defc ffe4   addaw #-28,%sp
$re = qr/.*(?:linkw %fp,|addaw )#-([0-9]{1,4})(?:,%sp)?$/o;
+   } elsif ($arch eq 'metag') {
+   #400026fc:   40 00 00 82 ADD   A0StP,A0StP,#0x8
+   $re = qr/.*ADD.*A0StP,A0StP,\#(0x$x{1,8})/o;
+   $funcre = qr/^$x* [^\$](.*):$/;
} elsif ($arch eq 'mips64') {
#8800402c:   67bdfff0daddiu  sp,sp,-16
$re = qr/.*daddiu.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o;
@@ -109,7 +115,6 @@ my (@stack, $re, $dre, $x, $xs);
 #
 # main()
 #
-my $funcre = qr/^$x* (.*):$/;
 my ($func, $file, $lastslash);
 
 while (my $line = STDIN) {
-- 
2.2.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] checkstack.pl

2015-01-27 Thread York Sun
Masahiro,

Do you mind to add aarch64 support for checkstack.pl?

$ make checkstack
/opt/linaro/gcc-linaro-aarch64-linux-gnu-4.8-2013.12_linux/bin/aarch64-linux-gnu-objdump
-d u-boot $(find . -name u-boot-spl) | \
perl ./scripts/checkstack.pl aarch64
wrong or unknown architecture aarch64

York
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot