.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * 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 | 4 | */ |
---|
16 | 5 | #ifndef __ASM_DEBUG_MONITORS_H |
---|
17 | 6 | #define __ASM_DEBUG_MONITORS_H |
---|
18 | | - |
---|
19 | | -#ifdef __KERNEL__ |
---|
20 | 7 | |
---|
21 | 8 | #include <linux/errno.h> |
---|
22 | 9 | #include <linux/types.h> |
---|
.. | .. |
---|
65 | 52 | #define CACHE_FLUSH_IS_SAFE 1 |
---|
66 | 53 | |
---|
67 | 54 | /* kprobes BRK opcodes with ESR encoding */ |
---|
68 | | -#define BRK64_ESR_MASK 0xFFFF |
---|
69 | | -#define BRK64_ESR_KPROBES 0x0004 |
---|
70 | | -#define BRK64_OPCODE_KPROBES (AARCH64_BREAK_MON | (BRK64_ESR_KPROBES << 5)) |
---|
| 55 | +#define BRK64_OPCODE_KPROBES (AARCH64_BREAK_MON | (KPROBES_BRK_IMM << 5)) |
---|
| 56 | +#define BRK64_OPCODE_KPROBES_SS (AARCH64_BREAK_MON | (KPROBES_BRK_SS_IMM << 5)) |
---|
71 | 57 | /* uprobes BRK opcodes with ESR encoding */ |
---|
72 | | -#define BRK64_ESR_UPROBES 0x0005 |
---|
73 | | -#define BRK64_OPCODE_UPROBES (AARCH64_BREAK_MON | (BRK64_ESR_UPROBES << 5)) |
---|
| 58 | +#define BRK64_OPCODE_UPROBES (AARCH64_BREAK_MON | (UPROBES_BRK_IMM << 5)) |
---|
74 | 59 | |
---|
75 | 60 | /* AArch32 */ |
---|
76 | 61 | #define DBG_ESR_EVT_BKPT 0x4 |
---|
.. | .. |
---|
94 | 79 | int (*fn)(struct pt_regs *regs, unsigned int esr); |
---|
95 | 80 | }; |
---|
96 | 81 | |
---|
97 | | -void register_step_hook(struct step_hook *hook); |
---|
98 | | -void unregister_step_hook(struct step_hook *hook); |
---|
| 82 | +void register_user_step_hook(struct step_hook *hook); |
---|
| 83 | +void unregister_user_step_hook(struct step_hook *hook); |
---|
| 84 | + |
---|
| 85 | +void register_kernel_step_hook(struct step_hook *hook); |
---|
| 86 | +void unregister_kernel_step_hook(struct step_hook *hook); |
---|
99 | 87 | |
---|
100 | 88 | struct break_hook { |
---|
101 | 89 | struct list_head node; |
---|
102 | | - u32 esr_val; |
---|
103 | | - u32 esr_mask; |
---|
104 | 90 | int (*fn)(struct pt_regs *regs, unsigned int esr); |
---|
| 91 | + u16 imm; |
---|
| 92 | + u16 mask; /* These bits are ignored when comparing with imm */ |
---|
105 | 93 | }; |
---|
106 | 94 | |
---|
107 | | -void register_break_hook(struct break_hook *hook); |
---|
108 | | -void unregister_break_hook(struct break_hook *hook); |
---|
| 95 | +void register_user_break_hook(struct break_hook *hook); |
---|
| 96 | +void unregister_user_break_hook(struct break_hook *hook); |
---|
| 97 | + |
---|
| 98 | +void register_kernel_break_hook(struct break_hook *hook); |
---|
| 99 | +void unregister_kernel_break_hook(struct break_hook *hook); |
---|
109 | 100 | |
---|
110 | 101 | u8 debug_monitors_arch(void); |
---|
111 | 102 | |
---|
.. | .. |
---|
125 | 116 | void kernel_enable_single_step(struct pt_regs *regs); |
---|
126 | 117 | void kernel_disable_single_step(void); |
---|
127 | 118 | int kernel_active_single_step(void); |
---|
| 119 | +void kernel_rewind_single_step(struct pt_regs *regs); |
---|
128 | 120 | |
---|
129 | 121 | #ifdef CONFIG_HAVE_HW_BREAKPOINT |
---|
130 | 122 | int reinstall_suspended_bps(struct pt_regs *regs); |
---|
.. | .. |
---|
137 | 129 | |
---|
138 | 130 | int aarch32_break_handler(struct pt_regs *regs); |
---|
139 | 131 | |
---|
| 132 | +void debug_traps_init(void); |
---|
| 133 | + |
---|
140 | 134 | #endif /* __ASSEMBLY */ |
---|
141 | | -#endif /* __KERNEL__ */ |
---|
142 | 135 | #endif /* __ASM_DEBUG_MONITORS_H */ |
---|