kgdb.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. /*
  2. * PowerPC backend to the KGDB stub.
  3. *
  4. * 1998 (c) Michael AK Tesch (tesch@cs.wisc.edu)
  5. * Copyright (C) 2003 Timesys Corporation.
  6. * Copyright (C) 2004-2006 MontaVista Software, Inc.
  7. * PPC64 Mods (C) 2005 Frank Rowand (frowand@mvista.com)
  8. * PPC32 support restored by Vitaly Wool <vwool@ru.mvista.com> and
  9. * Sergei Shtylyov <sshtylyov@ru.mvista.com>
  10. * Copyright (C) 2007-2008 Wind River Systems, Inc.
  11. *
  12. * This file is licensed under the terms of the GNU General Public License
  13. * version 2. This program as licensed "as is" without any warranty of any
  14. * kind, whether express or implied.
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/kgdb.h>
  18. #include <linux/smp.h>
  19. #include <linux/signal.h>
  20. #include <linux/ptrace.h>
  21. #include <linux/kdebug.h>
  22. #include <asm/current.h>
  23. #include <asm/processor.h>
  24. #include <asm/machdep.h>
  25. #include <asm/debug.h>
  26. #include <linux/slab.h>
  27. /*
  28. * This table contains the mapping between PowerPC hardware trap types, and
  29. * signals, which are primarily what GDB understands. GDB and the kernel
  30. * don't always agree on values, so we use constants taken from gdb-6.2.
  31. */
  32. static struct hard_trap_info
  33. {
  34. unsigned int tt; /* Trap type code for powerpc */
  35. unsigned char signo; /* Signal that we map this trap into */
  36. } hard_trap_info[] = {
  37. { 0x0100, 0x02 /* SIGINT */ }, /* system reset */
  38. { 0x0200, 0x0b /* SIGSEGV */ }, /* machine check */
  39. { 0x0300, 0x0b /* SIGSEGV */ }, /* data access */
  40. { 0x0400, 0x0b /* SIGSEGV */ }, /* instruction access */
  41. { 0x0500, 0x02 /* SIGINT */ }, /* external interrupt */
  42. { 0x0600, 0x0a /* SIGBUS */ }, /* alignment */
  43. { 0x0700, 0x05 /* SIGTRAP */ }, /* program check */
  44. { 0x0800, 0x08 /* SIGFPE */ }, /* fp unavailable */
  45. { 0x0900, 0x0e /* SIGALRM */ }, /* decrementer */
  46. { 0x0c00, 0x14 /* SIGCHLD */ }, /* system call */
  47. #if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
  48. { 0x2002, 0x05 /* SIGTRAP */ }, /* debug */
  49. #if defined(CONFIG_FSL_BOOKE)
  50. { 0x2010, 0x08 /* SIGFPE */ }, /* spe unavailable */
  51. { 0x2020, 0x08 /* SIGFPE */ }, /* spe unavailable */
  52. { 0x2030, 0x08 /* SIGFPE */ }, /* spe fp data */
  53. { 0x2040, 0x08 /* SIGFPE */ }, /* spe fp data */
  54. { 0x2050, 0x08 /* SIGFPE */ }, /* spe fp round */
  55. { 0x2060, 0x0e /* SIGILL */ }, /* performance monitor */
  56. { 0x2900, 0x08 /* SIGFPE */ }, /* apu unavailable */
  57. { 0x3100, 0x0e /* SIGALRM */ }, /* fixed interval timer */
  58. { 0x3200, 0x02 /* SIGINT */ }, /* watchdog */
  59. #else /* ! CONFIG_FSL_BOOKE */
  60. { 0x1000, 0x0e /* SIGALRM */ }, /* prog interval timer */
  61. { 0x1010, 0x0e /* SIGALRM */ }, /* fixed interval timer */
  62. { 0x1020, 0x02 /* SIGINT */ }, /* watchdog */
  63. { 0x2010, 0x08 /* SIGFPE */ }, /* fp unavailable */
  64. { 0x2020, 0x08 /* SIGFPE */ }, /* ap unavailable */
  65. #endif
  66. #else /* ! (defined(CONFIG_40x) || defined(CONFIG_BOOKE)) */
  67. { 0x0d00, 0x05 /* SIGTRAP */ }, /* single-step */
  68. #if defined(CONFIG_8xx)
  69. { 0x1000, 0x04 /* SIGILL */ }, /* software emulation */
  70. #else /* ! CONFIG_8xx */
  71. { 0x0f00, 0x04 /* SIGILL */ }, /* performance monitor */
  72. { 0x0f20, 0x08 /* SIGFPE */ }, /* altivec unavailable */
  73. { 0x1300, 0x05 /* SIGTRAP */ }, /* instruction address break */
  74. #if defined(CONFIG_PPC64)
  75. { 0x1200, 0x05 /* SIGILL */ }, /* system error */
  76. { 0x1500, 0x04 /* SIGILL */ }, /* soft patch */
  77. { 0x1600, 0x04 /* SIGILL */ }, /* maintenance */
  78. { 0x1700, 0x08 /* SIGFPE */ }, /* altivec assist */
  79. { 0x1800, 0x04 /* SIGILL */ }, /* thermal */
  80. #else /* ! CONFIG_PPC64 */
  81. { 0x1400, 0x02 /* SIGINT */ }, /* SMI */
  82. { 0x1600, 0x08 /* SIGFPE */ }, /* altivec assist */
  83. { 0x1700, 0x04 /* SIGILL */ }, /* TAU */
  84. { 0x2000, 0x05 /* SIGTRAP */ }, /* run mode */
  85. #endif
  86. #endif
  87. #endif
  88. { 0x0000, 0x00 } /* Must be last */
  89. };
  90. static int computeSignal(unsigned int tt)
  91. {
  92. struct hard_trap_info *ht;
  93. for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
  94. if (ht->tt == tt)
  95. return ht->signo;
  96. return SIGHUP; /* default for things we don't know about */
  97. }
  98. /**
  99. *
  100. * kgdb_skipexception - Bail out of KGDB when we've been triggered.
  101. * @exception: Exception vector number
  102. * @regs: Current &struct pt_regs.
  103. *
  104. * On some architectures we need to skip a breakpoint exception when
  105. * it occurs after a breakpoint has been removed.
  106. *
  107. */
  108. int kgdb_skipexception(int exception, struct pt_regs *regs)
  109. {
  110. return kgdb_isremovedbreak(regs->nip);
  111. }
  112. static int kgdb_call_nmi_hook(struct pt_regs *regs)
  113. {
  114. kgdb_nmicallback(raw_smp_processor_id(), regs);
  115. return 0;
  116. }
  117. #ifdef CONFIG_SMP
  118. void kgdb_roundup_cpus(unsigned long flags)
  119. {
  120. smp_send_debugger_break();
  121. }
  122. #endif
  123. /* KGDB functions to use existing PowerPC64 hooks. */
  124. static int kgdb_debugger(struct pt_regs *regs)
  125. {
  126. return !kgdb_handle_exception(1, computeSignal(TRAP(regs)),
  127. DIE_OOPS, regs);
  128. }
  129. static int kgdb_handle_breakpoint(struct pt_regs *regs)
  130. {
  131. if (user_mode(regs))
  132. return 0;
  133. if (kgdb_handle_exception(1, SIGTRAP, 0, regs) != 0)
  134. return 0;
  135. if (*(u32 *) (regs->nip) == *(u32 *) (&arch_kgdb_ops.gdb_bpt_instr))
  136. regs->nip += BREAK_INSTR_SIZE;
  137. return 1;
  138. }
  139. static DEFINE_PER_CPU(struct thread_info, kgdb_thread_info);
  140. static int kgdb_singlestep(struct pt_regs *regs)
  141. {
  142. struct thread_info *thread_info, *exception_thread_info;
  143. struct thread_info *backup_current_thread_info =
  144. this_cpu_ptr(&kgdb_thread_info);
  145. if (user_mode(regs))
  146. return 0;
  147. /*
  148. * On Book E and perhaps other processors, singlestep is handled on
  149. * the critical exception stack. This causes current_thread_info()
  150. * to fail, since it it locates the thread_info by masking off
  151. * the low bits of the current stack pointer. We work around
  152. * this issue by copying the thread_info from the kernel stack
  153. * before calling kgdb_handle_exception, and copying it back
  154. * afterwards. On most processors the copy is avoided since
  155. * exception_thread_info == thread_info.
  156. */
  157. thread_info = (struct thread_info *)(regs->gpr[1] & ~(THREAD_SIZE-1));
  158. exception_thread_info = current_thread_info();
  159. if (thread_info != exception_thread_info) {
  160. /* Save the original current_thread_info. */
  161. memcpy(backup_current_thread_info, exception_thread_info, sizeof *thread_info);
  162. memcpy(exception_thread_info, thread_info, sizeof *thread_info);
  163. }
  164. kgdb_handle_exception(0, SIGTRAP, 0, regs);
  165. if (thread_info != exception_thread_info)
  166. /* Restore current_thread_info lastly. */
  167. memcpy(exception_thread_info, backup_current_thread_info, sizeof *thread_info);
  168. return 1;
  169. }
  170. static int kgdb_iabr_match(struct pt_regs *regs)
  171. {
  172. if (user_mode(regs))
  173. return 0;
  174. if (kgdb_handle_exception(0, computeSignal(TRAP(regs)), 0, regs) != 0)
  175. return 0;
  176. return 1;
  177. }
  178. static int kgdb_break_match(struct pt_regs *regs)
  179. {
  180. if (user_mode(regs))
  181. return 0;
  182. if (kgdb_handle_exception(0, computeSignal(TRAP(regs)), 0, regs) != 0)
  183. return 0;
  184. return 1;
  185. }
  186. #define PACK64(ptr, src) do { *(ptr++) = (src); } while (0)
  187. #define PACK32(ptr, src) do { \
  188. u32 *ptr32; \
  189. ptr32 = (u32 *)ptr; \
  190. *(ptr32++) = (src); \
  191. ptr = (unsigned long *)ptr32; \
  192. } while (0)
  193. void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
  194. {
  195. struct pt_regs *regs = (struct pt_regs *)(p->thread.ksp +
  196. STACK_FRAME_OVERHEAD);
  197. unsigned long *ptr = gdb_regs;
  198. int reg;
  199. memset(gdb_regs, 0, NUMREGBYTES);
  200. /* Regs GPR0-2 */
  201. for (reg = 0; reg < 3; reg++)
  202. PACK64(ptr, regs->gpr[reg]);
  203. /* Regs GPR3-13 are caller saved, not in regs->gpr[] */
  204. ptr += 11;
  205. /* Regs GPR14-31 */
  206. for (reg = 14; reg < 32; reg++)
  207. PACK64(ptr, regs->gpr[reg]);
  208. #ifdef CONFIG_FSL_BOOKE
  209. #ifdef CONFIG_SPE
  210. for (reg = 0; reg < 32; reg++)
  211. PACK64(ptr, p->thread.evr[reg]);
  212. #else
  213. ptr += 32;
  214. #endif
  215. #else
  216. /* fp registers not used by kernel, leave zero */
  217. ptr += 32 * 8 / sizeof(long);
  218. #endif
  219. PACK64(ptr, regs->nip);
  220. PACK64(ptr, regs->msr);
  221. PACK32(ptr, regs->ccr);
  222. PACK64(ptr, regs->link);
  223. PACK64(ptr, regs->ctr);
  224. PACK32(ptr, regs->xer);
  225. BUG_ON((unsigned long)ptr >
  226. (unsigned long)(((void *)gdb_regs) + NUMREGBYTES));
  227. }
  228. #define GDB_SIZEOF_REG sizeof(unsigned long)
  229. #define GDB_SIZEOF_REG_U32 sizeof(u32)
  230. #ifdef CONFIG_FSL_BOOKE
  231. #define GDB_SIZEOF_FLOAT_REG sizeof(unsigned long)
  232. #else
  233. #define GDB_SIZEOF_FLOAT_REG sizeof(u64)
  234. #endif
  235. struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
  236. {
  237. { "r0", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[0]) },
  238. { "r1", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[1]) },
  239. { "r2", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[2]) },
  240. { "r3", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[3]) },
  241. { "r4", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[4]) },
  242. { "r5", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[5]) },
  243. { "r6", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[6]) },
  244. { "r7", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[7]) },
  245. { "r8", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[8]) },
  246. { "r9", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[9]) },
  247. { "r10", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[10]) },
  248. { "r11", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[11]) },
  249. { "r12", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[12]) },
  250. { "r13", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[13]) },
  251. { "r14", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[14]) },
  252. { "r15", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[15]) },
  253. { "r16", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[16]) },
  254. { "r17", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[17]) },
  255. { "r18", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[18]) },
  256. { "r19", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[19]) },
  257. { "r20", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[20]) },
  258. { "r21", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[21]) },
  259. { "r22", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[22]) },
  260. { "r23", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[23]) },
  261. { "r24", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[24]) },
  262. { "r25", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[25]) },
  263. { "r26", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[26]) },
  264. { "r27", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[27]) },
  265. { "r28", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[28]) },
  266. { "r29", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[29]) },
  267. { "r30", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[30]) },
  268. { "r31", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[31]) },
  269. { "f0", GDB_SIZEOF_FLOAT_REG, 0 },
  270. { "f1", GDB_SIZEOF_FLOAT_REG, 1 },
  271. { "f2", GDB_SIZEOF_FLOAT_REG, 2 },
  272. { "f3", GDB_SIZEOF_FLOAT_REG, 3 },
  273. { "f4", GDB_SIZEOF_FLOAT_REG, 4 },
  274. { "f5", GDB_SIZEOF_FLOAT_REG, 5 },
  275. { "f6", GDB_SIZEOF_FLOAT_REG, 6 },
  276. { "f7", GDB_SIZEOF_FLOAT_REG, 7 },
  277. { "f8", GDB_SIZEOF_FLOAT_REG, 8 },
  278. { "f9", GDB_SIZEOF_FLOAT_REG, 9 },
  279. { "f10", GDB_SIZEOF_FLOAT_REG, 10 },
  280. { "f11", GDB_SIZEOF_FLOAT_REG, 11 },
  281. { "f12", GDB_SIZEOF_FLOAT_REG, 12 },
  282. { "f13", GDB_SIZEOF_FLOAT_REG, 13 },
  283. { "f14", GDB_SIZEOF_FLOAT_REG, 14 },
  284. { "f15", GDB_SIZEOF_FLOAT_REG, 15 },
  285. { "f16", GDB_SIZEOF_FLOAT_REG, 16 },
  286. { "f17", GDB_SIZEOF_FLOAT_REG, 17 },
  287. { "f18", GDB_SIZEOF_FLOAT_REG, 18 },
  288. { "f19", GDB_SIZEOF_FLOAT_REG, 19 },
  289. { "f20", GDB_SIZEOF_FLOAT_REG, 20 },
  290. { "f21", GDB_SIZEOF_FLOAT_REG, 21 },
  291. { "f22", GDB_SIZEOF_FLOAT_REG, 22 },
  292. { "f23", GDB_SIZEOF_FLOAT_REG, 23 },
  293. { "f24", GDB_SIZEOF_FLOAT_REG, 24 },
  294. { "f25", GDB_SIZEOF_FLOAT_REG, 25 },
  295. { "f26", GDB_SIZEOF_FLOAT_REG, 26 },
  296. { "f27", GDB_SIZEOF_FLOAT_REG, 27 },
  297. { "f28", GDB_SIZEOF_FLOAT_REG, 28 },
  298. { "f29", GDB_SIZEOF_FLOAT_REG, 29 },
  299. { "f30", GDB_SIZEOF_FLOAT_REG, 30 },
  300. { "f31", GDB_SIZEOF_FLOAT_REG, 31 },
  301. { "pc", GDB_SIZEOF_REG, offsetof(struct pt_regs, nip) },
  302. { "msr", GDB_SIZEOF_REG, offsetof(struct pt_regs, msr) },
  303. { "cr", GDB_SIZEOF_REG_U32, offsetof(struct pt_regs, ccr) },
  304. { "lr", GDB_SIZEOF_REG, offsetof(struct pt_regs, link) },
  305. { "ctr", GDB_SIZEOF_REG_U32, offsetof(struct pt_regs, ctr) },
  306. { "xer", GDB_SIZEOF_REG, offsetof(struct pt_regs, xer) },
  307. };
  308. char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
  309. {
  310. if (regno >= DBG_MAX_REG_NUM || regno < 0)
  311. return NULL;
  312. if (regno < 32 || regno >= 64)
  313. /* First 0 -> 31 gpr registers*/
  314. /* pc, msr, ls... registers 64 -> 69 */
  315. memcpy(mem, (void *)regs + dbg_reg_def[regno].offset,
  316. dbg_reg_def[regno].size);
  317. if (regno >= 32 && regno < 64) {
  318. /* FP registers 32 -> 63 */
  319. #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE)
  320. if (current)
  321. memcpy(mem, &current->thread.evr[regno-32],
  322. dbg_reg_def[regno].size);
  323. #else
  324. /* fp registers not used by kernel, leave zero */
  325. memset(mem, 0, dbg_reg_def[regno].size);
  326. #endif
  327. }
  328. return dbg_reg_def[regno].name;
  329. }
  330. int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
  331. {
  332. if (regno >= DBG_MAX_REG_NUM || regno < 0)
  333. return -EINVAL;
  334. if (regno < 32 || regno >= 64)
  335. /* First 0 -> 31 gpr registers*/
  336. /* pc, msr, ls... registers 64 -> 69 */
  337. memcpy((void *)regs + dbg_reg_def[regno].offset, mem,
  338. dbg_reg_def[regno].size);
  339. if (regno >= 32 && regno < 64) {
  340. /* FP registers 32 -> 63 */
  341. #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE)
  342. memcpy(&current->thread.evr[regno-32], mem,
  343. dbg_reg_def[regno].size);
  344. #else
  345. /* fp registers not used by kernel, leave zero */
  346. return 0;
  347. #endif
  348. }
  349. return 0;
  350. }
  351. void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)
  352. {
  353. regs->nip = pc;
  354. }
  355. /*
  356. * This function does PowerPC specific procesing for interfacing to gdb.
  357. */
  358. int kgdb_arch_handle_exception(int vector, int signo, int err_code,
  359. char *remcom_in_buffer, char *remcom_out_buffer,
  360. struct pt_regs *linux_regs)
  361. {
  362. char *ptr = &remcom_in_buffer[1];
  363. unsigned long addr;
  364. switch (remcom_in_buffer[0]) {
  365. /*
  366. * sAA..AA Step one instruction from AA..AA
  367. * This will return an error to gdb ..
  368. */
  369. case 's':
  370. case 'c':
  371. /* handle the optional parameter */
  372. if (kgdb_hex2long(&ptr, &addr))
  373. linux_regs->nip = addr;
  374. atomic_set(&kgdb_cpu_doing_single_step, -1);
  375. /* set the trace bit if we're stepping */
  376. if (remcom_in_buffer[0] == 's') {
  377. #ifdef CONFIG_PPC_ADV_DEBUG_REGS
  378. mtspr(SPRN_DBCR0,
  379. mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
  380. linux_regs->msr |= MSR_DE;
  381. #else
  382. linux_regs->msr |= MSR_SE;
  383. #endif
  384. atomic_set(&kgdb_cpu_doing_single_step,
  385. raw_smp_processor_id());
  386. }
  387. return 0;
  388. }
  389. return -1;
  390. }
  391. /*
  392. * Global data
  393. */
  394. struct kgdb_arch arch_kgdb_ops = {
  395. .gdb_bpt_instr = {0x7d, 0x82, 0x10, 0x08},
  396. };
  397. static int kgdb_not_implemented(struct pt_regs *regs)
  398. {
  399. return 0;
  400. }
  401. static void *old__debugger_ipi;
  402. static void *old__debugger;
  403. static void *old__debugger_bpt;
  404. static void *old__debugger_sstep;
  405. static void *old__debugger_iabr_match;
  406. static void *old__debugger_break_match;
  407. static void *old__debugger_fault_handler;
  408. int kgdb_arch_init(void)
  409. {
  410. old__debugger_ipi = __debugger_ipi;
  411. old__debugger = __debugger;
  412. old__debugger_bpt = __debugger_bpt;
  413. old__debugger_sstep = __debugger_sstep;
  414. old__debugger_iabr_match = __debugger_iabr_match;
  415. old__debugger_break_match = __debugger_break_match;
  416. old__debugger_fault_handler = __debugger_fault_handler;
  417. __debugger_ipi = kgdb_call_nmi_hook;
  418. __debugger = kgdb_debugger;
  419. __debugger_bpt = kgdb_handle_breakpoint;
  420. __debugger_sstep = kgdb_singlestep;
  421. __debugger_iabr_match = kgdb_iabr_match;
  422. __debugger_break_match = kgdb_break_match;
  423. __debugger_fault_handler = kgdb_not_implemented;
  424. return 0;
  425. }
  426. void kgdb_arch_exit(void)
  427. {
  428. __debugger_ipi = old__debugger_ipi;
  429. __debugger = old__debugger;
  430. __debugger_bpt = old__debugger_bpt;
  431. __debugger_sstep = old__debugger_sstep;
  432. __debugger_iabr_match = old__debugger_iabr_match;
  433. __debugger_break_match = old__debugger_break_match;
  434. __debugger_fault_handler = old__debugger_fault_handler;
  435. }