ptrace.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. long orig_eax;
  34. long eip;
  35. int xcs;
  36. long eflags;
  37. long esp;
  38. int xss;
  39. };
  40. /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
  41. #define PTRACE_GETREGS 12
  42. #define PTRACE_SETREGS 13
  43. #define PTRACE_GETFPREGS 14
  44. #define PTRACE_SETFPREGS 15
  45. #define PTRACE_GETFPXREGS 18
  46. #define PTRACE_SETFPXREGS 19
  47. #define PTRACE_OLDSETOPTIONS 21
  48. #define PTRACE_GET_THREAD_AREA 25
  49. #define PTRACE_SET_THREAD_AREA 26
  50. #ifdef __KERNEL__
  51. #include <asm/vm86.h>
  52. struct task_struct;
  53. extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);
  54. /*
  55. * user_mode_vm(regs) determines whether a register set came from user mode.
  56. * This is true if V8086 mode was enabled OR if the register set was from
  57. * protected mode with RPL-3 CS value. This tricky test checks that with
  58. * one comparison. Many places in the kernel can bypass this full check
  59. * if they have already ruled out V8086 mode, so user_mode(regs) can be used.
  60. */
  61. static inline int user_mode(struct pt_regs *regs)
  62. {
  63. return (regs->xcs & 3) != 0;
  64. }
  65. static inline int user_mode_vm(struct pt_regs *regs)
  66. {
  67. return ((regs->xcs & 3) | (regs->eflags & VM_MASK)) != 0;
  68. }
  69. #define instruction_pointer(regs) ((regs)->eip)
  70. #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
  71. extern unsigned long profile_pc(struct pt_regs *regs);
  72. #else
  73. #define profile_pc(regs) instruction_pointer(regs)
  74. #endif
  75. #endif /* __KERNEL__ */
  76. #endif