--- 25-akpm/arch/i386/kernel/traps.c | 23 ++++++++++++++--------- 1 files changed, 14 insertions(+), 9 deletions(-) diff -puN arch/i386/kernel/traps.c~frame-pointer-based-stack-dumps-tweaks arch/i386/kernel/traps.c --- 25/arch/i386/kernel/traps.c~frame-pointer-based-stack-dumps-tweaks Thu Apr 29 16:37:04 2004 +++ 25-akpm/arch/i386/kernel/traps.c Thu Apr 29 16:44:33 2004 @@ -94,26 +94,31 @@ asmlinkage void machine_check(void); static int kstack_depth_to_print = 24; -#define valid_stack_ptr(task, p) \ - ((struct thread_info*)p > task->thread_info) && \ - !kstack_end((unsigned long*)p) +static int valid_stack_ptr(struct task_struct *task, void *p) +{ + if (p <= (void *)task->thread_info) + return 0; + if (kstack_end(p)) + return 0; + return 1; +} #ifdef CONFIG_FRAME_POINTER -void print_context_stack(struct task_struct *task, unsigned long * stack, +void print_context_stack(struct task_struct *task, unsigned long *stack, unsigned long ebp) { unsigned long addr; - while (valid_stack_ptr(task, ebp)) { - addr = *(unsigned long *) (ebp + 4); + while (valid_stack_ptr(task, (void *)ebp)) { + addr = *(unsigned long *)(ebp + 4); printk(" [<%08lx>] ", addr); print_symbol("%s", addr); printk("\n"); - ebp = *(unsigned long *) ebp; + ebp = *(unsigned long *)ebp; } } #else -void print_context_stack(struct task_struct *task, unsigned long * stack, +void print_context_stack(struct task_struct *task, unsigned long *stack, unsigned long ebp) { unsigned long addr; @@ -150,7 +155,7 @@ void show_trace(struct task_struct *task while (1) { struct thread_info *context; - context = (struct thread_info*) + context = (struct thread_info *) ((unsigned long)stack & (~(THREAD_SIZE - 1))); print_context_stack(task, stack, ebp); stack = (unsigned long*)context->previous_esp; _