aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-04-13 01:16:22 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-13 01:16:22 -0400
commitcb256aa60409efd803806cfb0528a4b3f8397dba (patch)
treeedb33d59e189c0715100251863357801342c76ec /arch
parentbdd32ce95f79fb5cc964cd789d7ae4500bba7c6f (diff)
sparc64: Use kstack_valid() in die_if_kernel().
This gets rid of a local function (is_kernel_stack()) which tries to do the same thing, yet poorly in that it doesn't handle IRQ stacks properly. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc/kernel/traps_64.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
index bdc05a21908b..2ff178c469e9 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -2202,27 +2202,6 @@ void dump_stack(void)
2202 2202
2203EXPORT_SYMBOL(dump_stack); 2203EXPORT_SYMBOL(dump_stack);
2204 2204
2205static inline int is_kernel_stack(struct task_struct *task,
2206 struct reg_window *rw)
2207{
2208 unsigned long rw_addr = (unsigned long) rw;
2209 unsigned long thread_base, thread_end;
2210
2211 if (rw_addr < PAGE_OFFSET) {
2212 if (task != &init_task)
2213 return 0;
2214 }
2215
2216 thread_base = (unsigned long) task_stack_page(task);
2217 thread_end = thread_base + sizeof(union thread_union);
2218 if (rw_addr >= thread_base &&
2219 rw_addr < thread_end &&
2220 !(rw_addr & 0x7UL))
2221 return 1;
2222
2223 return 0;
2224}
2225
2226static inline struct reg_window *kernel_stack_up(struct reg_window *rw) 2205static inline struct reg_window *kernel_stack_up(struct reg_window *rw)
2227{ 2206{
2228 unsigned long fp = rw->ins[6]; 2207 unsigned long fp = rw->ins[6];
@@ -2251,6 +2230,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
2251 show_regs(regs); 2230 show_regs(regs);
2252 add_taint(TAINT_DIE); 2231 add_taint(TAINT_DIE);
2253 if (regs->tstate & TSTATE_PRIV) { 2232 if (regs->tstate & TSTATE_PRIV) {
2233 struct thread_info *tp = current_thread_info();
2254 struct reg_window *rw = (struct reg_window *) 2234 struct reg_window *rw = (struct reg_window *)
2255 (regs->u_regs[UREG_FP] + STACK_BIAS); 2235 (regs->u_regs[UREG_FP] + STACK_BIAS);
2256 2236
@@ -2258,8 +2238,8 @@ void die_if_kernel(char *str, struct pt_regs *regs)
2258 * find some badly aligned kernel stack. 2238 * find some badly aligned kernel stack.
2259 */ 2239 */
2260 while (rw && 2240 while (rw &&
2261 count++ < 30&& 2241 count++ < 30 &&
2262 is_kernel_stack(current, rw)) { 2242 kstack_valid(tp, (unsigned long) rw)) {
2263 printk("Caller[%016lx]: %pS\n", rw->ins[7], 2243 printk("Caller[%016lx]: %pS\n", rw->ins[7],
2264 (void *) rw->ins[7]); 2244 (void *) rw->ins[7]);
2265 2245