ptrace.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef _I386_PTRACE_H
  2. #define _I386_PTRACE_H
  3. #define EBX 0
  4. #define ECX 1
  5. #define EDX 2
  6. #define ESI 3
  7. #define EDI 4
  8. #define EBP 5
  9. #define EAX 6
  10. #define DS 7
  11. #define ES 8
  12. #define FS 9
  13. #define GS 10
  14. #define ORIG_EAX 11
  15. #define EIP 12
  16. #define CS 13
  17. #define EFL 14
  18. #define UESP 15
  19. #define SS 16
  20. #define FRAME_SIZE 17
  21. /* this struct defines the way the registers are stored on the
  22. stack during a system call. */
  23. struct pt_regs {
  24. long ebx;
  25. long ecx;
  26. long edx;
  27. long esi;
  28. long edi;
  29. long ebp;
  30. long eax;
  31. int xds;
  32. int xes;
  33. int xfs;
  34. int xgs;
  35. long orig_eax;
  36. long eip;
  37. int xcs;
  38. long eflags;
  39. long esp;
  40. int xss;
  41. } __attribute__ ((packed));
  42. /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
  43. #define PTRACE_GETREGS 12
  44. #define PTRACE_SETREGS 13
  45. #define PTRACE_GETFPREGS 14
  46. #define PTRACE_SETFPREGS 15
  47. #define PTRACE_GETFPXREGS 18
  48. #define PTRACE_SETFPXREGS 19
  49. #define PTRACE_SETOPTIONS 21
  50. /* options set using PTRACE_SETOPTIONS */
  51. #define PTRACE_O_TRACESYSGOOD 0x00000001
  52. #ifdef __KERNEL__
  53. #define user_mode(regs) ((VM_MASK & (regs)->eflags) || (3 & (regs)->xcs))
  54. #define instruction_pointer(regs) ((regs)->eip)
  55. extern void show_regs(struct pt_regs *);
  56. #endif
  57. #endif