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
;
15 addr
= (unsigned long) stack
& THREAD_MASK
;
16 stack_start
= (unsigned long *) addr
;
17 stack_end
= (unsigned long *) (addr
+ THREAD_SIZE
);
20 pr_info("\nCall Trace:");
22 while (fp
> stack_start
&& fp
< stack_end
) {
23 #ifdef CONFIG_STACKTRACE
25 fp
= (unsigned long *) fp
[0];
29 if (__kernel_text_address(addr
))
30 pr_cont("\n[<%08lx>] %pS", addr
, (void *)addr
);
35 void show_stack(struct task_struct
*task
, unsigned long *stack
)
39 stack
= (unsigned long *)thread_saved_fp(task
);
41 #ifdef CONFIG_STACKTRACE
42 asm volatile("mov %0, r8\n":"=r"(stack
)::"memory");
44 stack
= (unsigned long *)&stack
;