csky: Fixup calltrace panic
The implementation of show_stack will panic with wrong fp: addr = *fp++; because the fp isn't checked properly. The current implementations of show_stack, wchan and stack_trace haven't been designed properly, so just deprecate them. This patch is a reference to riscv's way, all codes are modified from arm's. The patch is passed with: - cat /proc/<pid>/stack - cat /proc/<pid>/wchan - echo c > /proc/sysrq-trigger Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
This commit is contained in:
@ -58,6 +58,16 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
|
||||
return regs->usp;
|
||||
}
|
||||
|
||||
static inline unsigned long frame_pointer(struct pt_regs *regs)
|
||||
{
|
||||
return regs->regs[4];
|
||||
}
|
||||
static inline void frame_pointer_set(struct pt_regs *regs,
|
||||
unsigned long val)
|
||||
{
|
||||
regs->regs[4] = val;
|
||||
}
|
||||
|
||||
extern int regs_query_register_offset(const char *name);
|
||||
extern unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
|
||||
unsigned int n);
|
||||
|
@ -40,6 +40,12 @@ struct thread_info {
|
||||
#define thread_saved_fp(tsk) \
|
||||
((unsigned long)(((struct switch_stack *)(tsk->thread.ksp))->r8))
|
||||
|
||||
#define thread_saved_sp(tsk) \
|
||||
((unsigned long)(tsk->thread.ksp))
|
||||
|
||||
#define thread_saved_lr(tsk) \
|
||||
((unsigned long)(((struct switch_stack *)(tsk->thread.ksp))->r15))
|
||||
|
||||
static inline struct thread_info *current_thread_info(void)
|
||||
{
|
||||
unsigned long sp;
|
||||
|
Reference in New Issue
Block a user