Skip to content

Commit f737561

Browse files
committed
ARC: stack unwinding: reorganize how initial register state setup
This is a non-functional change, if anything a better fall-back handling. Signed-off-by: Vineet Gupta <[email protected]>
1 parent e42404f commit f737561

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

arch/arc/kernel/stacktrace.c

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,23 @@ static int
4242
seed_unwind_frame_info(struct task_struct *tsk, struct pt_regs *regs,
4343
struct unwind_frame_info *frame_info)
4444
{
45-
/*
46-
* synchronous unwinding (e.g. dump_stack)
47-
* - uses current values of SP and friends
48-
*/
49-
if (regs == NULL && (tsk == NULL || tsk == current)) {
45+
if (regs) {
46+
/*
47+
* Asynchronous unwinding of intr/exception
48+
* - Just uses the pt_regs passed
49+
*/
50+
frame_info->task = tsk;
51+
52+
frame_info->regs.r27 = regs->fp;
53+
frame_info->regs.r28 = regs->sp;
54+
frame_info->regs.r31 = regs->blink;
55+
frame_info->regs.r63 = regs->ret;
56+
frame_info->call_frame = 0;
57+
} else if (tsk == NULL || tsk == current) {
58+
/*
59+
* synchronous unwinding (e.g. dump_stack)
60+
* - uses current values of SP and friends
61+
*/
5062
unsigned long fp, sp, blink, ret;
5163
frame_info->task = current;
5264

@@ -63,7 +75,7 @@ seed_unwind_frame_info(struct task_struct *tsk, struct pt_regs *regs,
6375
frame_info->regs.r31 = blink;
6476
frame_info->regs.r63 = ret;
6577
frame_info->call_frame = 0;
66-
} else if (regs == NULL) {
78+
} else {
6779
/*
6880
* Asynchronous unwinding of a likely sleeping task
6981
* - first ensure it is actually sleeping
@@ -94,20 +106,7 @@ seed_unwind_frame_info(struct task_struct *tsk, struct pt_regs *regs,
94106
frame_info->regs.r28 += 60;
95107
frame_info->call_frame = 0;
96108

97-
} else {
98-
/*
99-
* Asynchronous unwinding of intr/exception
100-
* - Just uses the pt_regs passed
101-
*/
102-
frame_info->task = tsk;
103-
104-
frame_info->regs.r27 = regs->fp;
105-
frame_info->regs.r28 = regs->sp;
106-
frame_info->regs.r31 = regs->blink;
107-
frame_info->regs.r63 = regs->ret;
108-
frame_info->call_frame = 0;
109109
}
110-
111110
return 0;
112111
}
113112

0 commit comments

Comments
 (0)