kgdb.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef _ASM_X86_KGDB_H
  2. #define _ASM_X86_KGDB_H
  3. /*
  4. * Copyright (C) 2001-2004 Amit S. Kale
  5. * Copyright (C) 2008 Wind River Systems, Inc.
  6. */
  7. #include <asm/ptrace.h>
  8. /*
  9. * BUFMAX defines the maximum number of characters in inbound/outbound
  10. * buffers at least NUMREGBYTES*2 are needed for register packets
  11. * Longer buffer is needed to list all threads
  12. */
  13. #define BUFMAX 1024
  14. /*
  15. * Note that this register image is in a different order than
  16. * the register image that Linux produces at interrupt time.
  17. *
  18. * Linux's register image is defined by struct pt_regs in ptrace.h.
  19. * Just why GDB uses a different order is a historical mystery.
  20. */
  21. #ifdef CONFIG_X86_32
  22. enum regnames {
  23. GDB_AX, /* 0 */
  24. GDB_CX, /* 1 */
  25. GDB_DX, /* 2 */
  26. GDB_BX, /* 3 */
  27. GDB_SP, /* 4 */
  28. GDB_BP, /* 5 */
  29. GDB_SI, /* 6 */
  30. GDB_DI, /* 7 */
  31. GDB_PC, /* 8 also known as eip */
  32. GDB_PS, /* 9 also known as eflags */
  33. GDB_CS, /* 10 */
  34. GDB_SS, /* 11 */
  35. GDB_DS, /* 12 */
  36. GDB_ES, /* 13 */
  37. GDB_FS, /* 14 */
  38. GDB_GS, /* 15 */
  39. };
  40. #define GDB_ORIG_AX 41
  41. #define DBG_MAX_REG_NUM 16
  42. #define NUMREGBYTES ((GDB_GS+1)*4)
  43. #else /* ! CONFIG_X86_32 */
  44. enum regnames {
  45. GDB_AX, /* 0 */
  46. GDB_BX, /* 1 */
  47. GDB_CX, /* 2 */
  48. GDB_DX, /* 3 */
  49. GDB_SI, /* 4 */
  50. GDB_DI, /* 5 */
  51. GDB_BP, /* 6 */
  52. GDB_SP, /* 7 */
  53. GDB_R8, /* 8 */
  54. GDB_R9, /* 9 */
  55. GDB_R10, /* 10 */
  56. GDB_R11, /* 11 */
  57. GDB_R12, /* 12 */
  58. GDB_R13, /* 13 */
  59. GDB_R14, /* 14 */
  60. GDB_R15, /* 15 */
  61. GDB_PC, /* 16 */
  62. GDB_PS, /* 17 */
  63. GDB_CS, /* 18 */
  64. GDB_SS, /* 19 */
  65. GDB_DS, /* 20 */
  66. GDB_ES, /* 21 */
  67. GDB_FS, /* 22 */
  68. GDB_GS, /* 23 */
  69. };
  70. #define GDB_ORIG_AX 57
  71. #define DBG_MAX_REG_NUM 24
  72. /* 17 64 bit regs and 5 32 bit regs */
  73. #define NUMREGBYTES ((17 * 8) + (5 * 4))
  74. #endif /* ! CONFIG_X86_32 */
  75. static inline void arch_kgdb_breakpoint(void)
  76. {
  77. asm(" int $3");
  78. }
  79. #define BREAK_INSTR_SIZE 1
  80. #define CACHE_FLUSH_IS_SAFE 1
  81. #define GDB_ADJUSTS_BREAK_OFFSET
  82. extern int kgdb_ll_trap(int cmd, const char *str,
  83. struct pt_regs *regs, long err, int trap, int sig);
  84. #endif /* _ASM_X86_KGDB_H */