Skip to content

Commit

Permalink
scripts/checkstack.pl: Support huge stack sizes on arm64
Browse files Browse the repository at this point in the history
arm64 uses this idiom to build huge stack frames:

    sub     sp, sp, #0x1, lsl Rust-for-Linux#12

Add support for this in checkstack.pl.

Signed-off-by: Asahi Lina <lina@asahilina.net>
  • Loading branch information
asahilina committed Sep 28, 2022
1 parent 997a782 commit 769f9b6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/checkstack.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 769f9b6

Please sign in to comment.