Skip to content

Commit

Permalink
checkstack: add riscv support for scripts/checkstack.pl
Browse files Browse the repository at this point in the history
scripts/checkstack.pl lacks support for the riscv architecture. Add
support to detect "addi sp,sp,-FRAME_SIZE" stack frame generation instruction

Signed-off-by: Wadim Mueller <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
wafgo authored and masahir0y committed Jul 27, 2022
1 parent 10269fd commit 1fd49a0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/checkstack.pl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# AArch64, PARISC ports by Kyle McMartin
# sparc port by Martin Habets <[email protected]>
# ppc64le port by Breno Leitao <[email protected]>
# riscv port by Wadim Mueller <[email protected]>
#
# Usage:
# objdump -d vmlinux | scripts/checkstack.pl [arch]
Expand Down Expand Up @@ -108,6 +109,9 @@
} elsif ($arch eq 'sparc' || $arch eq 'sparc64') {
# f0019d10: 9d e3 bf 90 save %sp, -112, %sp
$re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o;
} elsif ($arch =~ /^riscv(64)?$/) {
#ffffffff8036e868: c2010113 addi sp,sp,-992
$re = qr/.*addi.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o;
} else {
print("wrong or unknown architecture \"$arch\"\n");
exit
Expand Down

0 comments on commit 1fd49a0

Please sign in to comment.