ptrace.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #ifndef _I386_PTRACE_H
  2. #define _I386_PTRACE_H
  3. #include <asm/types.h>
  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. /* this struct defines the way the registers are stored on the
  23. stack during a system call. */
  24. struct pt_regs {
  25. long ebx;
  26. long ecx;
  27. long edx;
  28. long esi;
  29. long edi;
  30. long ebp;
  31. long eax;
  32. int xds;
  33. int xes;
  34. int xfs;
  35. int xgs;
  36. long orig_eax;
  37. long eip;
  38. int xcs;
  39. long eflags;
  40. long esp;
  41. int xss;
  42. } __attribute__ ((packed));
  43. struct irq_regs {
  44. /* Pushed by irq_common_entry */
  45. long ebx;
  46. long ecx;
  47. long edx;
  48. long esi;
  49. long edi;
  50. long ebp;
  51. long esp;
  52. long eax;
  53. long xds;
  54. long xes;
  55. long xfs;
  56. long xgs;
  57. long xss;
  58. /* Pushed by vector handler (irq_<num>) */
  59. long irq_id;
  60. /* Pushed by cpu in response to interrupt */
  61. union {
  62. struct {
  63. long eip;
  64. long xcs;
  65. long eflags;
  66. } ctx1;
  67. struct {
  68. long err;
  69. long eip;
  70. long xcs;
  71. long eflags;
  72. } ctx2;
  73. } context;
  74. } __attribute__ ((packed));
  75. /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
  76. #define PTRACE_GETREGS 12
  77. #define PTRACE_SETREGS 13
  78. #define PTRACE_GETFPREGS 14
  79. #define PTRACE_SETFPREGS 15
  80. #define PTRACE_GETFPXREGS 18
  81. #define PTRACE_SETFPXREGS 19
  82. #define PTRACE_SETOPTIONS 21
  83. /* options set using PTRACE_SETOPTIONS */
  84. #define PTRACE_O_TRACESYSGOOD 0x00000001
  85. #ifdef __KERNEL__
  86. #define user_mode(regs) ((VM_MASK & (regs)->eflags) || (3 & (regs)->xcs))
  87. #define instruction_pointer(regs) ((regs)->eip)
  88. extern void show_regs(struct pt_regs *);
  89. #endif
  90. #endif