aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/probes.h
diff options
context:
space:
mode:
authorSuzuki K. Poulose <suzuki@in.ibm.com>2012-12-03 10:08:37 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-06-20 02:55:09 -0400
commit35fd219a268cc82cef842518cd64ea6949629ba2 (patch)
tree2226a6d0fe4a0d36d679905c5680f5ca27db0bab /arch/powerpc/include/asm/probes.h
parent85f395c5b0a26b3a80f9e2d35333981a2a75c0ae (diff)
powerpc: Move the single step enable code to a generic path
This patch moves the single step enable code used by kprobe to a generic routine header so that, it can be re-used by other code, in this case, uprobes. No functional changes. Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com> Cc: Ananth N Mavinakaynahalli <ananth@in.ibm.com> Cc: Kumar Gala <galak@kernel.crashing.org> Cc: linuxppc-dev@ozlabs.org Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include/asm/probes.h')
-rw-r--r--arch/powerpc/include/asm/probes.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/probes.h b/arch/powerpc/include/asm/probes.h
index 5f1e15b68704..3421637cfd7b 100644
--- a/arch/powerpc/include/asm/probes.h
+++ b/arch/powerpc/include/asm/probes.h
@@ -38,5 +38,30 @@ typedef u32 ppc_opcode_t;
38#define is_trap(instr) (IS_TW(instr) || IS_TWI(instr)) 38#define is_trap(instr) (IS_TW(instr) || IS_TWI(instr))
39#endif /* CONFIG_PPC64 */ 39#endif /* CONFIG_PPC64 */
40 40
41#ifdef CONFIG_PPC_ADV_DEBUG_REGS
42#define MSR_SINGLESTEP (MSR_DE)
43#else
44#define MSR_SINGLESTEP (MSR_SE)
45#endif
46
47/* Enable single stepping for the current task */
48static inline void enable_single_step(struct pt_regs *regs)
49{
50 regs->msr |= MSR_SINGLESTEP;
51#ifdef CONFIG_PPC_ADV_DEBUG_REGS
52 /*
53 * We turn off Critical Input Exception(CE) to ensure that the single
54 * step will be for the instruction we have the probe on; if we don't,
55 * it is possible we'd get the single step reported for CE.
56 */
57 regs->msr &= ~MSR_CE;
58 mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
59#ifdef CONFIG_PPC_47x
60 isync();
61#endif
62#endif
63}
64
65
41#endif /* __KERNEL__ */ 66#endif /* __KERNEL__ */
42#endif /* _ASM_POWERPC_PROBES_H */ 67#endif /* _ASM_POWERPC_PROBES_H */