kgdb.h 1.7 KB

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