ee9f28e245aa01ad0ac2467efb412d94ded17827
[deliverable/linux.git] / arch / arm64 / include / asm / debug-monitors.h
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 DBG_ARCH_ID_RESERVED 0 /* In case of ptrace ABI updates. */
47
48 #define DBG_HOOK_HANDLED 0
49 #define DBG_HOOK_ERROR 1
50
51 struct step_hook {
52 struct list_head node;
53 int (*fn)(struct pt_regs *regs, unsigned int esr);
54 };
55
56 void register_step_hook(struct step_hook *hook);
57 void unregister_step_hook(struct step_hook *hook);
58
59 struct break_hook {
60 struct list_head node;
61 u32 esr_val;
62 u32 esr_mask;
63 int (*fn)(struct pt_regs *regs, unsigned int esr);
64 };
65
66 void register_break_hook(struct break_hook *hook);
67 void unregister_break_hook(struct break_hook *hook);
68
69 u8 debug_monitors_arch(void);
70
71 void enable_debug_monitors(enum debug_el el);
72 void disable_debug_monitors(enum debug_el el);
73
74 void user_rewind_single_step(struct task_struct *task);
75 void user_fastforward_single_step(struct task_struct *task);
76
77 void kernel_enable_single_step(struct pt_regs *regs);
78 void kernel_disable_single_step(void);
79 int kernel_active_single_step(void);
80
81 #ifdef CONFIG_HAVE_HW_BREAKPOINT
82 int reinstall_suspended_bps(struct pt_regs *regs);
83 #else
84 static inline int reinstall_suspended_bps(struct pt_regs *regs)
85 {
86 return -ENODEV;
87 }
88 #endif
89
90 int aarch32_break_handler(struct pt_regs *regs);
91
92 #endif /* __ASSEMBLY */
93 #endif /* __KERNEL__ */
94 #endif /* __ASM_DEBUG_MONITORS_H */
This page took 0.032207 seconds and 4 git commands to generate.