aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/ptrace.c
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2013-03-16 04:48:13 -0400
committerCatalin Marinas <catalin.marinas@arm.com>2013-06-12 06:23:02 -0400
commit1442b6ed249d2b3d2cfcf45b65ac64393495c96c (patch)
tree440be3115d6d3ac4aa766c295d9b15c8160da38f /arch/arm64/kernel/ptrace.c
parentadace89562c7a9645b8dc84f6e1ac7ba8756094e (diff)
arm64: debug: consolidate software breakpoint handlers
The software breakpoint handlers are hooked in directly from ptrace, which makes it difficult to add additional handlers for things like kprobes and kgdb. This patch moves the handling code into debug-monitors.c, where we can dispatch to different debug subsystems more easily. Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kernel/ptrace.c')
-rw-r--r--arch/arm64/kernel/ptrace.c59
1 files changed, 0 insertions, 59 deletions
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 6e1e77f1831c..fecdbf7de82e 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -53,28 +53,6 @@ void ptrace_disable(struct task_struct *child)
53{ 53{
54} 54}
55 55
56/*
57 * Handle hitting a breakpoint.
58 */
59static int ptrace_break(struct pt_regs *regs)
60{
61 siginfo_t info = {
62 .si_signo = SIGTRAP,
63 .si_errno = 0,
64 .si_code = TRAP_BRKPT,
65 .si_addr = (void __user *)instruction_pointer(regs),
66 };
67
68 force_sig_info(SIGTRAP, &info, current);
69 return 0;
70}
71
72static int arm64_break_trap(unsigned long addr, unsigned int esr,
73 struct pt_regs *regs)
74{
75 return ptrace_break(regs);
76}
77
78#ifdef CONFIG_HAVE_HW_BREAKPOINT 56#ifdef CONFIG_HAVE_HW_BREAKPOINT
79/* 57/*
80 * Handle hitting a HW-breakpoint. 58 * Handle hitting a HW-breakpoint.
@@ -817,33 +795,6 @@ static const struct user_regset_view user_aarch32_view = {
817 .regsets = aarch32_regsets, .n = ARRAY_SIZE(aarch32_regsets) 795 .regsets = aarch32_regsets, .n = ARRAY_SIZE(aarch32_regsets)
818}; 796};
819 797
820int aarch32_break_trap(struct pt_regs *regs)
821{
822 unsigned int instr;
823 bool bp = false;
824 void __user *pc = (void __user *)instruction_pointer(regs);
825
826 if (compat_thumb_mode(regs)) {
827 /* get 16-bit Thumb instruction */
828 get_user(instr, (u16 __user *)pc);
829 if (instr == AARCH32_BREAK_THUMB2_LO) {
830 /* get second half of 32-bit Thumb-2 instruction */
831 get_user(instr, (u16 __user *)(pc + 2));
832 bp = instr == AARCH32_BREAK_THUMB2_HI;
833 } else {
834 bp = instr == AARCH32_BREAK_THUMB;
835 }
836 } else {
837 /* 32-bit ARM instruction */
838 get_user(instr, (u32 __user *)pc);
839 bp = (instr & ~0xf0000000) == AARCH32_BREAK_ARM;
840 }
841
842 if (bp)
843 return ptrace_break(regs);
844 return 1;
845}
846
847static int compat_ptrace_read_user(struct task_struct *tsk, compat_ulong_t off, 798static int compat_ptrace_read_user(struct task_struct *tsk, compat_ulong_t off,
848 compat_ulong_t __user *ret) 799 compat_ulong_t __user *ret)
849{ 800{
@@ -1111,16 +1062,6 @@ long arch_ptrace(struct task_struct *child, long request,
1111 return ptrace_request(child, request, addr, data); 1062 return ptrace_request(child, request, addr, data);
1112} 1063}
1113 1064
1114
1115static int __init ptrace_break_init(void)
1116{
1117 hook_debug_fault_code(DBG_ESR_EVT_BRK, arm64_break_trap, SIGTRAP,
1118 TRAP_BRKPT, "ptrace BRK handler");
1119 return 0;
1120}
1121core_initcall(ptrace_break_init);
1122
1123
1124asmlinkage int syscall_trace(int dir, struct pt_regs *regs) 1065asmlinkage int syscall_trace(int dir, struct pt_regs *regs)
1125{ 1066{
1126 unsigned long saved_reg; 1067 unsigned long saved_reg;