diff options
author | Paul Mundt <lethal@linux-sh.org> | 2006-09-27 05:20:16 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2006-09-27 05:20:16 -0400 |
commit | d153ea88dccf003173315b5d21acabebb897fb4a (patch) | |
tree | 5cdc96ef0ec58026d82c03f76250ac1833f566d4 /arch/sh/kernel/irq.c | |
parent | 7a440c950efb5cdc8a05cc6c3ec8fc864b60ef77 (diff) |
sh: stack debugging support.
This adds a DEBUG_STACK_USAGE and DEBUG_STACKOVERFLOW for SH.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/irq.c')
-rw-r--r-- | arch/sh/kernel/irq.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c index c2e07f7f3496..7066611aeb72 100644 --- a/arch/sh/kernel/irq.c +++ b/arch/sh/kernel/irq.c | |||
@@ -60,7 +60,6 @@ unlock: | |||
60 | } | 60 | } |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | |||
64 | asmlinkage int do_IRQ(unsigned long r4, unsigned long r5, | 63 | asmlinkage int do_IRQ(unsigned long r4, unsigned long r5, |
65 | unsigned long r6, unsigned long r7, | 64 | unsigned long r6, unsigned long r7, |
66 | struct pt_regs regs) | 65 | struct pt_regs regs) |
@@ -69,6 +68,22 @@ asmlinkage int do_IRQ(unsigned long r4, unsigned long r5, | |||
69 | 68 | ||
70 | irq_enter(); | 69 | irq_enter(); |
71 | 70 | ||
71 | #ifdef CONFIG_DEBUG_STACKOVERFLOW | ||
72 | /* Debugging check for stack overflow: is there less than 1KB free? */ | ||
73 | { | ||
74 | long sp; | ||
75 | |||
76 | __asm__ __volatile__ ("and r15, %0" : | ||
77 | "=r" (sp) : "0" (THREAD_SIZE - 1)); | ||
78 | |||
79 | if (unlikely(sp < (sizeof(struct thread_info) + STACK_WARN))) { | ||
80 | printk("do_IRQ: stack overflow: %ld\n", | ||
81 | sp - sizeof(struct thread_info)); | ||
82 | dump_stack(); | ||
83 | } | ||
84 | } | ||
85 | #endif | ||
86 | |||
72 | #ifdef CONFIG_CPU_HAS_INTEVT | 87 | #ifdef CONFIG_CPU_HAS_INTEVT |
73 | __asm__ __volatile__ ( | 88 | __asm__ __volatile__ ( |
74 | #ifdef CONFIG_CPU_HAS_SR_RB | 89 | #ifdef CONFIG_CPU_HAS_SR_RB |