diff options
author | Yoshinori Sato <ysato@users.sourceforge.jp> | 2016-01-15 03:07:32 -0500 |
---|---|---|
committer | Yoshinori Sato <ysato@users.sourceforge.jp> | 2016-01-20 09:28:00 -0500 |
commit | bf24eec39a6b0df1fcc1ff92db39fe2f2a60f737 (patch) | |
tree | 58d236445d7af899cb01adcd17625c407fa6154f | |
parent | db903b462b3e7a0cbd4bace485d0d4ba27344ec7 (diff) |
h8300: show_stack cleanup
- fix stack limit. h8300's stack not aligned 4byte.
- pritty output form.
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
-rw-r--r-- | arch/h8300/include/asm/traps.h | 2 | ||||
-rw-r--r-- | arch/h8300/kernel/traps.c | 20 |
2 files changed, 9 insertions, 13 deletions
diff --git a/arch/h8300/include/asm/traps.h b/arch/h8300/include/asm/traps.h index aa34e75fd767..15e701130b27 100644 --- a/arch/h8300/include/asm/traps.h +++ b/arch/h8300/include/asm/traps.h | |||
@@ -36,6 +36,6 @@ extern unsigned long *_interrupt_redirect_table; | |||
36 | extern char _start, _etext; | 36 | extern char _start, _etext; |
37 | #define check_kernel_text(addr) \ | 37 | #define check_kernel_text(addr) \ |
38 | ((addr >= (unsigned long)(&_start)) && \ | 38 | ((addr >= (unsigned long)(&_start)) && \ |
39 | (addr < (unsigned long)(&_etext))) | 39 | (addr < (unsigned long)(&_etext)) && !(addr & 1)) |
40 | 40 | ||
41 | #endif /* _H8300_TRAPS_H */ | 41 | #endif /* _H8300_TRAPS_H */ |
diff --git a/arch/h8300/kernel/traps.c b/arch/h8300/kernel/traps.c index 1b2d7cdd6591..044a36125846 100644 --- a/arch/h8300/kernel/traps.c +++ b/arch/h8300/kernel/traps.c | |||
@@ -125,17 +125,18 @@ void show_stack(struct task_struct *task, unsigned long *esp) | |||
125 | 125 | ||
126 | pr_info("Stack from %08lx:", (unsigned long)stack); | 126 | pr_info("Stack from %08lx:", (unsigned long)stack); |
127 | for (i = 0; i < kstack_depth_to_print; i++) { | 127 | for (i = 0; i < kstack_depth_to_print; i++) { |
128 | if (((unsigned long)stack & (THREAD_SIZE - 1)) == 0) | 128 | if (((unsigned long)stack & (THREAD_SIZE - 1)) >= |
129 | THREAD_SIZE-4) | ||
129 | break; | 130 | break; |
130 | if (i % 8 == 0) | 131 | if (i % 8 == 0) |
131 | pr_info("\n "); | 132 | pr_info(" "); |
132 | pr_info(" %08lx", *stack++); | 133 | pr_cont(" %08lx", *stack++); |
133 | } | 134 | } |
134 | 135 | ||
135 | pr_info("\nCall Trace:"); | 136 | pr_info("\nCall Trace:\n"); |
136 | i = 0; | 137 | i = 0; |
137 | stack = esp; | 138 | stack = esp; |
138 | while (((unsigned long)stack & (THREAD_SIZE - 1)) != 0) { | 139 | while (((unsigned long)stack & (THREAD_SIZE - 1)) < THREAD_SIZE-4) { |
139 | addr = *stack++; | 140 | addr = *stack++; |
140 | /* | 141 | /* |
141 | * If the address is either in the text segment of the | 142 | * If the address is either in the text segment of the |
@@ -147,15 +148,10 @@ void show_stack(struct task_struct *task, unsigned long *esp) | |||
147 | */ | 148 | */ |
148 | if (check_kernel_text(addr)) { | 149 | if (check_kernel_text(addr)) { |
149 | if (i % 4 == 0) | 150 | if (i % 4 == 0) |
150 | pr_info("\n "); | 151 | pr_info(" "); |
151 | pr_info(" [<%08lx>]", addr); | 152 | pr_cont(" [<%08lx>]", addr); |
152 | i++; | 153 | i++; |
153 | } | 154 | } |
154 | } | 155 | } |
155 | pr_info("\n"); | 156 | pr_info("\n"); |
156 | } | 157 | } |
157 | |||
158 | void show_trace_task(struct task_struct *tsk) | ||
159 | { | ||
160 | show_stack(tsk, (unsigned long *)tsk->thread.esp0); | ||
161 | } | ||