kgdb.h 2.1 KB

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