ptrace-abi.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #ifndef _ASM_X86_PTRACE_ABI_H
  2. #define _ASM_X86_PTRACE_ABI_H
  3. #ifdef __i386__
  4. #define EBX 0
  5. #define ECX 1
  6. #define EDX 2
  7. #define ESI 3
  8. #define EDI 4
  9. #define EBP 5
  10. #define EAX 6
  11. #define DS 7
  12. #define ES 8
  13. #define FS 9
  14. #define GS 10
  15. #define ORIG_EAX 11
  16. #define EIP 12
  17. #define CS 13
  18. #define EFL 14
  19. #define UESP 15
  20. #define SS 16
  21. #define FRAME_SIZE 17
  22. #else /* __i386__ */
  23. #if defined(__ASSEMBLY__) || defined(__FRAME_OFFSETS)
  24. #define R15 0
  25. #define R14 8
  26. #define R13 16
  27. #define R12 24
  28. #define RBP 32
  29. #define RBX 40
  30. /* arguments: interrupts/non tracing syscalls only save upto here*/
  31. #define R11 48
  32. #define R10 56
  33. #define R9 64
  34. #define R8 72
  35. #define RAX 80
  36. #define RCX 88
  37. #define RDX 96
  38. #define RSI 104
  39. #define RDI 112
  40. #define ORIG_RAX 120 /* = ERROR */
  41. /* end of arguments */
  42. /* cpu exception frame or undefined in case of fast syscall. */
  43. #define RIP 128
  44. #define CS 136
  45. #define EFLAGS 144
  46. #define RSP 152
  47. #define SS 160
  48. #define ARGOFFSET R11
  49. #endif /* __ASSEMBLY__ */
  50. /* top of stack page */
  51. #define FRAME_SIZE 168
  52. #endif /* !__i386__ */
  53. /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
  54. #define PTRACE_GETREGS 12
  55. #define PTRACE_SETREGS 13
  56. #define PTRACE_GETFPREGS 14
  57. #define PTRACE_SETFPREGS 15
  58. #define PTRACE_GETFPXREGS 18
  59. #define PTRACE_SETFPXREGS 19
  60. #define PTRACE_OLDSETOPTIONS 21
  61. /* only useful for access 32bit programs / kernels */
  62. #define PTRACE_GET_THREAD_AREA 25
  63. #define PTRACE_SET_THREAD_AREA 26
  64. #ifdef __x86_64__
  65. # define PTRACE_ARCH_PRCTL 30
  66. #else
  67. # define PTRACE_SYSEMU 31
  68. # define PTRACE_SYSEMU_SINGLESTEP 32
  69. #endif
  70. #define PTRACE_SINGLEBLOCK 33 /* resume execution until next branch */
  71. /* Return maximal BTS buffer size in number of records,
  72. if successuf; -1, otherwise.
  73. EOPNOTSUPP...processor does not support bts tracing */
  74. #define PTRACE_BTS_MAX_BUFFER_SIZE 40
  75. /* Allocate new bts buffer (free old one, if exists) of size DATA bts records;
  76. parameter ADDR is ignored.
  77. Return 0, if successful; -1, otherwise.
  78. EOPNOTSUPP...processor does not support bts tracing
  79. EINVAL.......invalid size in records
  80. ENOMEM.......out of memory */
  81. #define PTRACE_BTS_ALLOCATE_BUFFER 41
  82. /* Return the size of the bts buffer in number of bts records,
  83. if successful; -1, otherwise.
  84. EOPNOTSUPP...processor does not support bts tracing
  85. ENXIO........no buffer allocated */
  86. #define PTRACE_BTS_GET_BUFFER_SIZE 42
  87. /* Return the index of the next bts record to be written,
  88. if successful; -1, otherwise.
  89. EOPNOTSUPP...processor does not support bts tracing
  90. ENXIO........no buffer allocated
  91. After the first warp-around, this is the start of the circular bts buffer. */
  92. #define PTRACE_BTS_GET_INDEX 43
  93. /* Read the DATA'th bts record into a ptrace_bts_record buffer provided in ADDR.
  94. Return 0, if successful; -1, otherwise
  95. EOPNOTSUPP...processor does not support bts tracing
  96. ENXIO........no buffer allocated
  97. EINVAL.......invalid index */
  98. #define PTRACE_BTS_READ_RECORD 44
  99. /* Configure last branch trace; the configuration is given as a bit-mask of
  100. PTRACE_BTS_O_* options in DATA; parameter ADDR is ignored.
  101. Return 0, if successful; -1, otherwise
  102. EOPNOTSUPP...processor does not support bts tracing
  103. ENXIO........no buffer allocated */
  104. #define PTRACE_BTS_CONFIG 45
  105. /* Return the configuration as bit-mask of PTRACE_BTS_O_* options
  106. if successful; -1, otherwise.
  107. EOPNOTSUPP...processor does not support bts tracing
  108. ENXIO........no buffer allocated */
  109. #define PTRACE_BTS_STATUS 46
  110. /* Trace configuration options */
  111. /* Collect last branch trace */
  112. #define PTRACE_BTS_O_TRACE_TASK 0x1
  113. /* Take timestamps when the task arrives and departs */
  114. #define PTRACE_BTS_O_TIMESTAMPS 0x2
  115. #endif