在 do_IRQ 你可以找到下面的代码!
#ifdef CONFIG_DEBUG_STACKOVERFLOW
/* Debugging check for stack overflow: is there less than 1KB free? */
{
long esp;
__asm__ __volatile__("andl %%esp,%0" :
"=r" (esp) : "0" (THREAD_SIZE - 1));
if (unlikely(esp < (sizeof(struct thread_info) + STACK_WARN))) {
printk("do_IRQ: stack overflow: %ld\n",
esp - sizeof(struct thread_info));
dump_stack();
}
}
#endif
我不明白这个 asm 程序集
asm _ volatile _("andl %%esp,%0" : "=r" (esp) : "0" (THREAD_SIZE - 1)); THREAD_SIZE - 1 是什么意思?我记得括号里的符号应该是像输出部分的esp一样的C变量,但是在输入部分它看起来像一个整数而不是C符号,请大家帮忙