uml: stack dump fix
PATCH 6/6 uml: stack dump fix
Copy (and adapt) to UML the stack code dumper used in i386 when CONFIG_FRAME_POINTER is enabled.
Signed-off-by Paolo 'Blaisorblade' Giarrusso <[email protected]>
---
linux-2.6.12-paolo/arch/um/include/sysrq.h | 3 linux-2.6.12-paolo/arch/um/kernel/sysrq.c | 21 ++++-- linux-2.6.12-paolo/arch/um/sys-i386/sysrq.c | 80 +++++++++++++++++++++++- linux-2.6.12-paolo/arch/um/sys-ppc/sysrq.c | 14 ---- linux-2.6.12-paolo/arch/um/sys-x86_64/sysrq.c | 11 --- linux-2.6.12-paolo/include/asm-um/thread_info.h | 7 -- 6 files changed, 100 insertions(+), 36 deletions(-)
arch/um/kernel/sysrq.c renamed from arch/um/kernel/sysrq.c~uml-stack-dump-fix +14 -7
@@ -3,6 +3,7 @@* Licensed under the GPL */ +#include "linux/config.h" #include "linux/sched.h" #include "linux/kernel.h" #include "linux/module.h"
@@ -12,14 +13,14 @@#include "sysrq.h" #include "user_util.h" -void show_trace (unsigned long * stack) +/* Catch non-i386 SUBARCH's. */ +#if !defined(CONFIG_UML_X86 ) || defined(CONFIG_64BIT ) +void show_trace (struct task_struct *task,unsigned long * stack) { -/* XXX: Copy the CONFIG_FRAME_POINTER stack-walking backtrace from -* arch/i386/kernel/traps.c, and then move this to sys-i386/sysrq.c.*/ unsigned long addr;if (!stack) { - stack = (unsigned long *) &stack; + stack = (unsigned long *) &stack;WARN_ON (1 ); }
@@ -35,6 +36,7 @@ void show_trace(unsigned long * stack) }printk ("\n" ); } +#endif /* * stack dumps generator - this is used by arch-independent code.
@@ -44,7 +46,7 @@ void dump_stack(void) {unsigned long stack; -show_trace (&stack); +show_trace (current, &stack); }EXPORT_SYMBOL (dump_stack);
@@ -59,7 +61,11 @@ void show_stack(struct task_struct *taskint i;if (esp ==NULL ) { -if (task != current) { +if (task != current && task !=NULL ) { +/* XXX: Isn't this bogus? I.e. isn't this the +* *userspace* stack of this task? If not so, use this +* even when task == current (as in i386). +*/ esp = (unsigned long *)KSTK_ESP (task);/* Which one? No actual difference - just coding style.*/ //esp = (unsigned long *) PT_REGS_IP(&task->thread.regs);
@@ -77,5 +83,6 @@ void show_stack(struct task_struct *taskprintk ("%08lx " , *stack++); } -show_trace (esp); +printk ("Call Trace: \n" ); +show_trace (current, esp); }
arch/um/sys-i386/sysrq.c renamed from arch/um/sys-i386/sysrq.c~uml-stack-dump-fix +79 -1
96 lines not on this page · raw message
include/asm-um/thread_info.h renamed from include/asm-um/thread_info.h~uml-stack-dump-fix +3 -4
@@ -41,18 +41,17 @@ struct thread_info {#define init_thread_info (init_thread_union.thread_info)#define init_stack (init_thread_union.stack) +#define THREAD_SIZE ((1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE)/* how to get the thread information struct from C */ static inline struct thread_info *current_thread_info (void ) {struct thread_info *ti; -unsigned long mask =PAGE_SIZE * - (1 <<CONFIG_KERNEL_STACK_ORDER ) -1 ; - ti = (struct thread_info *) (((unsigned long ) &ti) & ~mask); +unsigned long mask =THREAD_SIZE -1 ; + ti = (struct thread_info *) (((unsigned long ) &ti) & ~mask);return ti; }/* thread information allocation */ -#define THREAD_SIZE ((1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE)#define alloc_thread_info (tsk) \ ((struct thread_info *) kmalloc(THREAD_SIZE, GFP_KERNEL))#define free_thread_info (ti) kfree(ti)
arch/um/sys-x86_64/sysrq.c renamed from arch/um/sys-x86_64/sysrq.c~uml-stack-dump-fix +1 -10
@@ -36,14 +36,5 @@ void __show_regs(struct pt_regs * regs)void show_regs (struct pt_regs *regs) {__show_regs (regs); -show_trace ((unsigned long *) ®s); +show_trace (current, (unsigned long *) ®s); } - -/* Emacs will notice this stuff at the end of the file and automatically -* adjust the settings for this buffer only. This must remain at the end -* of the file. -* --------------------------------------------------------------------------- -* Local variables: -* c-file-style: "linux" -* End: -*/
arch/um/include/sysrq.h renamed from arch/um/include/sysrq.h~uml-stack-dump-fix +2 -1
@@ -1,6 +1,7 @@#ifndef __UM_SYSRQ_H#define __UM_SYSRQ_H -extern void show_trace (unsigned long *stack); +struct task_struct ; +extern void show_trace (struct task_struct * task,unsigned long *stack);#endif
arch/um/sys-ppc/sysrq.c renamed from arch/um/sys-ppc/sysrq.c~uml-stack-dump-fix +1 -13
@@ -27,17 +27,5 @@ void show_regs(struct pt_regs_subarch *r 0xffff & regs->xds, 0xffff & regs->xes);#endif -show_trace (®s->gpr[1 ]); +show_trace (current, ®s->gpr[1 ]); } - - -/* -* Overrides for Emacs so that we follow Linus's tabbing style. -* Emacs will notice this stuff at the end of the file and automatically -* adjust the settings for this buffer only. This must remain at the end -* of the file. -* --------------------------------------------------------------------------- -* Local variables: -* c-file-style: "linux" -* End: -*/
_
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel