Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94ea09c6 authored by Daniel Kalmar's avatar Daniel Kalmar Committed by Robert Richter
Browse files

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: default avatarDaniel Kalmar <kalmard@homejinni.com>
Signed-off-by: default avatarGergely Kis <gergely@homejinni.com>
Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
parent 2c53b436
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -7,6 +7,10 @@
extern int raw_show_trace;
extern int raw_show_trace;
extern unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
extern unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
				  unsigned long pc, unsigned long *ra);
				  unsigned long pc, unsigned long *ra);
extern unsigned long unwind_stack_by_address(unsigned long stack_page,
					     unsigned long *sp,
					     unsigned long pc,
					     unsigned long *ra);
#else
#else
#define raw_show_trace 1
#define raw_show_trace 1
static inline unsigned long unwind_stack(struct task_struct *task,
static inline unsigned long unwind_stack(struct task_struct *task,
+14 −5
Original line number Original line Diff line number Diff line
@@ -373,18 +373,18 @@ unsigned long thread_saved_pc(struct task_struct *tsk)




#ifdef CONFIG_KALLSYMS
#ifdef CONFIG_KALLSYMS
/* used by show_backtrace() */
/* generic stack unwinding function */
unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
unsigned long notrace unwind_stack_by_address(unsigned long stack_page,
			   unsigned long pc, unsigned long *ra)
					      unsigned long *sp,
					      unsigned long pc,
					      unsigned long *ra)
{
{
	unsigned long stack_page;
	struct mips_frame_info info;
	struct mips_frame_info info;
	unsigned long size, ofs;
	unsigned long size, ofs;
	int leaf;
	int leaf;
	extern void ret_from_irq(void);
	extern void ret_from_irq(void);
	extern void ret_from_exception(void);
	extern void ret_from_exception(void);


	stack_page = (unsigned long)task_stack_page(task);
	if (!stack_page)
	if (!stack_page)
		return 0;
		return 0;


@@ -443,6 +443,15 @@ unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
	*ra = 0;
	*ra = 0;
	return __kernel_text_address(pc) ? pc : 0;
	return __kernel_text_address(pc) ? pc : 0;
}
}
EXPORT_SYMBOL(unwind_stack_by_address);

/* used by show_backtrace() */
unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
			   unsigned long pc, unsigned long *ra)
{
	unsigned long stack_page = (unsigned long)task_stack_page(task);
	return unwind_stack_by_address(stack_page, sp, pc, ra);
}
#endif
#endif


/*
/*