diff options
author | Will Deacon <will.deacon@arm.com> | 2010-09-03 05:42:55 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-09-08 05:05:00 -0400 |
commit | 864232fa1a2f8dfe003438ef0851a56722740f3e (patch) | |
tree | 0f85f2b1b2f030e7c51f0c69b112dea746b3a861 /arch/arm/include/asm | |
parent | f81ef4a920c8e1af75adf9f15042c2daa49d3cb3 (diff) |
ARM: 6357/1: hw-breakpoint: add new ptrace requests for hw-breakpoint interaction
For debuggers to take advantage of the hw-breakpoint framework in the kernel,
it is necessary to expose the API calls via a ptrace interface.
This patch exposes the hardware breakpoints framework as a collection of
virtual registers, accesible using PTRACE_SETHBPREGS and PTRACE_GETHBPREGS
requests. The breakpoints are stored in the debug_info struct of the running
thread.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: S. Karthikeyan <informkarthik@gmail.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/include/asm')
-rw-r--r-- | arch/arm/include/asm/hw_breakpoint.h | 12 | ||||
-rw-r--r-- | arch/arm/include/asm/processor.h | 4 | ||||
-rw-r--r-- | arch/arm/include/asm/ptrace.h | 2 |
3 files changed, 17 insertions, 1 deletions
diff --git a/arch/arm/include/asm/hw_breakpoint.h b/arch/arm/include/asm/hw_breakpoint.h index 33048c700caa..4d8ae9d67abe 100644 --- a/arch/arm/include/asm/hw_breakpoint.h +++ b/arch/arm/include/asm/hw_breakpoint.h | |||
@@ -2,6 +2,11 @@ | |||
2 | #define _ARM_HW_BREAKPOINT_H | 2 | #define _ARM_HW_BREAKPOINT_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
5 | |||
6 | struct task_struct; | ||
7 | |||
8 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | ||
9 | |||
5 | struct arch_hw_breakpoint_ctrl { | 10 | struct arch_hw_breakpoint_ctrl { |
6 | u32 __reserved : 9, | 11 | u32 __reserved : 9, |
7 | mismatch : 1, | 12 | mismatch : 1, |
@@ -102,7 +107,6 @@ static inline void decode_ctrl_reg(u32 reg, | |||
102 | struct notifier_block; | 107 | struct notifier_block; |
103 | struct perf_event; | 108 | struct perf_event; |
104 | struct pmu; | 109 | struct pmu; |
105 | struct task_struct; | ||
106 | 110 | ||
107 | extern struct pmu perf_ops_bp; | 111 | extern struct pmu perf_ops_bp; |
108 | extern int arch_bp_generic_fields(struct arch_hw_breakpoint_ctrl ctrl, | 112 | extern int arch_bp_generic_fields(struct arch_hw_breakpoint_ctrl ctrl, |
@@ -111,13 +115,19 @@ extern int arch_check_bp_in_kernelspace(struct perf_event *bp); | |||
111 | extern int arch_validate_hwbkpt_settings(struct perf_event *bp); | 115 | extern int arch_validate_hwbkpt_settings(struct perf_event *bp); |
112 | extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused, | 116 | extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused, |
113 | unsigned long val, void *data); | 117 | unsigned long val, void *data); |
118 | |||
114 | extern u8 arch_get_debug_arch(void); | 119 | extern u8 arch_get_debug_arch(void); |
115 | extern u8 arch_get_max_wp_len(void); | 120 | extern u8 arch_get_max_wp_len(void); |
121 | extern void clear_ptrace_hw_breakpoint(struct task_struct *tsk); | ||
116 | 122 | ||
117 | int arch_install_hw_breakpoint(struct perf_event *bp); | 123 | int arch_install_hw_breakpoint(struct perf_event *bp); |
118 | void arch_uninstall_hw_breakpoint(struct perf_event *bp); | 124 | void arch_uninstall_hw_breakpoint(struct perf_event *bp); |
119 | void hw_breakpoint_pmu_read(struct perf_event *bp); | 125 | void hw_breakpoint_pmu_read(struct perf_event *bp); |
120 | int hw_breakpoint_slots(int type); | 126 | int hw_breakpoint_slots(int type); |
121 | 127 | ||
128 | #else | ||
129 | static inline void clear_ptrace_hw_breakpoint(struct task_struct *tsk) {} | ||
130 | |||
131 | #endif /* CONFIG_HAVE_HW_BREAKPOINT */ | ||
122 | #endif /* __KERNEL__ */ | 132 | #endif /* __KERNEL__ */ |
123 | #endif /* _ARM_HW_BREAKPOINT_H */ | 133 | #endif /* _ARM_HW_BREAKPOINT_H */ |
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h index 7bed3daf83b8..67357baaeeeb 100644 --- a/arch/arm/include/asm/processor.h +++ b/arch/arm/include/asm/processor.h | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #ifdef __KERNEL__ | 20 | #ifdef __KERNEL__ |
21 | 21 | ||
22 | #include <asm/hw_breakpoint.h> | ||
22 | #include <asm/ptrace.h> | 23 | #include <asm/ptrace.h> |
23 | #include <asm/types.h> | 24 | #include <asm/types.h> |
24 | 25 | ||
@@ -41,6 +42,9 @@ struct debug_entry { | |||
41 | struct debug_info { | 42 | struct debug_info { |
42 | int nsaved; | 43 | int nsaved; |
43 | struct debug_entry bp[2]; | 44 | struct debug_entry bp[2]; |
45 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | ||
46 | struct perf_event *hbp[ARM_MAX_HBP_SLOTS]; | ||
47 | #endif | ||
44 | }; | 48 | }; |
45 | 49 | ||
46 | struct thread_struct { | 50 | struct thread_struct { |
diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h index 7ce15eb15f72..783d50f32618 100644 --- a/arch/arm/include/asm/ptrace.h +++ b/arch/arm/include/asm/ptrace.h | |||
@@ -29,6 +29,8 @@ | |||
29 | #define PTRACE_SETCRUNCHREGS 26 | 29 | #define PTRACE_SETCRUNCHREGS 26 |
30 | #define PTRACE_GETVFPREGS 27 | 30 | #define PTRACE_GETVFPREGS 27 |
31 | #define PTRACE_SETVFPREGS 28 | 31 | #define PTRACE_SETVFPREGS 28 |
32 | #define PTRACE_GETHBPREGS 29 | ||
33 | #define PTRACE_SETHBPREGS 30 | ||
32 | 34 | ||
33 | /* | 35 | /* |
34 | * PSR bits | 36 | * PSR bits |