ptrace.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. #define PTRACE_SYSEMU 31
  51. #define PTRACE_SYSEMU_SINGLESTEP 32
  52. #ifdef __KERNEL__
  53. #include <asm/vm86.h>
  54. struct task_struct;
  55. extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);
  56. /*
  57. * user_mode_vm(regs) determines whether a register set came from user mode.
  58. * This is true if V8086 mode was enabled OR if the register set was from
  59. * protected mode with RPL-3 CS value. This tricky test checks that with
  60. * one comparison. Many places in the kernel can bypass this full check
  61. * if they have already ruled out V8086 mode, so user_mode(regs) can be used.
  62. */
  63. static inline int user_mode(struct pt_regs *regs)
  64. {
  65. return (regs->xcs & 3) != 0;
  66. }
  67. static inline int user_mode_vm(struct pt_regs *regs)
  68. {
  69. return ((regs->xcs & 3) | (regs->eflags & VM_MASK)) != 0;
  70. }
  71. #define instruction_pointer(regs) ((regs)->eip)
  72. #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
  73. extern unsigned long profile_pc(struct pt_regs *regs);
  74. #else
  75. #define profile_pc(regs) instruction_pointer(regs)
  76. #endif
  77. #endif /* __KERNEL__ */
  78. #endif