diff options
author | Jinyang He <hejinyang@loongson.cn> | 2023-01-17 11:42:16 +0800 |
---|---|---|
committer | Huacai Chen <chenhuacai@loongson.cn> | 2023-01-17 11:42:16 +0800 |
commit | 429a9671f235c94fc4b5d6687308714b74adc820 (patch) | |
tree | 73afffa5ddf59a0b8deaf997f6bbc6b6144c5e92 /arch/loongarch/kernel/unwind_guess.c | |
parent | e2f27392275c7ffceb4afac1567eb325722b9ae1 (diff) | |
download | linux-stable-429a9671f235c94fc4b5d6687308714b74adc820.tar.gz linux-stable-429a9671f235c94fc4b5d6687308714b74adc820.tar.bz2 linux-stable-429a9671f235c94fc4b5d6687308714b74adc820.zip |
LoongArch: Get frame info in unwind_start() when regs is not available
At unwind_start(), it is better to get its frame info here rather than
get them outside, even we don't have 'regs'. In this way we can simply
use unwind_{start, next_frame, done} outside.
Signed-off-by: Jinyang He <hejinyang@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/kernel/unwind_guess.c')
-rw-r--r-- | arch/loongarch/kernel/unwind_guess.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/loongarch/kernel/unwind_guess.c b/arch/loongarch/kernel/unwind_guess.c index e2d2e4f3001f..9ef5f2a47f88 100644 --- a/arch/loongarch/kernel/unwind_guess.c +++ b/arch/loongarch/kernel/unwind_guess.c @@ -26,6 +26,12 @@ void unwind_start(struct unwind_state *state, struct task_struct *task, if (regs) { state->sp = regs->regs[3]; state->pc = regs->csr_era; + } else if (task && task != current) { + state->sp = thread_saved_fp(task); + state->pc = thread_saved_ra(task); + } else { + state->sp = (unsigned long)__builtin_frame_address(0); + state->pc = (unsigned long)__builtin_return_address(0); } state->task = task; |