Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  *  Originally written by Glenn Engel, Lake Stevens Instrument Division
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *  Contributed by HP Systems
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *  Modified for Linux/MIPS (and MIPS in general) by Andreas Busse
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *  Send complaints, suggestions etc. to <andy@waldorf-gmbh.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *  Copyright (C) 1995 Andreas Busse
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *  Copyright (C) 2003 MontaVista Software Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *  Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *  Copyright (C) 2004-2005 MontaVista Software Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *  Author: Manish Lachwani, mlachwani@mvista.com or manish@koffee-break.com
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  *  Copyright (C) 2007-2008 Wind River Systems, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *  Author/Maintainer: Jason Wessel, jason.wessel@windriver.com
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *  This file is licensed under the terms of the GNU General Public License
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  *  version 2. This program is licensed "as is" without any warranty of any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *  kind, whether express or implied.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <linux/ptrace.h>		/* for linux pt_regs struct */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <linux/kgdb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <linux/kdebug.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include <linux/smp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include <asm/inst.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <asm/fpu.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include <asm/cacheflush.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include <asm/processor.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include <asm/sigcontext.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #include <asm/irq_regs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) static struct hard_trap_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	unsigned char tt;	/* Trap type code for MIPS R3xxx and R4xxx */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	unsigned char signo;	/* Signal that we map this trap into */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) } hard_trap_info[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	{ 6, SIGBUS },		/* instruction bus error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	{ 7, SIGBUS },		/* data bus error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	{ 9, SIGTRAP },		/* break */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) /*	{ 11, SIGILL }, */	/* CPU unusable */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	{ 12, SIGFPE },		/* overflow */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	{ 13, SIGTRAP },	/* trap */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	{ 14, SIGSEGV },	/* virtual instruction cache coherency */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	{ 15, SIGFPE },		/* floating point exception */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	{ 23, SIGSEGV },	/* watch */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	{ 31, SIGSEGV },	/* virtual data cache coherency */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	{ 0, 0}			/* Must be last */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	{ "zero", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[0]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	{ "at", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[1]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	{ "v0", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[2]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	{ "v1", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[3]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	{ "a0", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[4]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	{ "a1", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[5]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	{ "a2", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[6]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	{ "a3", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[7]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	{ "t0", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[8]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	{ "t1", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[9]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	{ "t2", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[10]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	{ "t3", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[11]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	{ "t4", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[12]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	{ "t5", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[13]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	{ "t6", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[14]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	{ "t7", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[15]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	{ "s0", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[16]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	{ "s1", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[17]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	{ "s2", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[18]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	{ "s3", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[19]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	{ "s4", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[20]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	{ "s5", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[21]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	{ "s6", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[22]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	{ "s7", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[23]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	{ "t8", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[24]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	{ "t9", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[25]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	{ "k0", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[26]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	{ "k1", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[27]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	{ "gp", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[28]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	{ "sp", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[29]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	{ "s8", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[30]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	{ "ra", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[31]) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	{ "sr", GDB_SIZEOF_REG, offsetof(struct pt_regs, cp0_status) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	{ "lo", GDB_SIZEOF_REG, offsetof(struct pt_regs, lo) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	{ "hi", GDB_SIZEOF_REG, offsetof(struct pt_regs, hi) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	{ "bad", GDB_SIZEOF_REG, offsetof(struct pt_regs, cp0_badvaddr) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	{ "cause", GDB_SIZEOF_REG, offsetof(struct pt_regs, cp0_cause) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	{ "pc", GDB_SIZEOF_REG, offsetof(struct pt_regs, cp0_epc) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	{ "f0", GDB_SIZEOF_REG, 0 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	{ "f1", GDB_SIZEOF_REG, 1 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	{ "f2", GDB_SIZEOF_REG, 2 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	{ "f3", GDB_SIZEOF_REG, 3 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	{ "f4", GDB_SIZEOF_REG, 4 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	{ "f5", GDB_SIZEOF_REG, 5 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	{ "f6", GDB_SIZEOF_REG, 6 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	{ "f7", GDB_SIZEOF_REG, 7 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	{ "f8", GDB_SIZEOF_REG, 8 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	{ "f9", GDB_SIZEOF_REG, 9 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	{ "f10", GDB_SIZEOF_REG, 10 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	{ "f11", GDB_SIZEOF_REG, 11 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	{ "f12", GDB_SIZEOF_REG, 12 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	{ "f13", GDB_SIZEOF_REG, 13 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	{ "f14", GDB_SIZEOF_REG, 14 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	{ "f15", GDB_SIZEOF_REG, 15 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	{ "f16", GDB_SIZEOF_REG, 16 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	{ "f17", GDB_SIZEOF_REG, 17 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	{ "f18", GDB_SIZEOF_REG, 18 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	{ "f19", GDB_SIZEOF_REG, 19 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	{ "f20", GDB_SIZEOF_REG, 20 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	{ "f21", GDB_SIZEOF_REG, 21 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	{ "f22", GDB_SIZEOF_REG, 22 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	{ "f23", GDB_SIZEOF_REG, 23 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	{ "f24", GDB_SIZEOF_REG, 24 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	{ "f25", GDB_SIZEOF_REG, 25 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	{ "f26", GDB_SIZEOF_REG, 26 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	{ "f27", GDB_SIZEOF_REG, 27 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	{ "f28", GDB_SIZEOF_REG, 28 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	{ "f29", GDB_SIZEOF_REG, 29 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	{ "f30", GDB_SIZEOF_REG, 30 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	{ "f31", GDB_SIZEOF_REG, 31 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	{ "fsr", GDB_SIZEOF_REG, 0 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	{ "fir", GDB_SIZEOF_REG, 0 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	int fp_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	if (regno < 0 || regno >= DBG_MAX_REG_NUM)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	if (dbg_reg_def[regno].offset != -1 && regno < 38) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 		memcpy((void *)regs + dbg_reg_def[regno].offset, mem,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		       dbg_reg_def[regno].size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	} else if (current && dbg_reg_def[regno].offset != -1 && regno < 72) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		/* FP registers 38 -> 69 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		if (!(regs->cp0_status & ST0_CU1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 			return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 		if (regno == 70) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 			/* Process the fcr31/fsr (register 70) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 			memcpy((void *)&current->thread.fpu.fcr31, mem,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 			       dbg_reg_def[regno].size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 			goto out_save;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 		} else if (regno == 71) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 			/* Ignore the fir (register 71) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 			goto out_save;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 		fp_reg = dbg_reg_def[regno].offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 		memcpy((void *)&current->thread.fpu.fpr[fp_reg], mem,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 		       dbg_reg_def[regno].size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) out_save:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 		restore_fp(current);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	int fp_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	if (regno >= DBG_MAX_REG_NUM || regno < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	if (dbg_reg_def[regno].offset != -1 && regno < 38) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 		/* First 38 registers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 		memcpy(mem, (void *)regs + dbg_reg_def[regno].offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 		       dbg_reg_def[regno].size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	} else if (current && dbg_reg_def[regno].offset != -1 && regno < 72) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		/* FP registers 38 -> 69 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		if (!(regs->cp0_status & ST0_CU1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 			goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		save_fp(current);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 		if (regno == 70) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 			/* Process the fcr31/fsr (register 70) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 			memcpy(mem, (void *)&current->thread.fpu.fcr31,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 			       dbg_reg_def[regno].size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 			goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 		} else if (regno == 71) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 			/* Ignore the fir (register 71) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 			memset(mem, 0, dbg_reg_def[regno].size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 			goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 		fp_reg = dbg_reg_def[regno].offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 		memcpy(mem, (void *)&current->thread.fpu.fpr[fp_reg],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 		       dbg_reg_def[regno].size);
^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) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	return dbg_reg_def[regno].name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) void arch_kgdb_breakpoint(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	__asm__ __volatile__(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		".globl breakinst\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		".set\tnoreorder\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		"nop\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 		"breakinst:\tbreak\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 		"nop\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 		".set\treorder");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) void kgdb_call_nmi_hook(void *ignored)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	mm_segment_t old_fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	old_fs = get_fs();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	set_fs(KERNEL_DS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	set_fs(old_fs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) static int compute_signal(int tt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	struct hard_trap_info *ht;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 		if (ht->tt == tt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 			return ht->signo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	return SIGHUP;		/* default for things we don't know about */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)  * Similar to regs_to_gdb_regs() except that process is sleeping and so
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)  * we may not be able to get all the info.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	int reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) #if (KGDB_GDB_REG_SIZE == 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	u32 *ptr = (u32 *)gdb_regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	u64 *ptr = (u64 *)gdb_regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	for (reg = 0; reg < 16; reg++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 		*(ptr++) = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	/* S0 - S7 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	*(ptr++) = p->thread.reg16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	*(ptr++) = p->thread.reg17;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	*(ptr++) = p->thread.reg18;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	*(ptr++) = p->thread.reg19;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	*(ptr++) = p->thread.reg20;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	*(ptr++) = p->thread.reg21;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	*(ptr++) = p->thread.reg22;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	*(ptr++) = p->thread.reg23;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	for (reg = 24; reg < 28; reg++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 		*(ptr++) = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	/* GP, SP, FP, RA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	*(ptr++) = (long)p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	*(ptr++) = p->thread.reg29;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	*(ptr++) = p->thread.reg30;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	*(ptr++) = p->thread.reg31;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	*(ptr++) = p->thread.cp0_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	/* lo, hi */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	*(ptr++) = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	*(ptr++) = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	 * BadVAddr, Cause
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	 * Ideally these would come from the last exception frame up the stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	 * but that requires unwinding, otherwise we can't know much for sure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	*(ptr++) = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	*(ptr++) = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	 * PC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	 * use return address (RA), i.e. the moment after return from resume()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 	*(ptr++) = p->thread.reg31;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	regs->cp0_epc = pc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)  * Calls linux_debug_hook before the kernel dies. If KGDB is enabled,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)  * then try to fall into the debugger
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) static int kgdb_mips_notify(struct notifier_block *self, unsigned long cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 			    void *ptr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	struct die_args *args = (struct die_args *)ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	struct pt_regs *regs = args->regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 	int trap = (regs->cp0_cause & 0x7c) >> 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	mm_segment_t old_fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) #ifdef CONFIG_KPROBES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 	 * Return immediately if the kprobes fault notifier has set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 	 * DIE_PAGE_FAULT.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	if (cmd == DIE_PAGE_FAULT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 		return NOTIFY_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) #endif /* CONFIG_KPROBES */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	/* Userspace events, ignore. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	if (user_mode(regs))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 		return NOTIFY_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 	/* Kernel mode. Set correct address limit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 	old_fs = get_fs();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	set_fs(KERNEL_DS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	if (atomic_read(&kgdb_active) != -1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 		kgdb_nmicallback(smp_processor_id(), regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	if (kgdb_handle_exception(trap, compute_signal(trap), cmd, regs)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 		set_fs(old_fs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 		return NOTIFY_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 	if (atomic_read(&kgdb_setting_breakpoint))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 		if ((trap == 9) && (regs->cp0_epc == (unsigned long)breakinst))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 			regs->cp0_epc += 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	/* In SMP mode, __flush_cache_all does IPI */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	local_irq_enable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 	__flush_cache_all();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 	set_fs(old_fs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 	return NOTIFY_STOP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) #ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) int kgdb_ll_trap(int cmd, const char *str,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 		 struct pt_regs *regs, long err, int trap, int sig)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 	struct die_args args = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 		.regs	= regs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 		.str	= str,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 		.err	= err,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 		.trapnr = trap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 		.signr	= sig,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 	if (!kgdb_io_module_registered)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 		return NOTIFY_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 	return kgdb_mips_notify(NULL, cmd, &args);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) #endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) static struct notifier_block kgdb_notifier = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 	.notifier_call = kgdb_mips_notify,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)  * Handle the 'c' command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) int kgdb_arch_handle_exception(int vector, int signo, int err_code,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 			       char *remcom_in_buffer, char *remcom_out_buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 			       struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 	char *ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 	unsigned long address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 	switch (remcom_in_buffer[0]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 	case 'c':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 		/* handle the optional parameter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 		ptr = &remcom_in_buffer[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 		if (kgdb_hex2long(&ptr, &address))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 			regs->cp0_epc = address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 	return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) const struct kgdb_arch arch_kgdb_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) #ifdef CONFIG_CPU_BIG_ENDIAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 	.gdb_bpt_instr = { spec_op << 2, 0x00, 0x00, break_op },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 	.gdb_bpt_instr = { break_op, 0x00, 0x00, spec_op << 2 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) int kgdb_arch_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 	register_die_notifier(&kgdb_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)  *	kgdb_arch_exit - Perform any architecture specific uninitalization.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)  *	This function will handle the uninitalization of any architecture
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410)  *	specific callbacks, for dynamic registration and unregistration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) void kgdb_arch_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 	unregister_die_notifier(&kgdb_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) }