2 * Copyright (C) 2012 ARM Ltd.
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.
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.
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/>.
16 #ifndef __ASM_DEBUG_MONITORS_H
17 #define __ASM_DEBUG_MONITORS_H
21 #define DBG_ESR_EVT(x) (((x) >> 27) & 0x7)
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
35 #define DBG_ESR_EVT_BKPT 0x4
36 #define DBG_ESR_EVT_VECC 0x5
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
46 #define DBG_ARCH_ID_RESERVED 0 /* In case of ptrace ABI updates. */
48 #define DBG_HOOK_HANDLED 0
49 #define DBG_HOOK_ERROR 1
52 struct list_head node;
53 int (*fn)(struct pt_regs *regs, unsigned int esr);
56 void register_step_hook(struct step_hook *hook);
57 void unregister_step_hook(struct step_hook *hook);
60 struct list_head node;
63 int (*fn)(struct pt_regs *regs, unsigned int esr);
66 void register_break_hook(struct break_hook *hook);
67 void unregister_break_hook(struct break_hook *hook);
69 u8 debug_monitors_arch(void);
71 void enable_debug_monitors(enum debug_el el);
72 void disable_debug_monitors(enum debug_el el);
74 void user_rewind_single_step(struct task_struct *task);
75 void user_fastforward_single_step(struct task_struct *task);
77 void kernel_enable_single_step(struct pt_regs *regs);
78 void kernel_disable_single_step(void);
79 int kernel_active_single_step(void);
81 #ifdef CONFIG_HAVE_HW_BREAKPOINT
82 int reinstall_suspended_bps(struct pt_regs *regs);
84 static inline int reinstall_suspended_bps(struct pt_regs *regs)
90 int aarch32_break_handler(struct pt_regs *regs);
92 #endif /* __ASSEMBLY */
93 #endif /* __KERNEL__ */
94 #endif /* __ASM_DEBUG_MONITORS_H */