diff options
Diffstat (limited to 'arch/powerpc/kernel/kprobes.c')
| -rw-r--r-- | arch/powerpc/kernel/kprobes.c | 38 | 
1 files changed, 11 insertions, 27 deletions
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index bc47352deb1..2f72af82513 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c @@ -32,16 +32,10 @@  #include <linux/module.h>  #include <linux/kdebug.h>  #include <linux/slab.h> +#include <asm/code-patching.h>  #include <asm/cacheflush.h>  #include <asm/sstep.h>  #include <asm/uaccess.h> -#include <asm/system.h> - -#ifdef CONFIG_PPC_ADV_DEBUG_REGS -#define MSR_SINGLESTEP	(MSR_DE) -#else -#define MSR_SINGLESTEP	(MSR_SE) -#endif  DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;  DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); @@ -105,19 +99,7 @@ void __kprobes arch_remove_kprobe(struct kprobe *p)  static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)  { -	/* We turn off async exceptions to ensure that the single step will -	 * be for the instruction we have the kprobe on, if we dont its -	 * possible we'd get the single step reported for an exception handler -	 * like Decrementer or External Interrupt */ -	regs->msr &= ~MSR_EE; -	regs->msr |= MSR_SINGLESTEP; -#ifdef CONFIG_PPC_ADV_DEBUG_REGS -	regs->msr &= ~MSR_CE; -	mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM); -#ifdef CONFIG_PPC_47x -	isync(); -#endif -#endif +	enable_single_step(regs);  	/*  	 * On powerpc we should single step on the original @@ -311,7 +293,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,  {  	struct kretprobe_instance *ri = NULL;  	struct hlist_head *head, empty_rp; -	struct hlist_node *node, *tmp; +	struct hlist_node *tmp;  	unsigned long flags, orig_ret_address = 0;  	unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline; @@ -331,7 +313,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,  	 *       real return address, and all the rest will point to  	 *       kretprobe_trampoline  	 */ -	hlist_for_each_entry_safe(ri, node, tmp, head, hlist) { +	hlist_for_each_entry_safe(ri, tmp, head, hlist) {  		if (ri->task != current)  			/* another task is sharing our hash bucket */  			continue; @@ -358,7 +340,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,  	kretprobe_hash_unlock(current, &flags);  	preempt_enable_no_resched(); -	hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) { +	hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {  		hlist_del(&ri->hlist);  		kfree(ri);  	} @@ -448,7 +430,7 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr)  	case KPROBE_HIT_SSDONE:  		/*  		 * We increment the nmissed count for accounting, -		 * we can also use npre/npostfault count for accouting +		 * we can also use npre/npostfault count for accounting  		 * these specific fault cases.  		 */  		kprobes_inc_nmissed_count(cur); @@ -510,12 +492,10 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,  	return ret;  } -#ifdef CONFIG_PPC64  unsigned long arch_deref_entry_point(void *entry)  { -	return ((func_descr_t *)entry)->entry; +	return ppc_global_function_entry(entry);  } -#endif  int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)  { @@ -527,8 +507,12 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)  	/* setup return addr to the jprobe handler routine */  	regs->nip = arch_deref_entry_point(jp->entry);  #ifdef CONFIG_PPC64 +#if defined(_CALL_ELF) && _CALL_ELF == 2 +	regs->gpr[12] = (unsigned long)jp->entry; +#else  	regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc);  #endif +#endif  	return 1;  }  | 
