Skip to content

Commit 94ea09c

Browse files
Daniel KalmarRobert Richter
authored andcommitted
MIPS: Add new unwind_stack variant
The unwind_stack_by_address variant supports unwinding based on any kernel code address. This symbol is also exported so it can be called from modules. Signed-off-by: Daniel Kalmar <kalmard@homejinni.com> Signed-off-by: Gergely Kis <gergely@homejinni.com> Signed-off-by: Robert Richter <robert.richter@amd.com>
1 parent 2c53b43 commit 94ea09c

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

‎arch/mips/include/asm/stacktrace.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
extern int raw_show_trace;
88
extern unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
99
unsigned long pc, unsigned long *ra);
10+
extern unsigned long unwind_stack_by_address(unsigned long stack_page,
11+
unsigned long *sp,
12+
unsigned long pc,
13+
unsigned long *ra);
1014
#else
1115
#define raw_show_trace 1
1216
static inline unsigned long unwind_stack(struct task_struct *task,

‎arch/mips/kernel/process.c‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,18 +373,18 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
373373

374374

375375
#ifdef CONFIG_KALLSYMS
376-
/* used by show_backtrace() */
377-
unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
378-
unsigned long pc, unsigned long *ra)
376+
/* generic stack unwinding function */
377+
unsigned long notrace unwind_stack_by_address(unsigned long stack_page,
378+
unsigned long *sp,
379+
unsigned long pc,
380+
unsigned long *ra)
379381
{
380-
unsigned long stack_page;
381382
struct mips_frame_info info;
382383
unsigned long size, ofs;
383384
int leaf;
384385
extern void ret_from_irq(void);
385386
extern void ret_from_exception(void);
386387

387-
stack_page = (unsigned long)task_stack_page(task);
388388
if (!stack_page)
389389
return 0;
390390

@@ -443,6 +443,15 @@ unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
443443
*ra = 0;
444444
return __kernel_text_address(pc) ? pc : 0;
445445
}
446+
EXPORT_SYMBOL(unwind_stack_by_address);
447+
448+
/* used by show_backtrace() */
449+
unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
450+
unsigned long pc, unsigned long *ra)
451+
{
452+
unsigned long stack_page = (unsigned long)task_stack_page(task);
453+
return unwind_stack_by_address(stack_page, sp, pc, ra);
454+
}
446455
#endif
447456

448457
/*

0 commit comments

Comments
 (0)