While I was reading the code of get_wchan() in x86 32bit and 64bit, I notice the following difference,
32bit get_wchan
#define top_esp (THREAD_SIZE - sizeof(unsigned long))
#define top_ebp (THREAD_SIZE - 2*sizeof(unsigned long))
unsigned long get_wchan(struct task_struct *p)
{
...
if (!stack_page || sp < stack_page || sp > top_esp+stack_page)
return 0;
bp = *(unsigned long *) sp;
do {
if (bp < stack_page || bp > top_ebp+stack_page)
return 0;
...
} while (count++ < 16);
return 0;
}
64bit get_wchan
unsigned long get_wchan(struct task_struct *p)
{
...
if (p->thread.sp < stack || p->thread.sp >= stack+THREAD_SIZE)
return 0;
fp = *(u64 *)(p->thread.sp);
do {
if (fp < (unsigned long)stack ||
fp >= (unsigned long)stack+THREAD_SIZE)
return 0;
...
} while (count++ < 16);
return 0;
}
Question 1:
Could anyone help tell me why in 64 bit, we don't use fp > (THREAD_SIZE - 2*sizeof(unsigned long)) like 32 bit?
Question 2:
Why is the limited count of frame loops 16?
Thanks,
Ye
-- We Make every day party day
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies