ptrace.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #ifndef _X86_64_PTRACE_H
  2. #define _X86_64_PTRACE_H
  3. #if defined(__ASSEMBLY__) || defined(__FRAME_OFFSETS)
  4. #define R15 0
  5. #define R14 8
  6. #define R13 16
  7. #define R12 24
  8. #define RBP 32
  9. #define RBX 40
  10. /* arguments: interrupts/non tracing syscalls only save upto here*/
  11. #define R11 48
  12. #define R10 56
  13. #define R9 64
  14. #define R8 72
  15. #define RAX 80
  16. #define RCX 88
  17. #define RDX 96
  18. #define RSI 104
  19. #define RDI 112
  20. #define ORIG_RAX 120 /* = ERROR */
  21. /* end of arguments */
  22. /* cpu exception frame or undefined in case of fast syscall. */
  23. #define RIP 128
  24. #define CS 136
  25. #define EFLAGS 144
  26. #define RSP 152
  27. #define SS 160
  28. #define ARGOFFSET R11
  29. #endif /* __ASSEMBLY__ */
  30. /* top of stack page */
  31. #define FRAME_SIZE 168
  32. #define PTRACE_OLDSETOPTIONS 21
  33. #ifndef __ASSEMBLY__
  34. struct pt_regs {
  35. unsigned long r15;
  36. unsigned long r14;
  37. unsigned long r13;
  38. unsigned long r12;
  39. unsigned long rbp;
  40. unsigned long rbx;
  41. /* arguments: non interrupts/non tracing syscalls only save upto here*/
  42. unsigned long r11;
  43. unsigned long r10;
  44. unsigned long r9;
  45. unsigned long r8;
  46. unsigned long rax;
  47. unsigned long rcx;
  48. unsigned long rdx;
  49. unsigned long rsi;
  50. unsigned long rdi;
  51. unsigned long orig_rax;
  52. /* end of arguments */
  53. /* cpu exception frame or undefined */
  54. unsigned long rip;
  55. unsigned long cs;
  56. unsigned long eflags;
  57. unsigned long rsp;
  58. unsigned long ss;
  59. /* top of stack page */
  60. };
  61. #endif
  62. /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
  63. #define PTRACE_GETREGS 12
  64. #define PTRACE_SETREGS 13
  65. #define PTRACE_GETFPREGS 14
  66. #define PTRACE_SETFPREGS 15
  67. #define PTRACE_GETFPXREGS 18
  68. #define PTRACE_SETFPXREGS 19
  69. /* only useful for access 32bit programs */
  70. #define PTRACE_GET_THREAD_AREA 25
  71. #define PTRACE_SET_THREAD_AREA 26
  72. #define PTRACE_ARCH_PRCTL 30 /* arch_prctl for child */
  73. #if defined(__KERNEL__) && !defined(__ASSEMBLY__)
  74. #define user_mode(regs) (!!((regs)->cs & 3))
  75. #define user_mode_vm(regs) user_mode(regs)
  76. #define instruction_pointer(regs) ((regs)->rip)
  77. extern unsigned long profile_pc(struct pt_regs *regs);
  78. void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
  79. struct task_struct;
  80. extern unsigned long
  81. convert_rip_to_linear(struct task_struct *child, struct pt_regs *regs);
  82. enum {
  83. EF_CF = 0x00000001,
  84. EF_PF = 0x00000004,
  85. EF_AF = 0x00000010,
  86. EF_ZF = 0x00000040,
  87. EF_SF = 0x00000080,
  88. EF_TF = 0x00000100,
  89. EF_IE = 0x00000200,
  90. EF_DF = 0x00000400,
  91. EF_OF = 0x00000800,
  92. EF_IOPL = 0x00003000,
  93. EF_IOPL_RING0 = 0x00000000,
  94. EF_IOPL_RING1 = 0x00001000,
  95. EF_IOPL_RING2 = 0x00002000,
  96. EF_NT = 0x00004000, /* nested task */
  97. EF_RF = 0x00010000, /* resume */
  98. EF_VM = 0x00020000, /* virtual mode */
  99. EF_AC = 0x00040000, /* alignment */
  100. EF_VIF = 0x00080000, /* virtual interrupt */
  101. EF_VIP = 0x00100000, /* virtual interrupt pending */
  102. EF_ID = 0x00200000, /* id */
  103. };
  104. #endif
  105. #endif