ptrace-abi.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. #endif
  67. #define PTRACE_SYSEMU 31
  68. #define PTRACE_SYSEMU_SINGLESTEP 32
  69. #define PTRACE_SINGLEBLOCK 33 /* resume execution until next branch */
  70. #ifndef __ASSEMBLY__
  71. #include <linux/types.h>
  72. /* configuration/status structure used in PTRACE_BTS_CONFIG and
  73. PTRACE_BTS_STATUS commands.
  74. */
  75. struct ptrace_bts_config {
  76. /* requested or actual size of BTS buffer in bytes */
  77. __u32 size;
  78. /* bitmask of below flags */
  79. __u32 flags;
  80. /* buffer overflow signal */
  81. __u32 signal;
  82. /* actual size of bts_struct in bytes */
  83. __u32 bts_size;
  84. };
  85. #endif /* __ASSEMBLY__ */
  86. #define PTRACE_BTS_O_TRACE 0x1 /* branch trace */
  87. #define PTRACE_BTS_O_SCHED 0x2 /* scheduling events w/ jiffies */
  88. #define PTRACE_BTS_O_SIGNAL 0x4 /* send SIG<signal> on buffer overflow
  89. instead of wrapping around */
  90. #define PTRACE_BTS_O_ALLOC 0x8 /* (re)allocate buffer */
  91. #define PTRACE_BTS_CONFIG 40
  92. /* Configure branch trace recording.
  93. ADDR points to a struct ptrace_bts_config.
  94. DATA gives the size of that buffer.
  95. A new buffer is allocated, if requested in the flags.
  96. An overflow signal may only be requested for new buffers.
  97. Returns the number of bytes read.
  98. */
  99. #define PTRACE_BTS_STATUS 41
  100. /* Return the current configuration in a struct ptrace_bts_config
  101. pointed to by ADDR; DATA gives the size of that buffer.
  102. Returns the number of bytes written.
  103. */
  104. #define PTRACE_BTS_SIZE 42
  105. /* Return the number of available BTS records for draining.
  106. DATA and ADDR are ignored.
  107. */
  108. #define PTRACE_BTS_GET 43
  109. /* Get a single BTS record.
  110. DATA defines the index into the BTS array, where 0 is the newest
  111. entry, and higher indices refer to older entries.
  112. ADDR is pointing to struct bts_struct (see asm/ds.h).
  113. */
  114. #define PTRACE_BTS_CLEAR 44
  115. /* Clear the BTS buffer.
  116. DATA and ADDR are ignored.
  117. */
  118. #define PTRACE_BTS_DRAIN 45
  119. /* Read all available BTS records and clear the buffer.
  120. ADDR points to an array of struct bts_struct.
  121. DATA gives the size of that buffer.
  122. BTS records are read from oldest to newest.
  123. Returns number of BTS records drained.
  124. */
  125. #endif /* _ASM_X86_PTRACE_ABI_H */