kgdb.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright 2013 Tilera Corporation. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11. * NON INFRINGEMENT. See the GNU General Public License for
  12. * more details.
  13. *
  14. * TILE-Gx KGDB support.
  15. */
  16. #ifndef __TILE_KGDB_H__
  17. #define __TILE_KGDB_H__
  18. #include <linux/kdebug.h>
  19. #include <arch/opcode.h>
  20. #define GDB_SIZEOF_REG sizeof(unsigned long)
  21. /*
  22. * TILE-Gx gdb is expecting the following register layout:
  23. * 56 GPRs(R0 - R52, TP, SP, LR), 8 special GPRs(networks and ZERO),
  24. * plus the PC and the faultnum.
  25. *
  26. * Even though kernel not use the 8 special GPRs, they need to be present
  27. * in the registers sent for correct processing in the host-side gdb.
  28. *
  29. */
  30. #define DBG_MAX_REG_NUM (56+8+2)
  31. #define NUMREGBYTES (DBG_MAX_REG_NUM * GDB_SIZEOF_REG)
  32. /*
  33. * BUFMAX defines the maximum number of characters in inbound/outbound
  34. * buffers at least NUMREGBYTES*2 are needed for register packets,
  35. * Longer buffer is needed to list all threads.
  36. */
  37. #define BUFMAX 2048
  38. #define BREAK_INSTR_SIZE TILEGX_BUNDLE_SIZE_IN_BYTES
  39. /*
  40. * Require cache flush for set/clear a software breakpoint or write memory.
  41. */
  42. #define CACHE_FLUSH_IS_SAFE 1
  43. /*
  44. * The compiled-in breakpoint instruction can be used to "break" into
  45. * the debugger via magic system request key (sysrq-G).
  46. */
  47. static tile_bundle_bits compiled_bpt = TILEGX_BPT_BUNDLE | DIE_COMPILED_BPT;
  48. enum tilegx_regnum {
  49. TILEGX_PC_REGNUM = TREG_LAST_GPR + 9,
  50. TILEGX_FAULTNUM_REGNUM,
  51. };
  52. /*
  53. * Generate a breakpoint exception to "break" into the debugger.
  54. */
  55. static inline void arch_kgdb_breakpoint(void)
  56. {
  57. asm volatile (".quad %0\n\t"
  58. ::""(compiled_bpt));
  59. }
  60. #endif /* __TILE_KGDB_H__ */