hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/arm64/include/asm/debug-monitors.h
....@@ -1,22 +1,9 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * 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/>.
154 */
165 #ifndef __ASM_DEBUG_MONITORS_H
176 #define __ASM_DEBUG_MONITORS_H
18
-
19
-#ifdef __KERNEL__
207
218 #include <linux/errno.h>
229 #include <linux/types.h>
....@@ -65,12 +52,10 @@
6552 #define CACHE_FLUSH_IS_SAFE 1
6653
6754 /* 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))
7157 /* 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))
7459
7560 /* AArch32 */
7661 #define DBG_ESR_EVT_BKPT 0x4
....@@ -94,18 +79,24 @@
9479 int (*fn)(struct pt_regs *regs, unsigned int esr);
9580 };
9681
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);
9987
10088 struct break_hook {
10189 struct list_head node;
102
- u32 esr_val;
103
- u32 esr_mask;
10490 int (*fn)(struct pt_regs *regs, unsigned int esr);
91
+ u16 imm;
92
+ u16 mask; /* These bits are ignored when comparing with imm */
10593 };
10694
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);
109100
110101 u8 debug_monitors_arch(void);
111102
....@@ -125,6 +116,7 @@
125116 void kernel_enable_single_step(struct pt_regs *regs);
126117 void kernel_disable_single_step(void);
127118 int kernel_active_single_step(void);
119
+void kernel_rewind_single_step(struct pt_regs *regs);
128120
129121 #ifdef CONFIG_HAVE_HW_BREAKPOINT
130122 int reinstall_suspended_bps(struct pt_regs *regs);
....@@ -137,6 +129,7 @@
137129
138130 int aarch32_break_handler(struct pt_regs *regs);
139131
132
+void debug_traps_init(void);
133
+
140134 #endif /* __ASSEMBLY */
141
-#endif /* __KERNEL__ */
142135 #endif /* __ASM_DEBUG_MONITORS_H */