11 #include <linux/module.h>
30 #ifdef CONFIG_DEBUG_STACKOVERFLOW
35 static int check_stack_overflow(
void)
39 __asm__ __volatile__(
"andl %%esp,%0" :
45 static void print_stack_overflow(
void)
50 panic(
"low stack detected by irq handler - check messages\n");
54 static inline int check_stack_overflow(
void) {
return 0; }
55 static inline void print_stack_overflow(
void) { }
69 static void call_on_stack(
void *
func,
void *
stack)
71 asm volatile(
"xchgl %%ebx,%%esp \n"
77 :
"memory",
"cc",
"edx",
"ecx",
"eax");
99 isp = (
u32 *) ((
char *)irqctx +
sizeof(*irqctx));
101 irqctx->
tinfo.previous_esp = current_stack_pointer;
104 irqctx->
tinfo.preempt_count = curctx->
tinfo.preempt_count;
107 call_on_stack(print_stack_overflow, isp);
109 asm volatile(
"xchgl %%ebx,%%esp \n"
111 "movl %%ebx,%%esp \n"
112 :
"=a" (
arg1),
"=d" (arg2),
"=b" (isp)
113 :
"0" (irq),
"1" (desc),
"2" (isp),
115 :
"memory",
"cc",
"ecx");
137 per_cpu(hardirq_ctx, cpu) = irqctx;
146 per_cpu(softirq_ctx, cpu) = irqctx;
168 irqctx->
tinfo.previous_esp = current_stack_pointer;
171 isp = (
u32 *) ((
char *)irqctx +
sizeof(*irqctx));
188 overflow = check_stack_overflow();
194 if (user_mode_vm(regs) || !execute_on_irq_stack(overflow, desc, irq)) {
196 print_stack_overflow();