diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2009-04-22 11:31:37 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-05-21 01:43:58 -0400 |
commit | d7cb10d6d23f451eec3d1f0f4e4e8862333fa152 (patch) | |
tree | 0deb8c084116fdafabbc35074533c9b2b23071cb /arch/powerpc/kernel/irq.c | |
parent | f2694ba56808a3a0fa45d9bb45289575f31e48d2 (diff) |
powerpc/irq: Move stack overflow check into a separate function
Makes do_IRQ() shorter and clearer.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/irq.c')
-rw-r--r-- | arch/powerpc/kernel/irq.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 3d3658d0b7b9..463b6ab9d6b9 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -301,6 +301,22 @@ static inline void handle_one_irq(unsigned int irq) | |||
301 | } | 301 | } |
302 | #endif | 302 | #endif |
303 | 303 | ||
304 | static inline void check_stack_overflow(void) | ||
305 | { | ||
306 | #ifdef CONFIG_DEBUG_STACKOVERFLOW | ||
307 | long sp; | ||
308 | |||
309 | sp = __get_SP() & (THREAD_SIZE-1); | ||
310 | |||
311 | /* check for stack overflow: is there less than 2KB free? */ | ||
312 | if (unlikely(sp < (sizeof(struct thread_info) + 2048))) { | ||
313 | printk("do_IRQ: stack overflow: %ld\n", | ||
314 | sp - sizeof(struct thread_info)); | ||
315 | dump_stack(); | ||
316 | } | ||
317 | #endif | ||
318 | } | ||
319 | |||
304 | void do_IRQ(struct pt_regs *regs) | 320 | void do_IRQ(struct pt_regs *regs) |
305 | { | 321 | { |
306 | struct pt_regs *old_regs = set_irq_regs(regs); | 322 | struct pt_regs *old_regs = set_irq_regs(regs); |
@@ -308,20 +324,7 @@ void do_IRQ(struct pt_regs *regs) | |||
308 | 324 | ||
309 | irq_enter(); | 325 | irq_enter(); |
310 | 326 | ||
311 | #ifdef CONFIG_DEBUG_STACKOVERFLOW | 327 | check_stack_overflow(); |
312 | /* Debugging check for stack overflow: is there less than 2KB free? */ | ||
313 | { | ||
314 | long sp; | ||
315 | |||
316 | sp = __get_SP() & (THREAD_SIZE-1); | ||
317 | |||
318 | if (unlikely(sp < (sizeof(struct thread_info) + 2048))) { | ||
319 | printk("do_IRQ: stack overflow: %ld\n", | ||
320 | sp - sizeof(struct thread_info)); | ||
321 | dump_stack(); | ||
322 | } | ||
323 | } | ||
324 | #endif | ||
325 | 328 | ||
326 | /* | 329 | /* |
327 | * Every platform is required to implement ppc_md.get_irq. | 330 | * Every platform is required to implement ppc_md.get_irq. |