diff options
author | Will Deacon <will.deacon@arm.com> | 2012-03-05 06:49:33 -0500 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2012-09-17 08:42:14 -0400 |
commit | 478fcb2cdb2351dcfc3fb23f42d76f4436ee4149 (patch) | |
tree | f5d0be182e1ca20a1c539d1632cc27d4d910d5db /arch/arm64/include/asm/debug-monitors.h | |
parent | 53631b54c8704fe5de435582c82ddbc0bfabf06a (diff) |
arm64: Debugging support
This patch adds ptrace, debug monitors and hardware breakpoints support.
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Nicolas Pitre <nico@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arm64/include/asm/debug-monitors.h')
-rw-r--r-- | arch/arm64/include/asm/debug-monitors.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h new file mode 100644 index 000000000000..7eaa0b302493 --- /dev/null +++ b/arch/arm64/include/asm/debug-monitors.h | |||
@@ -0,0 +1,88 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 ARM Ltd. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #ifndef __ASM_DEBUG_MONITORS_H | ||
17 | #define __ASM_DEBUG_MONITORS_H | ||
18 | |||
19 | #ifdef __KERNEL__ | ||
20 | |||
21 | #define DBG_ESR_EVT(x) (((x) >> 27) & 0x7) | ||
22 | |||
23 | /* AArch64 */ | ||
24 | #define DBG_ESR_EVT_HWBP 0x0 | ||
25 | #define DBG_ESR_EVT_HWSS 0x1 | ||
26 | #define DBG_ESR_EVT_HWWP 0x2 | ||
27 | #define DBG_ESR_EVT_BRK 0x6 | ||
28 | |||
29 | enum debug_el { | ||
30 | DBG_ACTIVE_EL0 = 0, | ||
31 | DBG_ACTIVE_EL1, | ||
32 | }; | ||
33 | |||
34 | /* AArch32 */ | ||
35 | #define DBG_ESR_EVT_BKPT 0x4 | ||
36 | #define DBG_ESR_EVT_VECC 0x5 | ||
37 | |||
38 | #define AARCH32_BREAK_ARM 0x07f001f0 | ||
39 | #define AARCH32_BREAK_THUMB 0xde01 | ||
40 | #define AARCH32_BREAK_THUMB2_LO 0xf7f0 | ||
41 | #define AARCH32_BREAK_THUMB2_HI 0xa000 | ||
42 | |||
43 | #ifndef __ASSEMBLY__ | ||
44 | struct task_struct; | ||
45 | |||
46 | #define local_dbg_save(flags) \ | ||
47 | do { \ | ||
48 | typecheck(unsigned long, flags); \ | ||
49 | asm volatile( \ | ||
50 | "mrs %0, daif // local_dbg_save\n" \ | ||
51 | "msr daifset, #8" \ | ||
52 | : "=r" (flags) : : "memory"); \ | ||
53 | } while (0) | ||
54 | |||
55 | #define local_dbg_restore(flags) \ | ||
56 | do { \ | ||
57 | typecheck(unsigned long, flags); \ | ||
58 | asm volatile( \ | ||
59 | "msr daif, %0 // local_dbg_restore\n" \ | ||
60 | : : "r" (flags) : "memory"); \ | ||
61 | } while (0) | ||
62 | |||
63 | #define DBG_ARCH_ID_RESERVED 0 /* In case of ptrace ABI updates. */ | ||
64 | |||
65 | u8 debug_monitors_arch(void); | ||
66 | |||
67 | void enable_debug_monitors(enum debug_el el); | ||
68 | void disable_debug_monitors(enum debug_el el); | ||
69 | |||
70 | void user_rewind_single_step(struct task_struct *task); | ||
71 | void user_fastforward_single_step(struct task_struct *task); | ||
72 | |||
73 | void kernel_enable_single_step(struct pt_regs *regs); | ||
74 | void kernel_disable_single_step(void); | ||
75 | int kernel_active_single_step(void); | ||
76 | |||
77 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | ||
78 | int reinstall_suspended_bps(struct pt_regs *regs); | ||
79 | #else | ||
80 | static inline int reinstall_suspended_bps(struct pt_regs *regs) | ||
81 | { | ||
82 | return -ENODEV; | ||
83 | } | ||
84 | #endif | ||
85 | |||
86 | #endif /* __ASSEMBLY */ | ||
87 | #endif /* __KERNEL__ */ | ||
88 | #endif /* __ASM_DEBUG_MONITORS_H */ | ||