X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fppc64%2Fkernel%2Fprocess.c;h=d1c152db959b9f2a232d2661eb8e37a401fa607f;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=8211337074cb5200755c82868a35ff81a876507a;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/arch/ppc64/kernel/process.c b/arch/ppc64/kernel/process.c index 821133707..d1c152db9 100644 --- a/arch/ppc64/kernel/process.c +++ b/arch/ppc64/kernel/process.c @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include @@ -214,23 +214,57 @@ struct task_struct *__switch_to(struct task_struct *prev, return last; } +static int instructions_to_print = 16; + +static void show_instructions(struct pt_regs *regs) +{ + int i; + unsigned long pc = regs->nip - (instructions_to_print * 3 / 4 * + sizeof(int)); + + printk("Instruction dump:"); + + for (i = 0; i < instructions_to_print; i++) { + int instr; + + if (!(i % 8)) + printk("\n"); + + if (((REGION_ID(pc) != KERNEL_REGION_ID) && + (REGION_ID(pc) != VMALLOC_REGION_ID)) || + __get_user(instr, (unsigned int *)pc)) { + printk("XXXXXXXX "); + } else { + if (regs->nip == pc) + printk("<%08x> ", instr); + else + printk("%08x ", instr); + } + + pc += sizeof(int); + } + + printk("\n"); +} + void show_regs(struct pt_regs * regs) { int i; unsigned long trap; - printk("NIP: %016lX XER: %016lX LR: %016lX\n", - regs->nip, regs->xer, regs->link); + printk("NIP: %016lX XER: %08X LR: %016lX CTR: %016lX\n", + regs->nip, (unsigned int)regs->xer, regs->link, regs->ctr); printk("REGS: %p TRAP: %04lx %s (%s)\n", - regs, regs->trap, print_tainted(), UTS_RELEASE); - printk("MSR: %016lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n", + regs, regs->trap, print_tainted(), system_utsname.release); + printk("MSR: %016lx EE: %01x PR: %01x FP: %01x ME: %01x " + "IR/DR: %01x%01x CR: %08X\n", regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0, regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0, regs->msr&MSR_IR ? 1 : 0, - regs->msr&MSR_DR ? 1 : 0); + regs->msr&MSR_DR ? 1 : 0, + (unsigned int)regs->ccr); trap = TRAP(regs); - if (trap == 0x300 || trap == 0x380 || trap == 0x600) - printk("DAR: %016lx, DSISR: %016lx\n", regs->dar, regs->dsisr); + printk("DAR: %016lx DSISR: %016lx\n", regs->dar, regs->dsisr); printk("TASK: %p[%d] '%s' THREAD: %p", current, current->pid, current->comm, current->thread_info); @@ -257,6 +291,8 @@ void show_regs(struct pt_regs * regs) printk("LR [%016lx] ", regs->link); print_symbol("%s\n", regs->link); show_stack(current, (unsigned long *)regs->gpr[1]); + if (!user_mode(regs)) + show_instructions(regs); } void exit_thread(void) @@ -315,8 +351,6 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp, extern void ret_from_fork(void); unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE; - p->set_child_tid = p->clear_child_tid = NULL; - /* Copy registers */ sp -= sizeof(struct pt_regs); childregs = (struct pt_regs *) sp; @@ -512,8 +546,11 @@ int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, error = do_execve(filename, (char __user * __user *) a1, (char __user * __user *) a2, regs); - if (error == 0) + if (error == 0) { + task_lock(current); current->ptrace &= ~PT_DTRACE; + task_unlock(current); + } putname(filename); out: