From 769f9b6fb4f2a2c1b67250714b4e2757bd91e89e Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Thu, 8 Sep 2022 14:01:59 +0900 Subject: [PATCH] scripts/checkstack.pl: Support huge stack sizes on arm64 arm64 uses this idiom to build huge stack frames: sub sp, sp, #0x1, lsl #12 Add support for this in checkstack.pl. Signed-off-by: Asahi Lina --- scripts/checkstack.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl index d2c38584ece6fe..63d542e0a230a1 100755 --- a/scripts/checkstack.pl +++ b/scripts/checkstack.pl @@ -57,7 +57,7 @@ #ffffffc0006325cc: a9bb7bfd stp x29, x30, [sp, #-80]! #a110: d11643ff sub sp, sp, #0x590 $re = qr/^.*stp.*sp, \#-([0-9]{1,8})\]\!/o; - $dre = qr/^.*sub.*sp, sp, #(0x$x{1,8})/o; + $dre = qr/^.*sub.*sp, sp, #(0x$x{1,8})(?:, lsl #([0-9]*))?/o; } elsif ($arch eq 'arm') { #c0008ffc: e24dd064 sub sp, sp, #100 ; 0x64 $re = qr/.*sub.*sp, sp, #([0-9]{1,4})/o; @@ -183,8 +183,10 @@ sub arm_push_handling { } elsif (defined $dre && $line =~ m/$dre/) { my $size = $1; + my $shift = $2; $size = hex($size) if ($size =~ /^0x/); + $size = $size << $shift if $shift; $total_size += $size; } elsif (defined $sub) {