^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * arch/hexagon/kernel/kgdb.c - Hexagon KGDB Support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/sched/task_stack.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/kdebug.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/kgdb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) /* All registers are 4 bytes, for now */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define GDB_SIZEOF_REG 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /* The register names are used during printing of the regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * Keep these at three letters to pretty-print. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) { " r0", GDB_SIZEOF_REG, offsetof(struct pt_regs, r00)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) { " r1", GDB_SIZEOF_REG, offsetof(struct pt_regs, r01)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) { " r2", GDB_SIZEOF_REG, offsetof(struct pt_regs, r02)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) { " r3", GDB_SIZEOF_REG, offsetof(struct pt_regs, r03)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) { " r4", GDB_SIZEOF_REG, offsetof(struct pt_regs, r04)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) { " r5", GDB_SIZEOF_REG, offsetof(struct pt_regs, r05)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) { " r6", GDB_SIZEOF_REG, offsetof(struct pt_regs, r06)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) { " r7", GDB_SIZEOF_REG, offsetof(struct pt_regs, r07)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) { " r8", GDB_SIZEOF_REG, offsetof(struct pt_regs, r08)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) { " r9", GDB_SIZEOF_REG, offsetof(struct pt_regs, r09)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) { "r10", GDB_SIZEOF_REG, offsetof(struct pt_regs, r10)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) { "r11", GDB_SIZEOF_REG, offsetof(struct pt_regs, r11)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) { "r12", GDB_SIZEOF_REG, offsetof(struct pt_regs, r12)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) { "r13", GDB_SIZEOF_REG, offsetof(struct pt_regs, r13)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) { "r14", GDB_SIZEOF_REG, offsetof(struct pt_regs, r14)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) { "r15", GDB_SIZEOF_REG, offsetof(struct pt_regs, r15)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) { "r16", GDB_SIZEOF_REG, offsetof(struct pt_regs, r16)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) { "r17", GDB_SIZEOF_REG, offsetof(struct pt_regs, r17)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) { "r18", GDB_SIZEOF_REG, offsetof(struct pt_regs, r18)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) { "r19", GDB_SIZEOF_REG, offsetof(struct pt_regs, r19)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) { "r20", GDB_SIZEOF_REG, offsetof(struct pt_regs, r20)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) { "r21", GDB_SIZEOF_REG, offsetof(struct pt_regs, r21)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) { "r22", GDB_SIZEOF_REG, offsetof(struct pt_regs, r22)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) { "r23", GDB_SIZEOF_REG, offsetof(struct pt_regs, r23)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) { "r24", GDB_SIZEOF_REG, offsetof(struct pt_regs, r24)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) { "r25", GDB_SIZEOF_REG, offsetof(struct pt_regs, r25)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) { "r26", GDB_SIZEOF_REG, offsetof(struct pt_regs, r26)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) { "r27", GDB_SIZEOF_REG, offsetof(struct pt_regs, r27)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) { "r28", GDB_SIZEOF_REG, offsetof(struct pt_regs, r28)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) { "r29", GDB_SIZEOF_REG, offsetof(struct pt_regs, r29)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) { "r30", GDB_SIZEOF_REG, offsetof(struct pt_regs, r30)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) { "r31", GDB_SIZEOF_REG, offsetof(struct pt_regs, r31)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) { "usr", GDB_SIZEOF_REG, offsetof(struct pt_regs, usr)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) { "preds", GDB_SIZEOF_REG, offsetof(struct pt_regs, preds)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) { " m0", GDB_SIZEOF_REG, offsetof(struct pt_regs, m0)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) { " m1", GDB_SIZEOF_REG, offsetof(struct pt_regs, m1)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) { "sa0", GDB_SIZEOF_REG, offsetof(struct pt_regs, sa0)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) { "sa1", GDB_SIZEOF_REG, offsetof(struct pt_regs, sa1)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) { "lc0", GDB_SIZEOF_REG, offsetof(struct pt_regs, lc0)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) { "lc1", GDB_SIZEOF_REG, offsetof(struct pt_regs, lc1)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) { " gp", GDB_SIZEOF_REG, offsetof(struct pt_regs, gp)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) { "ugp", GDB_SIZEOF_REG, offsetof(struct pt_regs, ugp)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) { "cs0", GDB_SIZEOF_REG, offsetof(struct pt_regs, cs0)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) { "cs1", GDB_SIZEOF_REG, offsetof(struct pt_regs, cs1)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) { "psp", GDB_SIZEOF_REG, offsetof(struct pt_regs, hvmer.vmpsp)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) { "elr", GDB_SIZEOF_REG, offsetof(struct pt_regs, hvmer.vmel)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) { "est", GDB_SIZEOF_REG, offsetof(struct pt_regs, hvmer.vmest)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) { "badva", GDB_SIZEOF_REG, offsetof(struct pt_regs, hvmer.vmbadva)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) { "restart_r0", GDB_SIZEOF_REG, offsetof(struct pt_regs, restart_r0)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) { "syscall_nr", GDB_SIZEOF_REG, offsetof(struct pt_regs, syscall_nr)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) const struct kgdb_arch arch_kgdb_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) /* trap0(#0xDB) 0x0cdb0054 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) .gdb_bpt_instr = {0x54, 0x00, 0xdb, 0x0c},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) if (regno >= DBG_MAX_REG_NUM || regno < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) *((unsigned long *) mem) = *((unsigned long *) ((void *)regs +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) dbg_reg_def[regno].offset));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) return dbg_reg_def[regno].name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) if (regno >= DBG_MAX_REG_NUM || regno < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) *((unsigned long *) ((void *)regs + dbg_reg_def[regno].offset)) =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) *((unsigned long *) mem);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) instruction_pointer(regs) = pc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) /* Not yet working */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) struct task_struct *task)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) struct pt_regs *thread_regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) if (task == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) /* Initialize to zero */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) memset(gdb_regs, 0, NUMREGBYTES);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) /* Otherwise, we have only some registers from switch_to() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) thread_regs = task_pt_regs(task);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) gdb_regs[0] = thread_regs->r00;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) * kgdb_arch_handle_exception - Handle architecture specific GDB packets.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * @vector: The error vector of the exception that happened.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * @signo: The signal number of the exception that happened.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * @err_code: The error code of the exception that happened.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) * @remcom_in_buffer: The buffer of the packet we have read.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) * @remcom_out_buffer: The buffer of %BUFMAX bytes to write a packet into.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) * @regs: The &struct pt_regs of the current process.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * This function MUST handle the 'c' and 's' command packets,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * as well packets to set / remove a hardware breakpoint, if used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) * If there are additional packets which the hardware needs to handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) * they are handled here. The code should return -1 if it wants to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) * process more packets, and a %0 or %1 if it wants to exit from the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * kgdb callback.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * Not yet working.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) int kgdb_arch_handle_exception(int vector, int signo, int err_code,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) char *remcom_in_buffer, char *remcom_out_buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) struct pt_regs *linux_regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) switch (remcom_in_buffer[0]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) case 's':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) case 'c':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) /* Stay in the debugger. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) static int __kgdb_notify(struct die_args *args, unsigned long cmd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) /* cpu roundup */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) if (atomic_read(&kgdb_active) != -1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) kgdb_nmicallback(smp_processor_id(), args->regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) return NOTIFY_STOP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) if (user_mode(args->regs))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) return NOTIFY_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) if (kgdb_handle_exception(args->trapnr & 0xff, args->signr, args->err,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) args->regs))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) return NOTIFY_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) return NOTIFY_STOP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) kgdb_notify(struct notifier_block *self, unsigned long cmd, void *ptr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) local_irq_save(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) ret = __kgdb_notify(ptr, cmd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) local_irq_restore(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) static struct notifier_block kgdb_notifier = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) .notifier_call = kgdb_notify,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) * Lowest-prio notifier priority, we want to be notified last:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) .priority = -INT_MAX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) * kgdb_arch_init - Perform any architecture specific initialization.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) * This function will handle the initialization of any architecture
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) * specific callbacks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) int kgdb_arch_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) return register_die_notifier(&kgdb_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) * kgdb_arch_exit - Perform any architecture specific uninitalization.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) * This function will handle the uninitalization of any architecture
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) * specific callbacks, for dynamic registration and unregistration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) void kgdb_arch_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) unregister_die_notifier(&kgdb_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) }