kgdb.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 NUMREGBYTES ((GDB_GS+1)*4)
  40. #else /* ! CONFIG_X86_32 */
  41. enum regnames64 {
  42. GDB_AX, /* 0 */
  43. GDB_BX, /* 1 */
  44. GDB_CX, /* 2 */
  45. GDB_DX, /* 3 */
  46. GDB_SI, /* 4 */
  47. GDB_DI, /* 5 */
  48. GDB_BP, /* 6 */
  49. GDB_SP, /* 7 */
  50. GDB_R8, /* 8 */
  51. GDB_R9, /* 9 */
  52. GDB_R10, /* 10 */
  53. GDB_R11, /* 11 */
  54. GDB_R12, /* 12 */
  55. GDB_R13, /* 13 */
  56. GDB_R14, /* 14 */
  57. GDB_R15, /* 15 */
  58. GDB_PC, /* 16 */
  59. };
  60. enum regnames32 {
  61. GDB_PS = 34,
  62. GDB_CS,
  63. GDB_SS,
  64. };
  65. #define NUMREGBYTES ((GDB_SS+1)*4)
  66. #endif /* CONFIG_X86_32 */
  67. static inline void arch_kgdb_breakpoint(void)
  68. {
  69. asm(" int $3");
  70. }
  71. #define BREAK_INSTR_SIZE 1
  72. #define CACHE_FLUSH_IS_SAFE 1
  73. #endif /* _ASM_X86_KGDB_H */