spi: efm32: Convert to use GPIO descriptors
[linux/fpc-iii.git] / arch / csky / kernel / dumpstack.c
blobd67f9777cfd9d7a10ca0b439937fd9784f88f8e6
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
4 #include <linux/ptrace.h>
6 int kstack_depth_to_print = 48;
8 void show_trace(unsigned long *stack)
10 unsigned long *stack_end;
11 unsigned long *stack_start;
12 unsigned long *fp;
13 unsigned long addr;
15 addr = (unsigned long) stack & THREAD_MASK;
16 stack_start = (unsigned long *) addr;
17 stack_end = (unsigned long *) (addr + THREAD_SIZE);
19 fp = stack;
20 pr_info("\nCall Trace:");
22 while (fp > stack_start && fp < stack_end) {
23 #ifdef CONFIG_STACKTRACE
24 addr = fp[1];
25 fp = (unsigned long *) fp[0];
26 #else
27 addr = *fp++;
28 #endif
29 if (__kernel_text_address(addr))
30 pr_cont("\n[<%08lx>] %pS", addr, (void *)addr);
32 pr_cont("\n");
35 void show_stack(struct task_struct *task, unsigned long *stack)
37 if (!stack) {
38 if (task)
39 stack = (unsigned long *)thread_saved_fp(task);
40 else
41 #ifdef CONFIG_STACKTRACE
42 asm volatile("mov %0, r8\n":"=r"(stack)::"memory");
43 #else
44 stack = (unsigned long *)&stack;
45 #endif
48 show_trace(stack);