I am doing a project in linux kernel and I wanted to know what does this checkstack.pl do? I have never studied perl so cant understand the program. It will be great if I co
As already explained above that Perl script is used to find out the stack usage of kernel code, I think that Perl is used due to the fact that parsing the output of objdump -d
won't be so easy if done through C code.
You can find the stack usage at the runtime by taking the address of the first argument and the address of last local variable, then subtract them, something like:
int stack_usage_func(char i)
{
int j,k,l;
char buf[256];
char m;
unsigned long stack_use = &i - &m;
//do all processing
return stack_use
}
The return of the function should give you the runtime stack usage, I have not compiled the code, so please ignore if it gives compilation errors, but the logic should work.