History

checkstack: add riscv support for scripts/checkstack.pl

scripts/checkstack.pl lacks support for the riscv architecture. Add support to detect "addi sp,sp,-FRAME_SIZE" stack frame generation instruction

Wadim Mueller committed 4 years ago

Commit 1fd49a01 parent 10269fd1 file · +4 −0Browse files

Showing the changes to scripts/checkstack.pl (1 of 1 file). Show all

Unified · Split

scripts/checkstack.pl+4−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
16# AArch64, PARISC ports by Kyle McMartin16# AArch64, PARISC ports by Kyle McMartin
17# sparc port by Martin Habets <errandir_news@mph.eclipse.co.uk>17# sparc port by Martin Habets <errandir_news@mph.eclipse.co.uk>
18# ppc64le port by Breno Leitao <leitao@debian.org>18# ppc64le port by Breno Leitao <leitao@debian.org>
19# riscv port by Wadim Mueller <wafgo01@gmail.com>
19#20#
20# Usage:21# Usage:
21# objdump -d vmlinux | scripts/checkstack.pl [arch]22# objdump -d vmlinux | scripts/checkstack.pl [arch]
@@ -108,6 +109,9 @@ my (@stack, $re, $dre, $sub, $x, $xs, $funcre, $min_stack); · 86 unmodified lines
108 } elsif ($arch eq 'sparc' || $arch eq 'sparc64') {109 } elsif ($arch eq 'sparc' || $arch eq 'sparc64') {
109 # f0019d10: 9d e3 bf 90 save %sp, -112, %sp110 # f0019d10: 9d e3 bf 90 save %sp, -112, %sp
110 $re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o;111 $re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o;
112 } elsif ($arch =~ /^riscv(64)?$/) {
113 #ffffffff8036e868: c2010113 addi sp,sp,-992
114 $re = qr/.*addi.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o;
111 } else {115 } else {
112 print("wrong or unknown architecture \"$arch\"\n");116 print("wrong or unknown architecture \"$arch\"\n");
113 exit117 exit