[NETLINK]: w1_int.c: fix default netlink group
[linux-2.6/verdex.git] / arch / um / sys-i386 / sysrq.c
blobe3706d15c4f51bfefe364ee37c45c5fe99375c12
1 /*
2 * Copyright (C) 2001 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
6 #include "linux/config.h"
7 #include "linux/kernel.h"
8 #include "linux/smp.h"
9 #include "linux/sched.h"
10 #include "linux/kallsyms.h"
11 #include "asm/ptrace.h"
12 #include "sysrq.h"
14 /* This is declared by <linux/sched.h> */
15 void show_regs(struct pt_regs *regs)
17 printk("\n");
18 printk("EIP: %04lx:[<%08lx>] CPU: %d %s",
19 0xffff & PT_REGS_CS(regs), PT_REGS_IP(regs),
20 smp_processor_id(), print_tainted());
21 if (PT_REGS_CS(regs) & 3)
22 printk(" ESP: %04lx:%08lx", 0xffff & PT_REGS_SS(regs),
23 PT_REGS_SP(regs));
24 printk(" EFLAGS: %08lx\n %s\n", PT_REGS_EFLAGS(regs),
25 print_tainted());
26 printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
27 PT_REGS_EAX(regs), PT_REGS_EBX(regs),
28 PT_REGS_ECX(regs),
29 PT_REGS_EDX(regs));
30 printk("ESI: %08lx EDI: %08lx EBP: %08lx",
31 PT_REGS_ESI(regs), PT_REGS_EDI(regs),
32 PT_REGS_EBP(regs));
33 printk(" DS: %04lx ES: %04lx\n",
34 0xffff & PT_REGS_DS(regs),
35 0xffff & PT_REGS_ES(regs));
37 show_trace(NULL, (unsigned long *) &regs);
40 /* Copied from i386. */
41 static inline int valid_stack_ptr(struct thread_info *tinfo, void *p)
43 return p > (void *)tinfo &&
44 p < (void *)tinfo + THREAD_SIZE - 3;
47 /* Adapted from i386 (we also print the address we read from). */
48 static inline unsigned long print_context_stack(struct thread_info *tinfo,
49 unsigned long *stack, unsigned long ebp)
51 unsigned long addr;
53 #ifdef CONFIG_FRAME_POINTER
54 while (valid_stack_ptr(tinfo, (void *)ebp)) {
55 addr = *(unsigned long *)(ebp + 4);
56 printk("%08lx: [<%08lx>]", ebp + 4, addr);
57 print_symbol(" %s", addr);
58 printk("\n");
59 ebp = *(unsigned long *)ebp;
61 #else
62 while (valid_stack_ptr(tinfo, stack)) {
63 addr = *stack;
64 if (__kernel_text_address(addr)) {
65 printk("%08lx: [<%08lx>]", (unsigned long) stack, addr);
66 print_symbol(" %s", addr);
67 printk("\n");
69 stack++;
71 #endif
72 return ebp;
75 void show_trace(struct task_struct* task, unsigned long * stack)
77 unsigned long ebp;
78 struct thread_info *context;
80 /* Turn this into BUG_ON if possible. */
81 if (!stack) {
82 stack = (unsigned long*) &stack;
83 printk("show_trace: got NULL stack, implicit assumption task == current");
84 WARN_ON(1);
87 if (!task)
88 task = current;
90 if (task != current) {
91 //ebp = (unsigned long) KSTK_EBP(task);
92 /* Which one? No actual difference - just coding style.*/
93 ebp = (unsigned long) PT_REGS_EBP(&task->thread.regs);
94 } else {
95 asm ("movl %%ebp, %0" : "=r" (ebp) : );
98 context = (struct thread_info *)
99 ((unsigned long)stack & (~(THREAD_SIZE - 1)));
100 print_context_stack(context, stack, ebp);
102 /*while (((long) stack & (THREAD_SIZE-1)) != 0) {
103 addr = *stack;
104 if (__kernel_text_address(addr)) {
105 printk("%08lx: [<%08lx>]", (unsigned long) stack, addr);
106 print_symbol(" %s", addr);
107 printk("\n");
109 stack++;
111 printk("\n");