ptrace-abi.h 3.6 KB

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