Commit 690998b6 authored by James Hogan's avatar James Hogan

scripts/checkstack.pl: Add metag support

Adapt checkstack.pl so that it works for metag.
Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
parent 00512bdd
...@@ -34,7 +34,7 @@ use strict; ...@@ -34,7 +34,7 @@ use strict;
# $1 (first bracket) matches the dynamic amount of the stack growth # $1 (first bracket) matches the dynamic amount of the stack growth
# #
# use anything else and feel the pain ;) # use anything else and feel the pain ;)
my (@stack, $re, $dre, $x, $xs); my (@stack, $re, $dre, $x, $xs, $funcre);
{ {
my $arch = shift; my $arch = shift;
if ($arch eq "") { if ($arch eq "") {
...@@ -44,6 +44,7 @@ my (@stack, $re, $dre, $x, $xs); ...@@ -44,6 +44,7 @@ my (@stack, $re, $dre, $x, $xs);
$x = "[0-9a-f]"; # hex character $x = "[0-9a-f]"; # hex character
$xs = "[0-9a-f ]"; # hex character or space $xs = "[0-9a-f ]"; # hex character or space
$funcre = qr/^$x* <(.*)>:$/;
if ($arch eq 'arm') { if ($arch eq 'arm') {
#c0008ffc: e24dd064 sub sp, sp, #100 ; 0x64 #c0008ffc: e24dd064 sub sp, sp, #100 ; 0x64
$re = qr/.*sub.*sp, sp, #(([0-9]{2}|[3-9])[0-9]{2})/o; $re = qr/.*sub.*sp, sp, #(([0-9]{2}|[3-9])[0-9]{2})/o;
...@@ -66,6 +67,10 @@ my (@stack, $re, $dre, $x, $xs); ...@@ -66,6 +67,10 @@ my (@stack, $re, $dre, $x, $xs);
# 2b6c: 4e56 fb70 linkw %fp,#-1168 # 2b6c: 4e56 fb70 linkw %fp,#-1168
# 1df770: defc ffe4 addaw #-28,%sp # 1df770: defc ffe4 addaw #-28,%sp
$re = qr/.*(?:linkw %fp,|addaw )#-([0-9]{1,4})(?:,%sp)?$/o; $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') { } elsif ($arch eq 'mips64') {
#8800402c: 67bdfff0 daddiu sp,sp,-16 #8800402c: 67bdfff0 daddiu sp,sp,-16
$re = qr/.*daddiu.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o; $re = qr/.*daddiu.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o;
...@@ -109,7 +114,6 @@ my (@stack, $re, $dre, $x, $xs); ...@@ -109,7 +114,6 @@ my (@stack, $re, $dre, $x, $xs);
# #
# main() # main()
# #
my $funcre = qr/^$x* <(.*)>:$/;
my ($func, $file, $lastslash); my ($func, $file, $lastslash);
while (my $line = <STDIN>) { while (my $line = <STDIN>) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment