kgdb.h 2.0 KB

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