hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/arch/arm64/kernel/kgdb.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * AArch64 KGDB support
34 *
....@@ -5,18 +6,6 @@
56 *
67 * Copyright (C) 2013 Cavium Inc.
78 * Author: Vijaya Kumar K <vijaya.kumar@caviumnetworks.com>
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License version 2 as
11
- * published by the Free Software Foundation.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
209 */
2110
2211 #include <linux/bug.h>
....@@ -244,9 +233,6 @@
244233
245234 static int kgdb_brk_fn(struct pt_regs *regs, unsigned int esr)
246235 {
247
- if (user_mode(regs))
248
- return DBG_HOOK_ERROR;
249
-
250236 kgdb_handle_exception(1, SIGTRAP, 0, regs);
251237 return DBG_HOOK_HANDLED;
252238 }
....@@ -254,9 +240,6 @@
254240
255241 static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned int esr)
256242 {
257
- if (user_mode(regs))
258
- return DBG_HOOK_ERROR;
259
-
260243 compiled_break = 1;
261244 kgdb_handle_exception(1, SIGTRAP, 0, regs);
262245
....@@ -266,7 +249,7 @@
266249
267250 static int kgdb_step_brk_fn(struct pt_regs *regs, unsigned int esr)
268251 {
269
- if (user_mode(regs) || !kgdb_single_step)
252
+ if (!kgdb_single_step)
270253 return DBG_HOOK_ERROR;
271254
272255 kgdb_handle_exception(0, SIGTRAP, 0, regs);
....@@ -275,32 +258,18 @@
275258 NOKPROBE_SYMBOL(kgdb_step_brk_fn);
276259
277260 static struct break_hook kgdb_brkpt_hook = {
278
- .esr_mask = 0xffffffff,
279
- .esr_val = (u32)ESR_ELx_VAL_BRK64(KGDB_DYN_DBG_BRK_IMM),
280
- .fn = kgdb_brk_fn
261
+ .fn = kgdb_brk_fn,
262
+ .imm = KGDB_DYN_DBG_BRK_IMM,
281263 };
282264
283265 static struct break_hook kgdb_compiled_brkpt_hook = {
284
- .esr_mask = 0xffffffff,
285
- .esr_val = (u32)ESR_ELx_VAL_BRK64(KGDB_COMPILED_DBG_BRK_IMM),
286
- .fn = kgdb_compiled_brk_fn
266
+ .fn = kgdb_compiled_brk_fn,
267
+ .imm = KGDB_COMPILED_DBG_BRK_IMM,
287268 };
288269
289270 static struct step_hook kgdb_step_hook = {
290271 .fn = kgdb_step_brk_fn
291272 };
292
-
293
-static void kgdb_call_nmi_hook(void *ignored)
294
-{
295
- kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs());
296
-}
297
-
298
-void kgdb_roundup_cpus(unsigned long flags)
299
-{
300
- local_irq_enable();
301
- smp_call_function(kgdb_call_nmi_hook, NULL, 0);
302
- local_irq_disable();
303
-}
304273
305274 static int __kgdb_notify(struct die_args *args, unsigned long cmd)
306275 {
....@@ -344,9 +313,9 @@
344313 if (ret != 0)
345314 return ret;
346315
347
- register_break_hook(&kgdb_brkpt_hook);
348
- register_break_hook(&kgdb_compiled_brkpt_hook);
349
- register_step_hook(&kgdb_step_hook);
316
+ register_kernel_break_hook(&kgdb_brkpt_hook);
317
+ register_kernel_break_hook(&kgdb_compiled_brkpt_hook);
318
+ register_kernel_step_hook(&kgdb_step_hook);
350319 return 0;
351320 }
352321
....@@ -357,13 +326,13 @@
357326 */
358327 void kgdb_arch_exit(void)
359328 {
360
- unregister_break_hook(&kgdb_brkpt_hook);
361
- unregister_break_hook(&kgdb_compiled_brkpt_hook);
362
- unregister_step_hook(&kgdb_step_hook);
329
+ unregister_kernel_break_hook(&kgdb_brkpt_hook);
330
+ unregister_kernel_break_hook(&kgdb_compiled_brkpt_hook);
331
+ unregister_kernel_step_hook(&kgdb_step_hook);
363332 unregister_die_notifier(&kgdb_notifier);
364333 }
365334
366
-struct kgdb_arch arch_kgdb_ops;
335
+const struct kgdb_arch arch_kgdb_ops;
367336
368337 int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt)
369338 {