aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sh
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2006-09-27 05:20:16 -0400
committerPaul Mundt <lethal@linux-sh.org>2006-09-27 05:20:16 -0400
commitd153ea88dccf003173315b5d21acabebb897fb4a (patch)
tree5cdc96ef0ec58026d82c03f76250ac1833f566d4 /include/asm-sh
parent7a440c950efb5cdc8a05cc6c3ec8fc864b60ef77 (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 'include/asm-sh')
-rw-r--r--include/asm-sh/page.h2
-rw-r--r--include/asm-sh/thread_info.h12
2 files changed, 9 insertions, 5 deletions
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index e9135532d00c..888d6fe0030e 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -16,7 +16,7 @@
16 16
17/* PAGE_SHIFT determines the page size */ 17/* PAGE_SHIFT determines the page size */
18#define PAGE_SHIFT 12 18#define PAGE_SHIFT 12
19#define PAGE_SIZE (1UL << PAGE_SHIFT) 19#define PAGE_SIZE (1 << PAGE_SHIFT)
20#define PAGE_MASK (~(PAGE_SIZE-1)) 20#define PAGE_MASK (~(PAGE_SIZE-1))
21#define PTE_MASK PAGE_MASK 21#define PTE_MASK PAGE_MASK
22 22
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h
index 5eb874b065a6..605259f88113 100644
--- a/include/asm-sh/thread_info.h
+++ b/include/asm-sh/thread_info.h
@@ -29,6 +29,8 @@ struct thread_info {
29#endif 29#endif
30 30
31#define PREEMPT_ACTIVE 0x10000000 31#define PREEMPT_ACTIVE 0x10000000
32#define THREAD_SIZE (PAGE_SIZE * 2)
33#define STACK_WARN (THREAD_SIZE / 8)
32 34
33/* 35/*
34 * macros/functions for gaining access to the thread information structure 36 * macros/functions for gaining access to the thread information structure
@@ -50,8 +52,6 @@ struct thread_info {
50#define init_thread_info (init_thread_union.thread_info) 52#define init_thread_info (init_thread_union.thread_info)
51#define init_stack (init_thread_union.stack) 53#define init_stack (init_thread_union.stack)
52 54
53#define THREAD_SIZE (2*PAGE_SIZE)
54
55/* how to get the thread information struct from C */ 55/* how to get the thread information struct from C */
56static inline struct thread_info *current_thread_info(void) 56static inline struct thread_info *current_thread_info(void)
57{ 57{
@@ -73,8 +73,12 @@ static inline struct thread_info *current_thread_info(void)
73} 73}
74 74
75/* thread information allocation */ 75/* thread information allocation */
76#define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) 76#ifdef CONFIG_DEBUG_STACK_USAGE
77#define free_thread_info(ti) free_pages((unsigned long) (ti), 1) 77#define alloc_thread_info(ti) kzalloc(THREAD_SIZE, GFP_KERNEL)
78#else
79#define alloc_thread_info(ti) kmalloc(THREAD_SIZE, GFP_KERNEL)
80#endif
81#define free_thread_info(ti) kfree(ti)
78 82
79#else /* !__ASSEMBLY__ */ 83#else /* !__ASSEMBLY__ */
80 84