Skip to content

Commit

Permalink
powerpc/irq: Move stack overflow check into a separate function
Browse files Browse the repository at this point in the history
Makes do_IRQ() shorter and clearer.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Michael Ellerman authored and Benjamin Herrenschmidt committed May 21, 2009
1 parent f2694ba commit d7cb10d
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions arch/powerpc/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,27 +301,30 @@ static inline void handle_one_irq(unsigned int irq)
}
#endif

static inline void check_stack_overflow(void)
{
#ifdef CONFIG_DEBUG_STACKOVERFLOW
long sp;

sp = __get_SP() & (THREAD_SIZE-1);

/* check for stack overflow: is there less than 2KB free? */
if (unlikely(sp < (sizeof(struct thread_info) + 2048))) {
printk("do_IRQ: stack overflow: %ld\n",
sp - sizeof(struct thread_info));
dump_stack();
}
#endif
}

void do_IRQ(struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);
unsigned int irq;

irq_enter();

#ifdef CONFIG_DEBUG_STACKOVERFLOW
/* Debugging check for stack overflow: is there less than 2KB free? */
{
long sp;

sp = __get_SP() & (THREAD_SIZE-1);

if (unlikely(sp < (sizeof(struct thread_info) + 2048))) {
printk("do_IRQ: stack overflow: %ld\n",
sp - sizeof(struct thread_info));
dump_stack();
}
}
#endif
check_stack_overflow();

/*
* Every platform is required to implement ppc_md.get_irq.
Expand Down

0 comments on commit d7cb10d

Please sign in to comment.